• 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.

Script to Zoom in on Player

Rayd12smitty

Shadow Maker
645
Posts
12
Years
    • Seen Feb 21, 2016
    I have another quick question. I want to call a script that will make the game zoom in on the player, and then another one that will zoom back out. I want it to be a gradual change like when you use
    Code:
    pbToneChangeAll(0,20)

    where the 0 is the tone it fades to and 20 is the frames it takes to do it. Is there something like this to zoom in on the player in the over world?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    You mean like the battle transition which zooms in on the screen? Class ZoomInTransition is where to get started with that, although what you need depends a huge amount on what you want to do with this zooming.
     

    Rayd12smitty

    Shadow Maker
    645
    Posts
    12
    Years
    • Seen Feb 21, 2016
    You mean like the battle transition which zooms in on the screen? Class ZoomInTransition is where to get started with that, although what you need depends a huge amount on what you want to do with this zooming.

    Yes thats exactly what I want. I want to make it so the player is zoomed in on like that when I select something in the menu. I am using a custom menu so I don't need to know how to edit that.
    Code:
    if Input.trigger?(Input::C)
              Audio.se_play("Audio/SE/Select")
              pbWait(2)
              10.times do
                if $Trainer.pokedex==true
                  @sprites["Pokedex"].y-=16
                end
                if $Trainer.party.length>=1
                  @sprites["Pokemon"].y-=16
                end
                if $Trainer.pokegear==true
                  @sprites["Pokegear"].y-=16
                end
                @sprites["Bag"].y-=16
                @sprites["Trainer Card"].y+=25.5
                @sprites["Save"].y+=25.5
                @sprites["Options"].y+=25.5
                @sprites["Back"].y+=25.5
                pbWait(1)
              end
              ####ZOOM IN ON PLAYER
              Audio.se_play("Audio/SE/navopen")
              pbPokeDev
              ####ZOOM OUT ON PLAYER
              break
            end


    This is the basic idea I had. The commented out parts would be zooming in and then when you close the thing in the menu it zooms back out to normal. I will take just about anything I can get. It doesn't have to show it zoom back out if thats not possible.
     

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • Zooming in on player is basically enlarging the map, and the player. The effect you are looking for is to make a loop which will gradually zoom in until it reaches the desired enlargement point.
     

    Rayd12smitty

    Shadow Maker
    645
    Posts
    12
    Years
    • Seen Feb 21, 2016
    I understand that but I don't know what to put in the loop. I don't know the script XD
     

    Luka S.J.

    Jealous Croatian
    1,270
    Posts
    15
    Years
  • Zooming in on player is basically enlarging the map, and the player. The effect you are looking for is to make a loop which will gradually zoom in until it reaches the desired enlargement point.
    That is not a good way to do it. First of all it's much more complicated. Second, if you are actually enlarging the map, you'll be enlarging it tile by tile, making them out of alignment at points which aren't perfectly divisible by the scale factor. I tried this method; it's complicated, and doesn't give you a smooth animation in return.
    I understand that but I don't know what to put in the loop. I don't know the script XD
    Maruno gave you everything you need. If you look at how the class ZoomInTransition actually works, you'll see that it uses the Graphics.snap_to_bitmap function, which basically creates a temporary screenshot of your screen. Create a sprite with that, and you have yourself a super easy method of creating transitions of all kinds.
     
    Last edited:

    zingzags

    PokemonGDX creator
    536
    Posts
    15
    Years
  • That is not a good way to do it. First of all it's much more complicated. Second, if you are actually enlarging the map, you'll be enlarging it tile by tile, making them out of alignment at points which aren't perfectly divisible by the scale factor. I tried this method; it's complicated, and doesn't give you a smooth animation in return.

    Maruno gave you everything you need. If you look at how the class ZoomInTransition actually works, you'll see that it uses the Graphics.snap_to_bitmap function, which basically creates a temporary screenshot of your screen. Create a sprite with that, and you have yourself a super easy method of creating transitions of all kinds.

    I was talking in theory, never really tried it myself.
     
    Back
    Top