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
in the loop do then add
if it isn't in there
then make a new definition called
(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:
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.
:
I hope this is clear because I made it in a hurry..:\
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
Code:
Input.update
then make a new definition called
Code:
search_something
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
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
Last edited: