dMZX Forums: How do i return from viewing a map? - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How do i return from viewing a map?

#1 User is offline   Lysar 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 26-June 12
  • Gender:Male
  • Location:AZ desert

Posted 23 October 2012 - 12:19 AM

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?
Soli Deo Gloria,
Lysar
0

#2 User is offline   ThDPro 

  • Brontosaurus-Sea-slug; Gooey and phallic
  • PipPipPipPip
  • Group: Members
  • Posts: 718
  • Joined: 03-December 06
  • Gender:Male
  • Location:Portland, OR

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:
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
0

#3 User is offline   A-Guymzx 

  • Bouncin'
  • PipPipPip
  • Group: Members
  • Posts: 225
  • Joined: 19-June 09
  • Gender:Male
  • Location:The Netherlands

Posted 23 October 2012 - 10:46 AM

You could also use the following, instead of saving coords and board name:
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)
1

#4 User is offline   Dr Lancer-X 

  • 電波、届いた?
  • Group: DigiStaff
  • Posts: 8,936
  • Joined: 20-March 02
  • Location:ur mom nmiaow

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.
Posted Image
<Malwyn> Yes, yes. Don't worry I'd rather masturbate with broken glass than ask you for help again. :(
0

#5 User is offline   Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,895
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

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
0

#6 User is offline   Lysar 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 26-June 12
  • Gender:Male
  • Location:AZ desert

Posted 24 October 2012 - 11:43 PM

Thanks for the tips. The save/restore position works great.
Soli Deo Gloria,
Lysar
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users