It's easier to keep track of instance variables. You create an instance, put variables inside it, go to the other room, get the values back, and delete that instance. At that point you know that the variables are gone from memory. But if you create global variables, they stay in memory for as long as the game is running. It's also about encapsulating data in a proper container (here, the data carrier instance) so that it's easier to manage the transferred data when you have a lot of variables (like, in the tut we only have 2 variables, but what's to say you won't have 100 at some point, and even data structures?).
severely underrated video. I had trouble finding a tutorial that worked much less one that provided a data carrier along with it. Give this dude a like!
Hello, when i go to the second room and then i come back to the first one : "Layer system integrity compromised, instance 100011 not on layer 38" there's no more depth ordering, it's like cancelled, do you know what the problem is?
I got an issue, when trying to move to a room with multiple doors, it always goes to the first door placed in that room instead of the original door, how can I fix?
its been a year so ig youve figured it out but for other people seeing this, simply put the following in the collsision event if keyboard_check_pressed(vk_space) { other.target_enter = target_enter; room_goto(target_room) }
I have a question. So i used this tutorial in a project i am making with some friends that i plan to publish online and potentially make money off of. So considering how i used the tutorial, i am now curious if i even can do that. Obviously if needed i will give credit.
PLS Help me !!!!!! I had a little house icon near my main room when I try to exit the room the scene stops and I am still seeing my main room.HOW I CAN GET RİD OF THIS LİTTLE HOUSE ICON NEAR MY ROOM!!!!
Great tutorial! I had everything working with the rooms and doors but the moment I tried to carry the data over everything went broken on me and crashes every startup. I'm trying everything I can to fix this but I'm only on day two of doing this kind of stuff.
I tried to mix up your camera tutorial with this, and I have a strange problem - when player enters a new room, the view from the camera seems to narrow down about twice from the original size and stops following the player. What the problem could be?
I had a similar problem, on the room start event try checking if the view is enabled or not, and if not, enable it: if !view_enabled { view_visible[0] = true; view_enabled = true; }
You can use this same method that is used for transferring score, and transfer a list of collectibles that exist within a room. Then when you re-enter a room, delete the existing collectibles and recreate those from the list that are registered as existing. Make sure to delete the list when it's no longer needed or you'll get memory leaks.
There is a weird issue with the collision event around 4:31 of this video. I modified the code for my own project so that instead of having a collide event checking for the player, I put an instance_place check into a step event, which kept giving me errors. Anyone have any idea why this might have happened?
heres a uneducated guess: targetEnter on either the player or DataCarrier just doesnt work if its not set by the collide with player event (probably being set various times because its a step event and for some reason it goes back into not being set) addition: i think making so the player checks for the colision rather than the door might do something
I'm a bit late to the party, but instance_place returns an instance ID, rather than place_meeting which returns true or false. If you're checking for a collision, you need to use place_meeting OR something like var getTarget = instance_place(x, y, oDoor); //store instance of oDoor at our coordinates in a variable if getTarget != noone //check to make sure that variable actually has an instance stored { //do code here targetEnter = getTarget.targetEnter; //set player's targetEnter to the instance's targetEnter }
@@anonymone453 Speaking of late to the party, it only took me five months to respond to you! Anyway, your code worked beautifully. Thank you for saving me hours of frustration!
hi great tutorial. When i want to select a ressource for a variable i have "none" (but of course i do have some it just don't show up). Hoy could i fix that ?
This is late, so don't know if you still have this issue, but after you make the variable, and change the type to Asset, click on the little gear icon next to it, and select Rooms from the list that pops up. Hope this is helpful to someone.
how would you do it without the IDE? creating and accessing other rooms via code? if you were randomly generating terrain in each room and then created a 'door' to another room and back again.
You can always create instances and set their variables through code. When you create an Enter instance in a room, you can store its ID which you can then assign to a door in some other room. But, since you are creating rooms at runtime I suggest you figure out some other way to connect your rooms that works perfectly as per your needs. You can discuss this in our Discord server: discord.gg/TykHyqK
now there are just unlimited amount of coins. i don't want that to happen. what can i do now, to make them dissapear after i take them once? pls help, it's for school. nvm i made it work
-hello, when my character goes trough the first door, the game changes to the next room (until this point everything is fine) but my character don't show up anywhere :(
it would not be more useful use global variables to transfer data?
It's easier to keep track of instance variables. You create an instance, put variables inside it, go to the other room, get the values back, and delete that instance. At that point you know that the variables are gone from memory. But if you create global variables, they stay in memory for as long as the game is running. It's also about encapsulating data in a proper container (here, the data carrier instance) so that it's easier to manage the transferred data when you have a lot of variables (like, in the tut we only have 2 variables, but what's to say you won't have 100 at some point, and even data structures?).
severely underrated video. I had trouble finding a tutorial that worked much less one that provided a data carrier along with it. Give this dude a like!
8:43 you're the kind of person you wouldn't expect to make jokes like these and it's awesome when you do it
Some of my doors work, but not others. When I touch the door, it just bounces me back to the same entrance of that door.
targetEnter showing "unset" and "undefined" with players " START event" crashing game.
any help would be appreciated.
Like for "More Doors": D
Братан, ты спас меня этим уроком! Я очень долго не мог решить эту проблему, пока не нашел твое видео! Ты лучший!
Is there something bad about not using odata carrier to carry variables and just making the player persistent?
It won’t let me change the type to resource
GameMaker keeps telling me that obj_player.targetenter isn’t set before reading it. What’s the deal?
I had the same problem and it was cus I misspelled something, if your still care try to fix any spelling issues
Can you make a door that needs a key press to enter? Like "Press E to Enter Room" type of code?
Hello, when i go to the second room and then i come back to the first one : "Layer system integrity compromised, instance 100011 not on layer 38" there's no more depth ordering, it's like cancelled, do you know what the problem is?
I got an issue, when trying to move to a room with multiple doors, it always goes to the first door placed in that room instead of the original door, how can I fix?
For some reason, when I go to add a variable to the door, the "add" button isn't popping up. Any idea to why this is happening???
And the winner of the best voice in a tutorial goes to... YOU! 😃👍
Does the door/enter instance need to be assigned a sprite to work properly?
the target enter stuff just doesn't work for me, says it's not set befor reading
great video, but how can i change the room transition by pressing a button rather than just touching the doors
its been a year so ig youve figured it out but for other people seeing this, simply put the following in the collsision event
if keyboard_check_pressed(vk_space)
{
other.target_enter = target_enter;
room_goto(target_room)
}
Great video, had no idea what I was doing, this helped alot!
I have a question. So i used this tutorial in a project i am making with some friends that i plan to publish online and potentially make money off of. So considering how i used the tutorial, i am now curious if i even can do that. Obviously if needed i will give credit.
When i close the game before enter in one of the doors, the game just crash, how i solve this?
is it possible to make the door only bring you to other room when the player interact with it?
PLS Help me !!!!!!
I had a little house icon near my main room when I try to exit the room the scene stops and I am still seeing my main room.HOW I CAN GET RİD OF THIS LİTTLE HOUSE ICON NEAR MY ROOM!!!!
When im going through my door it take me to the next room but my character is unseen.Can somebody help pls?
is your character object in the next room
Great tutorial! I had everything working with the rooms and doors but the moment I tried to carry the data over everything went broken on me and crashes every startup. I'm trying everything I can to fix this but I'm only on day two of doing this kind of stuff.
Super nice and easy way of solving this problem👍🏻
I tried to mix up your camera tutorial with this, and I have a strange problem - when player enters a new room, the view from the camera seems to narrow down about twice from the original size and stops following the player. What the problem could be?
I had a similar problem, on the room start event try checking if the view is enabled or not, and if not, enable it:
if !view_enabled
{
view_visible[0] = true;
view_enabled = true;
}
i have an object in my room. if i take it and go to the next room, and back, my object will come back, and i don't want that. can you help me please?
You can use this same method that is used for transferring score, and transfer a list of collectibles that exist within a room. Then when you re-enter a room, delete the existing collectibles and recreate those from the list that are registered as existing. Make sure to delete the list when it's no longer needed or you'll get memory leaks.
There is a weird issue with the collision event around 4:31 of this video. I modified the code for my own project so that instead of having a collide event checking for the player, I put an instance_place check into a step event, which kept giving me errors. Anyone have any idea why this might have happened?
heres a uneducated guess: targetEnter on either the player or DataCarrier just doesnt work if its not set by the collide with player event (probably being set various times because its a step event and for some reason it goes back into not being set)
addition: i think making so the player checks for the colision rather than the door might do something
I'm a bit late to the party, but instance_place returns an instance ID, rather than place_meeting which returns true or false. If you're checking for a collision, you need to use place_meeting OR something like
var getTarget = instance_place(x, y, oDoor); //store instance of oDoor at our coordinates in a variable
if getTarget != noone //check to make sure that variable actually has an instance stored
{
//do code here
targetEnter = getTarget.targetEnter; //set player's targetEnter to the instance's targetEnter
}
@@anonymone453 Speaking of late to the party, it only took me five months to respond to you! Anyway, your code worked beautifully. Thank you for saving me hours of frustration!
when i enter the door, the next room loads but the player doesn't spawn.
okay i figured it out but when i close the game without entering any door it crashes saying "variable .targetEnter was not set before reading it"
k i cant have more than 1 door in each place with this system
hi great tutorial. When i want to select a ressource for a variable i have "none" (but of course i do have some it just don't show up). Hoy could i fix that ?
What do you mean? You should be able to select Asset/Resource as a type for your variable and then select an asset in the value column.
This is late, so don't know if you still have this issue, but after you make the variable, and change the type to Asset, click on the little gear icon next to it, and select Rooms from the list that pops up. Hope this is helpful to someone.
2:47 I dont have resourses
They're called Assets now
how would you do it without the IDE? creating and accessing other rooms via code? if you were randomly generating terrain in each room and then created a 'door' to another room and back again.
You can always create instances and set their variables through code. When you create an Enter instance in a room, you can store its ID which you can then assign to a door in some other room. But, since you are creating rooms at runtime I suggest you figure out some other way to connect your rooms that works perfectly as per your needs. You can discuss this in our Discord server: discord.gg/TykHyqK
@@GameMakerStation Thanks fam
thanks!!!!! It worked for me
Thank you for saving my a lot of time !
You deserved to be subscribed my Hindi friend
Actually I'm Punjabi ;) Thank you
Great video!!
thanks a lot!
Thank you very much for this
now there are just unlimited amount of coins. i don't want that to happen. what can i do now, to make them dissapear after i take them once? pls help, it's for school. nvm i made it work
Creating an oDoor object? Sounds smelly
it doesnt work
THE VOICE
-hello, when my character goes trough the first door, the game changes to the next room (until this point everything is fine) but my character don't show up anywhere :(
make sure you check mark "Persistent" in your player object