I have a static map of the game that the player can find and view. What is the easiest way to implement this so that the player can press "m" from anywhere in the game to view the map, and then be returned to his original location when done viewing?
Page 1 of 1
How do i return from viewing a map?
#2
Posted 23 October 2012 - 01:01 AM
Legend of Rhovanion (a game every mzxer should play imho) had a system work just like this, but there are other and more modern ways to do it. LoR just had a board that had the map on it and 'm' saved the board and player coordinates, teleported you to it, and then back. I can only imagine it worked something like this:
You could also try using a sprite while on the current board using an MZM on the Vlayer. This would work something like this:
end : "keym" set "P_X" "playerx" set "P_Y" "playery" set "$BOARD" "BOARD_NAME" teleport player "MAP" 0 0 end
. "........... and to get back" end : "keym" teleport player "&$BOARD&" "P_X" "P_Y"
You could also try using a sprite while on the current board using an MZM on the Vlayer. This would work something like this:
. "This just initializes the sprite" put "@MAP.mzm" Image_file p02 0 0 set "spr255_vlayer" 1 set "spr255_static" 1 . "worth noting that this makes the map stick to scrolledx/y regardless of where the player is." set "spr255_refx" 0 set "spr255_refy" 0 set "spr255_overlaid" 1 set "spr255_width" "MAP_WIDTH" set "spr255_height" "MAP_HEIGHT" . "to put the map at the viewportx/y" end : "keym" put c?? Sprite pff 0 0 . "0 0 in this case is relative to the viewportx/y, it will just be in the upper left corner" wait 1 zap "keym" 1 end . "to make it go away" end : "keym" set "spr255_off" 1 wait 1 restore "keym" 1 end
This post has been edited by ThDPro: 23 October 2012 - 01:12 AM
original soundtracks
Better Than Nothing - DOMINATION - Commander Keen: Heroes Lost - Welkin - A Confectioner's Recipe - random ThDPro music stuff
<Risu21121> if you're not going to make a good game, you might as well make a blatantly racist one.
<Kuddy> Testicles.
"Where are my folder?" - KKairos
Better Than Nothing - DOMINATION - Commander Keen: Heroes Lost - Welkin - A Confectioner's Recipe - random ThDPro music stuff
<Risu21121> if you're not going to make a good game, you might as well make a blatantly racist one.
<Kuddy> Testicles.
"Where are my folder?" - KKairos
#3
Posted 23 October 2012 - 10:46 AM
You could also use the following, instead of saving coords and board name:
and to return:
I find this working a bit better and more efficient in code to use than saving the coordinates and board name seperately. This command does it all at once.
(Or did I miss something that causes this to no longer work? If so please correct me)
end : "keym" save player position 1 teleport player 'MAP' 0 0
and to return:
end : "keym" restore player position 1
I find this working a bit better and more efficient in code to use than saving the coordinates and board name seperately. This command does it all at once.
(Or did I miss something that causes this to no longer work? If so please correct me)
#4
Posted 23 October 2012 - 11:17 AM
save/restore player position works fine, the only downside is that restore player position uses a fadeout/fadein which you may not necessarily want, especially if you want to incorporate your own transitions. But it's certainly a lot simpler and avoids certain problems that can arise from the other approach such as issues with having multiple boards with the same name.

<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
#5
Posted 24 October 2012 - 12:32 AM
Yeah, to make that more consistent, you can just have it do a color fade out/in before and after the teleport. The waits are important.
. "put this in the global somewhere" color fade out wait 1 save player position teleport player "map" 0 0
. "@menu robot" wait 1 color fade in wait 1 . "loop" restore player position end
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"
xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository
#6
Posted 24 October 2012 - 11:43 PM
Thanks for the tips. The save/restore position works great.
Soli Deo Gloria,
Lysar
Lysar
Share this topic:
Page 1 of 1

Help







