ZFGC
Resources => Coding => Topic started by: xxbloodlustxx on April 04, 2006, 04:52:04 pm
-
Okay, so I'm still working on a demo for my game, and I want to be able to go into houses and stuff, but I'm having just a bit of difficulty with making room transitions look nice. For example, how do you make the main character walk into a room and go to a certain position in that room, instead of where you started him off in that room before? BTW im using GM. Help would be much appreciated :)
-
do you mean a room to room engine?, i know that hyrule_boy or deku_stick have one try to ask them
-
Okay, so I'm still working on a demo for my game, and I want to be able to go into houses and stuff, but I'm having just a bit of difficulty with making room transitions look nice. For example, how do you make the main character walk into a room and go to a certain position in that room, instead of where you started him off in that room before? BTW im using GM. Help would be much appreciated :)
You are going about this all wrong. Make your characters object persistent. Have him only be created in one single room, and then when he moves room change the x and y of him, heres and example, for moving him when he hits the object that will make him move room:
Room = [yourroom];
obj[yourobject].x = [wherever];
obj[yourobject].y = [wherever];
Like that. Hope it helped.
-
wow thanks man, it worked. :D it's weird how the solution is actually simple, but i was doing all this complex crap to try to get it to work. anyway, thanks man.
-
wow thanks man, it worked. :D it's weird how the solution is actually simple, but i was doing all this complex crap to try to get it to work. anyway, thanks man.
Your welcome, just needed some advice from experienced gamemaker users. The ammount of mistakes i made like that, i did it all with global variables at first before i realised that i could do it with the obj[name].x ect, those were the days.
-
Persistant is really really bad if you use variables it will screw them. Persistant isn't the solution.
-
The way that I do it is actually pretty simple.
In the "Outside Room" action for Link, put this code.
(This is an example for going down out of a room)
if room = [whateverroom] {
if [LinkObject.y] > [TheBiggestYCoordinateOnTheMap] {
room_goto(RoomHere);
global.next_positiony = [Where you want him to start];
global.next_positionx = [Where you want him to start];
}
}
Then, in the creation code of the room, put
Link.x = global.next_positionx;
Link.y = global.next_positiony;
Hope that helped some, if you actually understood it lol, if not, I can create an engine for you.
Discuss.
-
The way that I do it is actually pretty simple.
In the "Outside Room" action for Link, put this code.
(This is an example for going down out of a room)
if room = [whateverroom] {
if [LinkObject.y] > [TheBiggestYCoordinateOnTheMap] {
room_goto(RoomHere);
global.next_positiony = [Where you want him to start];
global.next_positionx = [Where you want him to start];
}
}
Then, in the creation code of the room, put
Link.x = global.next_positionx;
Link.y = global.next_positiony;
Hope that helped some, if you actually understood it lol, if not, I can create an engine for you.
Discuss.
I never thought of doing it thast way, but then again im sure we all ahve our own coding methods and shortcuts, nice one!