• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
18
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
     

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen May 16, 2024
    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.
     
    70
    Posts
    18
    Years
  • 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:

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen May 16, 2024
    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)
     
    70
    Posts
    18
    Years
  • 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:

    FL

    Pokémon Island Creator
    2,454
    Posts
    13
    Years
    • Seen May 16, 2024
    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