ZFGC

Resources => Coding => Topic started by: xxbloodlustxx on April 04, 2006, 04:52:04 pm

Title: [Request/Listing] Having trouble with new rooms...
Post 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 :)
Title: Re: Having trouble with new rooms...
Post by: OcarinaBoy on April 04, 2006, 05:16:40 pm
do you mean a room to room engine?, i know that hyrule_boy or deku_stick have one try to ask them
Title: Re: Having trouble with new rooms...
Post by: MaJoRa on April 04, 2006, 05:28:22 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 :)

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.
Title: Re: Having trouble with new rooms...
Post by: xxbloodlustxx on April 04, 2006, 05:52:11 pm
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.
Title: Re: Having trouble with new rooms...
Post by: MaJoRa on April 04, 2006, 05:59:56 pm
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.
Title: Re: Having trouble with new rooms...
Post by: Moon_child on April 04, 2006, 08:18:30 pm
Persistant is really really bad if you use variables it will screw them. Persistant isn't the solution.
Title: Re: Having trouble with new rooms...
Post by: Halu on April 04, 2006, 10:52:01 pm
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)
Code: [Select]
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
Code: [Select]
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.
Title: Re: Having trouble with new rooms...
Post by: MaJoRa on April 05, 2006, 08:35:13 am
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)
Code: [Select]
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
Code: [Select]
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!

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