• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

trainercard back

  • 70
    Posts
    19
    Years
    Hello everyone, it's me again

    I've updated the PokemonTrainerCard Script to implement the back side of the card. I copied the two methods pbStartScene and pbDrawTrainerCard and pasted these under these two methods. I named the new methods pbStartSceneBack and pbDrawTrainerCardBack. Then in the def pbTrainerCard, i put this code:

    Code:
        if Input.trigger?(Input::C)
            pbStartSceneBack
        end

    It works fine, my only problem is, when i go to the back side of the trainercard in the game, i can't switch back to the front, if i press C again. I will go to the back again and again. I'm sure i must put a condition, but I don't know how. Have anybody a suggestion?

    Thanks
     
    Hello everyone, it's me again

    I've updated the PokemonTrainerCard Script to implement the back side of the card. I copied the two methods pbStartScene and pbDrawTrainerCard and pasted these under these two methods. I named the new methods pbStartSceneBack and pbDrawTrainerCardBack. Then in the def pbTrainerCard, i put this code:

    Code:
        if Input.trigger?(Input::C)
            pbStartSceneBack
        end

    It works fine, my only problem is, when i go to the back side of the trainercard in the game, i can't switch back to the front, if i press C again. I will go to the back again and again. I'm sure i must put a condition, but I don't know how. Have anybody a suggestion?

    Thanks
    You need a flag or something to script check if the card is showing front/back and them, when the button is pressed it activates the other side.
    In front method begin put '@front=true' and in back method put '@front=false'. After the input, instead of 'pbStartSceneBack' use line '(@front) ? pbStartSceneBack : pbStartScene'. This won't works if you are using different classes for front/back.
     
    Thank you very much, it works. :)

    But an another problem is if you want to close this scene while you have open the back side of the card. Instead of closing the scene, it returns to the frontside and the scene closes abrupt without a fade. How can I solve this?

    Edit: If I switch back to the front the same problem appears.
     
    Last edited:
    Thank you very much, it works. :)

    But an another problem is if you want to close this scene while you have open the back side of the card. Instead of closing the scene, it returns to the frontside and the scene closes abrupt without a fade. How can I solve this?

    Edit: If I switch back to the front the same problem appears.
    You probably are putting all the sprites one above another. I my game (that have this feature) I redo the overlay each time before it draws the front and back card with this code:

    Code:
    @sprites["overlay"].dispose if @sprites["overlay"]
    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)
    pbSetSystemFont(@sprites["overlay"].bitmap)
     
    Where exactly should I put this code? In my first try I put it directly under def pbStartSceneFront and def pbStartSceneBack, in my second try I put it under def pbDrawTrainerCardFront and def pbDrawTrainerCardBack. Both aren't working...

    Edit: I don't get it... I put

    @sprites["overlay"].dispose if @sprites["overlay"]

    right before

    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)

    but it seems the game ignores that. It doesn't affect... Here's my acutual code, maybe you can find my mistake.

    Spoiler:
     
    Last edited:
    Where exactly should I put this code? In my first try I put it directly under def pbStartSceneFront and def pbStartSceneBack, in my second try I put it under def pbDrawTrainerCardFront and def pbDrawTrainerCardBack. Both aren't working...

    Edit: I don't get it... I put

    @sprites["overlay"].dispose if @sprites["overlay"]

    right before

    @sprites["overlay"]=BitmapSprite.new(Graphics.width,Graphics.height,@viewport)

    but it seems the game ignores that. It doesn't affect... Here's my acutual code, maybe you can find my mistake.

    Spoiler:
    You are restarting the scene for each trainer card side. Try, before line '(@front) ? pbStartSceneBack : pbStartScene' put
    Code:
    pbDisposeSpriteHash(@sprites)
    @viewport.dispose
     
    Back
    Top