ZFGC

Resources => Coding => Topic started by: Whitay on January 16, 2012, 08:32:24 pm

Title: Question on room changing
Post by: Whitay on January 16, 2012, 08:32:24 pm
hello, i have been in the process of putting together a link to the past styled engine, and it has progressed to a point where a single test room just doesnt put this engine to the full potential this coding could be used for, and i want to test out alot of the features in between levels. so i have started to think up a zelda changing room sequence. and as of now the only thing i have come up with this under links outside room event
"
if Link.x < 0
{
global.mapx -= 1
}

if Link.y < 0
{
global.mapy -= 1
}

if Link.x < 640
{
global.mapx += 1
}

if Link.y < 480
{
global.mapy += 1
}
""
as a sort of check to see where he is. and if he leaves the global.mapx and global.mapy would be changed accordingly. now im stuck on a way to put that into changing rooms. such as having my rooms all have numbers(like rm_5_5) and such. does anyone have any idea what to place as the code to calculate the global.mapx and y into what the room numbers =, and then changing the rooms accordingly? thanks for anyone that gives help.
Title: Re: Question on room changing
Post by: Theforeshadower on January 16, 2012, 09:16:42 pm
A simple suggestion: Use teleportation objects.

Example: You create an object called tel_object1.  If Link touches tel_object1, then goto whatever room would correspond with that object.  Now you could create a few more that transition to different rooms wherever you need it.

Then, so you don't have a million teleport objects, you run a check based on the current room you are in.
So if could look something like:
Link COLLISION tel_object[insert number]
if room == room2
{
goto room 5;
}
else if room == room7
{
goto room4;
}

That's psuedo code.  You could also change that into a switch case.

Title: Re: Question on room changing
Post by: Whitay on January 16, 2012, 09:31:07 pm
I was going to make 4 different objects with different creation codes and such, sort of what you just explained. but i wanted to have it in code, where i could add any room, assign it a number, and be done. not go through tons of rooms and place objects surrounding the map, each with creation codes or seperate codes which in itself would be a great chance for bugs to appear.

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved