• 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!

Room Transition Assistance Need (New to GML)

M

MrTacoSocks

Guest
I tried an online tutorial for transitioning rooms but it doesn't work. I have the code verbatim and it still does not allow the room to change. Any help would be greatly appreciated.
 

Attachments

Last edited by a moderator:

Nocturne

Friendly Tyrant
Forum Staff
Admin
Okay, well, to start with, we'll need a lot more information. WHAT doesn't work? Does it give an error? If so WHAT error? Does it run but not do what it's supposed to? In that case WHAT does it do and what SHOULD it do? Also, which tutorial? And maybe post the entire code instead of screenshots? The images don't really tell us what's going on....
 
D

drowned

Guest
What nocturne said, but also you don't need place_meeting(x,y,obj_player) inside the collision with obj_player event. That is redundant.
 
Just trying to understand the pictures you posted....

In the first picture you have a collision event between the warp and player. But then you check to see if you are at the same location as the player (not needed).

Other than that, we need to see some more code to try and figure out what is going on
 

TsukaYuriko

☄️
Forum Staff
Moderator
First of all, please do not post images of code. Here's why, and much more: How to Q&A

That aside, I spent some time trying to wrap my head around why your user account is named Dicks Pawn... and then some time trying to see what the issue is.

Why is the teleporter object solid?
As mentioned before, why are you checking for collisions in a Collision event?

That aside, I can't see what's going on and when. There's no player code, for example, so no way to check any potential interactions (such as a Collision event with the teleporter in the player object which pushes it outside of the instance thanks to it being solid and never giving the teleporter a chance to fire its own Collision event and triggering the teleport). Please post all relevant code.
 
M

MrTacoSocks

Guest
Code:
/// In Collision event with transfer object
{
room_goto(targetRoom);
objPlayer.x = targetX;
objPlayer.y = targetY;
}

/// In Create event with transfer object
var targetRoom, targetX, targetY;

/// In first transfer object instance creation code

targetRoom = room1;
targetX = 256;
targetY = 288;

// In second transfer object instance creation code

targetRoom = room0;
targetX = 416;
targetY = 512;
First of all, please do not post images of code. Here's why, and much more: How to Q&A

That aside, I spent some time trying to wrap my head around why your user account is named Dicks Pawn... and then some time trying to see what the issue is.

Why is the teleporter object solid?
As mentioned before, why are you checking for collisions in a Collision event?

That aside, I can't see what's going on and when. There's no player code, for example, so no way to check any potential interactions (such as a Collision event with the teleporter in the player object which pushes it outside of the instance thanks to it being solid and never giving the teleporter a chance to fire its own Collision event and triggering the teleport). Please post all relevant code.
Code is posted above. Thanks for the advice.

And the code is for taking the player object to the next room
 
D

drowned

Guest
Take out the "var" in the transfer object's create event and see if that helps
 

TsukaYuriko

☄️
Forum Staff
Moderator
var being there or not will not cause or solve the problem in question, but it should indeed not be there. I suggest reading up on the var statement and its correct usage here (local variables section): https://docs2.yoyogames.com/source/_build/3_scripting/3_gml_overview/6_scope.html

The following remains to be addressed:
Why is the teleporter object solid?

...

There's no player code, for example, so no way to check any potential interactions (such as a Collision event with the teleporter in the player object which pushes it outside of the instance thanks to it being solid and never giving the teleporter a chance to fire its own Collision event and triggering the teleport). Please post all relevant code.
 
Last edited:
D

drowned

Guest
var being there or not will not cause or solve the problem in question,
You sure about that? If you declare a variable with 'var' in a create event, you do not have access to it in the step event.

Edit: I don't know why I let you people post incorrect things and then second guess myself over it just because you speak in absolutes or because your profile is a different color than mine. I am sure that it's the cause of your error, or at least one of the causes. Take out the 'var' in your create event.
 
Last edited by a moderator:

TsukaYuriko

☄️
Forum Staff
Moderator
Edit: I don't know why I let you people post incorrect things and then second guess myself over it just because you speak in absolutes or because your profile is a different color than mine. I am sure that it's the cause of your error, or at least one of the causes. Take out the 'var' in your create event.
I don't know why you're getting so defensive all of a sudden, or why you feel addressed by my post (it was directed at the topic creator - maybe I should have been more explicit about this). There's no reason for anything of the sort.

Keep in mind that everyone here is only replying to topics with the intention of helping others - that includes helping members who are trying to help in the form of correcting them - and any member of this community is free to do so. There is nothing to "win" for posting a correct solution, so you shouldn't treat it like a competition.

Help with the intention of helping, not with the intention of being right.

You sure about that? If you declare a variable with 'var' in a create event, you do not have access to it in the step event.
While that is correct, yes, I'm sure that's not the source of the issue, because the same variables are declared in the instance creation code in instance scope.
 
Wow, this got heated super fast. Not really sure what the issue is MrTacoSocks but I made a quick little video on how you can set it all up to do what you are trying to achieve.

 
M

MrTacoSocks

Guest
Wow, this got heated super fast. Not really sure what the issue is MrTacoSocks but I made a quick little video on how you can set it all up to do what you are trying to achieve.

Thank you so much man, this helped a ton. Thanks to everyone who responded as well.
 
Top