• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM room change is acting crazy

pixeltroid

Member
I had a working room change system in which upon touching a "door" object I could easily switch rooms and go to a specific area in a specific room. Now, its acting funny.

Its now warping me to a different location....either in the room I was supposed to go to or it sends me to next room. Its really driving me nuts as I can't seem to figure out what's causing this.

Here's what I've done so far:

- I cleared the cache
- I double checked the co-ordinates and room name as set in the door objects creation code
- I made sure that there are no other objects with room change code in the area of the room that I am supposed to enter.

I know it cannot be an issue with my code because it has been working fine for more than a year. This is a problem that has only developed in the last few days

I'm worried about things like project or software corruption. :/

What should I do??? Please advice!
 

Binsk

Member
What have you done in the last few days that relate to room switches, location changes, or door object changes?

Go through the code you've changed and see if you can find something that might have unintended consequences.
 

pixeltroid

Member
What have you done in the last few days that relate to room switches, location changes, or door object changes?

Go through the code you've changed and see if you can find something that might have unintended consequences.
I haven't done anything but use the code as-is. Except change the X,Y coordinates and room name as per my requirements. It's been working fine for more than a year, so I wouldn't dare mess with it.

It's only since yesterday that I started to notice issues and errors.
 
S

spoonsinbunnies

Guest
show us your code,fresh eyes don't usually have the information jumping the creator does when speedreading code that causes us to overlook the same flaw 100 times, I remember when in gamemaker06-08(as in before studios 1, yeah im an old noob) there were corruption problems but I haven't encountered any corruption recently.
 

pixeltroid

Member
@spoonsinbunnies

here are the codes.


obj_roomchange creation code
Code:
new_x = 0;
new_y = 0;
new_room = noone
obj_roomchange creation code in room

Code:
new_room = room_2;
new_x = 48
new_y = 510

obj_hero collision code with obj_roomchange

Code:
if (room_exists(other.new_room)) {
room_goto(other.new_room);
x = other.new_x;
y= other.new_y;
}
I am using this exact same code across 2 projects. It works in one but not the other.
 

TsukaYuriko

☄️
Forum Staff
Moderator
Add a debug message to the collision code that outputs the destination room and coordinates. Is this output consistent with the actual changing of rooms?
If you add a security check to only change rooms if the destination room is the one you want your test door to lead to (can be hard-coded), does the room change still occur? If so, does it still sometimes lead you to the wrong destination?

Just to rule out that this is actually the thing that's changing rooms and that there isn't some entirely unrelated code running that's somehow messing things up...
 
S

spoonsinbunnies

Guest
if by location you mean wrong room and not wrong x/y one thing to consider are you landing on another door(or even close enough that your persistent speed pulls you into it) in the target room so maybe jumping twice?
 

pixeltroid

Member
if by location you mean wrong room and not wrong x/y one thing to consider are you landing on another door(or even close enough that your persistent speed pulls you into it) in the target room so maybe jumping twice?
Nope. I have made sure. The player lands well away any object with code. He is at least 64 pixels away from the door object that leads back to the room I came from.
 
H

Homunculus

Guest
ok. I did it. Its showing the message in the compiler window but its still sending me to the wrong location.
So you are saying that you collide with an instance of obj_roomchange that defines, for example, new_x = 48 and new_y = 510 and you are not seeing those values as result of the show_debug_message call? If not, what values are you seeing? Moreover, do you get just one line as output to the console or multiple ones for a single room change?

Debugging your own code is already difficult enough, debugging someone else's is even worse. Try going into a bit more detail and include code / debug code used when possible, we need this info in order to help you.
 
Last edited by a moderator:
S

spoonsinbunnies

Guest
Im not sure then tbh maybe other is getting confused? I try to avoid it if I can by using something along the lines of this in step
Code:
a=instance_place(x,y,obj_roomchange)
if a!=-4
{
x=a.new_x
y=a.new_y
room_goto(a.new_room)
}
I doubt this will help either, just the equivlant of try the same thing a different way and pray to the rl rng, only other thing I can think is that your character moves before the room change ussually so if theres a two doors in the first room and the second happens to be where the one your going through sets you in room 2, it could be superceeding the first room jump, but otherwise im honestly at a loss.
 

pixeltroid

Member
Update: After spending a long time yesterday trying to fix the problem, I gave up.

I just started a new blank project and imported my player and the room change object and made 2 rooms to see if I still experience the problem upon switching rooms. But it worked normally.

Then I imported all the assets from the previous buggy game and....it just worked normally. I did not change any code. I have no idea why or how the same assets are working in the new game, but it works and I'm not complaining. I guess I'll never find out what the cause of the error in the previous version was.

spoonsinbunnies , Catan , TsukaYuriko and Binsk , thanks for trying to help.
 
Top