[RESOLVED] Press a key to move a picture?

Started by AresWarrior, May 18, 2010, 04:35:22 pm

Previous topic - Next topic

AresWarrior

May 18, 2010, 04:35:22 pm Last Edit: May 19, 2010, 11:26:54 pm by AresWarrior
 Okay so I am making an item that calls upon a new scene which shows a big picture of the world map. Already have that, but then I want to make another picture (prefferably an icon) that will act like a cursor. What I want to do is be able to press or hold the UP, DOWN, LEFT, RIGHT arrow keys to be able to move the cursor around.

This is the current script I use:

def refresh
self.contents.clear
bitmap = RPG::Cache.panorama('001-Sky01', 0)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(0, 0, bitmap, src_rect, 255)

player = RPG::Cache.character('001-Fighter01', 0)
player_src_rect = Rect.new(0, 0, player.width / 4, player.height / 4)
player_x = 0
player_y = 0
case $game_map.name
when 'MAP_NAME' then player_x = 100 and player_y = 100
end
self.contents.blt(player_x, player_y, player, player_src_rect, 255)
end

The first part shows the panorama as the map. The second part shows the character sprite. Depending on what map you are on, the character sprite's coordinates change. So I'm planing on making another image just like the ones in that script which will use a cursor instead. Does anyone know how to move an image upon pressing arrow keys?  :huh:

Blizzard

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

AresWarrior

the map item goes to a new scene and if i use events then the picture only shows on the main screen (where the player moves around on)

i'm not talking about the map the player moves around on. i am talking about an item that shows the world map

Blizzard

Why don't you just show the picture of the map with an event instead?
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Jragyn

http://forum.chaos-project.com/index.php/topic,57.0.html

You should take a look at the RGSS Graphics for N00bs.
There are 4 chapters and the first couple talk about moving sprites around the screen.
Maybe they will help if your insistent on using scripts versus events :P


--J
A bright light can either illuminate or blind, but how will you know which until you open your eyes?

AresWarrior

wow thankyou! that's EXACTLY what i needed!