2d RPG switch maps (scroll to a different screen)
I''m trying how to switch screens when a char gets to the side of a map, like the old NES Zelda. I think I got an Idea, but it''s not working yet. Its something like this:
if( charposition = .....)
{
laodmap....
}
The problem I''m having with this is that I use MS visual c++, and that idenifier is in a different file and its not letting me use it, (it is declared in a header file) I cant figure out the right way to tell it where the identifier is. I''m using Master SDK 2D game engine.
If anyone can help me figure out how to do it, or what I''m doing wrong I would appericate it.
Thanks,
One-Winged Angel
you should have charx and chary, which are the character''s x and y coordinates. you should check everytime when you recieve a arrow key input (ie the user wants to move the character) to see if the character will be moved off the map. if it will, then load new map. here''s an example:
//inside
switch(keydown)
{
case VKEY_UP:
if(chary + charspeed >= maxY)
newmapstuff(north);
break;
case VKEY_RIGHT:
if(charx + charspeed >= maxX)
newmapstuff(east);
break;
etc...
hope that helps!!
~~KaMiKaZ~~
//inside
switch(keydown)
{
case VKEY_UP:
if(chary + charspeed >= maxY)
newmapstuff(north);
break;
case VKEY_RIGHT:
if(charx + charspeed >= maxX)
newmapstuff(east);
break;
etc...
hope that helps!!
~~KaMiKaZ~~
+<--->+With your feet in the air and your head on the groundTry this trick and spin it, yeahYour head will collapseBut there's nothing in it And you'll ask yourselfWhere is my mind+<--->+
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement