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

Quick X and Y finding in RMXP

Illusion

RMXP game maker
  • 155
    Posts
    19
    Years
    • Seen Oct 17, 2011
    Quick X and Y finding in RMXP(script)

    While making my battle system I really needed the x and y of a picture, but I didn't want to enter random numbers and just see what it does... So when you are showing a picture, add
    Code:
    search_something
    in the loop do then add
    Code:
    Input.update
    if it isn't in there
    then make a new definition called
    Code:
    search_something
    (BTW:You can change "something" into anything you like as long as the one in loop do is identical.)
    Then add this in def search_comething:
    Code:
       if Input.press?(Input::DOWN)
         @hpbar.y +=2
       end
       if Input.press?(Input::UP)
         @hpbar.y -=2
       end
       if Input.press?(Input::RIGHT)
         @hpbar.x +=2
       end
       if Input.press?(Input::LEFT)
         @hpbar.x -=2
       end
       if Input.trigger?(Input::C)
         print @hpbar.x.to_s+" "[email protected]_s
       end
    end
    with replacing @hpbar with the picture you want.
    Then when you've found the x and y delete that script.
    Here is an example using attached pictures.Just add this in your script editor.
    :
    Code:
    class Test_Pok?community
      def hpbarhero
        @hphero = Sprite.new
        @hphero.bitmap = RPG::Cache.picture("HPBarHero")
        @hphero.x = 242
        @hphero.y = 136
        @hphero.z = 500
        @hphero.zoom_x = 2
        @hphero.zoom_y = 2
        @hphero.visible = true
        @hpbar = Sprite.new
        @hpbar.bitmap = RPG::Cache.picture("HPBarMain50")
        @hpbar.x = 302
        @hpbar.y = 170
        @hpbar.z = 500
        @hpbar.zoom_x = 2
        @hpbar.zoom_y = 2
        @hpbar.visible = true
        loop do
         update_hpbarhero
         Graphics.update
         Input.update
       end
     end
     def update_hpbarhero
       @hpbar.update
          if Input.press?(Input::DOWN)
         @hpbar.y +=2
       end
       if Input.press?(Input::UP)
         @hpbar.y -=2
       end
       if Input.press?(Input::RIGHT)
         @hpbar.x +=2
       end
       if Input.press?(Input::LEFT)
         @hpbar.x -=2
       end
       if Input.trigger?(Input::C)
         print @hpbar.x.to_s+" "[email protected]_s
       end
     end
    end
    I hope this is clear because I made it in a hurry..:\
     
    Last edited:

    Illusion

    RMXP game maker
  • 155
    Posts
    19
    Years
    • Seen Oct 17, 2011
    Well just add this in your script editor and add the provided ressources. Then in an event do call script and type this in :

    PHP:
    class Test
      def hpbarhero
        @spriteset = Spriteset_Map.new
        @hphero = Sprite.new
        @hphero.bitmap = RPG::Cache.picture("HPBarHero")
        @hphero.x = 242
        @hphero.y = 136
        @hphero.z = 500
        @hphero.zoom_x = 2
        @hphero.zoom_y = 2
        @hphero.visible = true
        @hpbar = Sprite.new
        @hpbar.bitmap = RPG::Cache.picture("HPBarMain50")
        @hpbar.x = 302
        @hpbar.y = 170
        @hpbar.z = 500
        @hpbar.zoom_x = 2
        @hpbar.zoom_y = 2
        @hpbar.visible = true
        Graphics.transition
        loop do
         update_hpbarhero
         Graphics.update
         Input.update
         if $scene != self
           break
         end
       end
      @spriteset.dispose
      @hpbar.dispose
      @hphero.dispose
     end
     def update_hpbarhero
       @spriteset.update
       @hpbar.update
          if Input.press?(Input::DOWN)
         @hpbar.y +=2
       end
       if Input.press?(Input::UP)
         @hpbar.y -=2
       end
       if Input.press?(Input::RIGHT)
         @hpbar.x +=2
       end
       if Input.press?(Input::LEFT)
         @hpbar.x -=2
       end
       if Input.trigger?(Input::C)
         print @hpbar.x.to_s+" "[email protected]_s
       end
       if Input.trigger?(Input::B)
         $scene = Scene_Map.new
       end
     end
    end
     
    Back
    Top