Connecting Rooms Through Doors (Tutorial for GameMaker Studio 2)

Поділитися
Вставка
  • Опубліковано 6 жов 2024

КОМЕНТАРІ • 73

  • @pedroantonio743
    @pedroantonio743 4 роки тому +10

    it would not be more useful use global variables to transfer data?

    • @GameMakerStation
      @GameMakerStation  4 роки тому +12

      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?).

  • @ma_astro
    @ma_astro 6 місяців тому +1

    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!

  • @charKT-7461
    @charKT-7461 4 роки тому +2

    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

  • @-Russian_Knight
    @-Russian_Knight 11 місяців тому +1

    Братан, ты спас меня этим уроком! Я очень долго не мог решить эту проблему, пока не нашел твое видео! Ты лучший!

  • @pfergusovegas
    @pfergusovegas 4 роки тому +5

    And the winner of the best voice in a tutorial goes to... YOU! 😃👍

  • @ZeraNightcore
    @ZeraNightcore 4 роки тому

    Super nice and easy way of solving this problem👍🏻

  • @michaelox-long3268
    @michaelox-long3268 Рік тому

    Great video, had no idea what I was doing, this helped alot!

  • @kingroosta
    @kingroosta Рік тому +1

    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.

  • @antonim8714
    @antonim8714 4 роки тому +9

    Like for "More Doors": D

  • @chumorgan443
    @chumorgan443 10 місяців тому +1

    targetEnter showing "unset" and "undefined" with players " START event" crashing game.
    any help would be appreciated.

  • @Deko304
    @Deko304 2 роки тому +2

    It won’t let me change the type to resource

  • @Mr_Pedro_Sombrero
    @Mr_Pedro_Sombrero Рік тому +2

    GameMaker keeps telling me that obj_player.targetenter isn’t set before reading it. What’s the deal?

    • @jacegameing6313
      @jacegameing6313 5 місяців тому +1

      I had the same problem and it was cus I misspelled something, if your still care try to fix any spelling issues

  • @Tom-fw2ls
    @Tom-fw2ls 3 роки тому +2

    Is there something bad about not using odata carrier to carry variables and just making the player persistent?

  • @nasser_404
    @nasser_404 4 роки тому

    Thank you for saving my a lot of time !

  • @me-me_IT
    @me-me_IT 9 місяців тому

    thanks!!!!! It worked for me

  • @wojak-sensei6424
    @wojak-sensei6424 5 місяців тому

    Can you make a door that needs a key press to enter? Like "Press E to Enter Room" type of code?

  • @Doinkk
    @Doinkk 4 роки тому

    Thank you very much for this

  • @oucquan2436
    @oucquan2436 2 роки тому +1

    great video, but how can i change the room transition by pressing a button rather than just touching the doors

    • @unlisted_games2752
      @unlisted_games2752 10 місяців тому

      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)
      }

  • @CalvinLol777
    @CalvinLol777 7 місяців тому

    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???

  • @samcook6250
    @samcook6250 4 роки тому

    Great video!!

  • @HardLyricProductions
    @HardLyricProductions 3 роки тому

    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.

  • @mateusz4140
    @mateusz4140 3 роки тому

    You deserved to be subscribed my Hindi friend

  • @SouryaLeFunentoi
    @SouryaLeFunentoi 4 роки тому +1

    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?

  • @terrarium2934
    @terrarium2934 2 роки тому

    thanks a lot!

  • @OctoLink-qs3kg
    @OctoLink-qs3kg 2 роки тому

    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.

  • @unlisted_games2752
    @unlisted_games2752 10 місяців тому

    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?

  • @harryricardo8215
    @harryricardo8215 3 роки тому

    is it possible to make the door only bring you to other room when the player interact with it?

  • @xa447
    @xa447 2 роки тому

    the target enter stuff just doesn't work for me, says it's not set befor reading

  • @ArmadiusC
    @ArmadiusC 4 роки тому

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

  • @WhiteIALK
    @WhiteIALK 3 роки тому

    When i close the game before enter in one of the doors, the game just crash, how i solve this?

  • @mcgoombs
    @mcgoombs Рік тому

    Does the door/enter instance need to be assigned a sprite to work properly?

  • @uzairnaufal7987
    @uzairnaufal7987 3 роки тому +1

    When im going through my door it take me to the next room but my character is unseen.Can somebody help pls?

  • @phaseluv
    @phaseluv 2 місяці тому

    when i enter the door, the next room loads but the player doesn't spawn.

    • @phaseluv
      @phaseluv 2 місяці тому

      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"

    • @phaseluv
      @phaseluv 2 місяці тому

      k i cant have more than 1 door in each place with this system

  • @emilkummerfeldt9836
    @emilkummerfeldt9836 3 роки тому

    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?

    • @GameMakerStation
      @GameMakerStation  3 роки тому

      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.

  • @corrdox
    @corrdox Рік тому

    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?

    • @Ekpap
      @Ekpap Рік тому

      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;
      }

  • @owlzel8214
    @owlzel8214 3 роки тому

    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 ?

    • @GameMakerStation
      @GameMakerStation  3 роки тому +1

      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.

    • @happy_havok
      @happy_havok 3 роки тому

      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.

  • @cjtodd6244
    @cjtodd6244 3 роки тому +3

    Creating an oDoor object? Sounds smelly

  • @rilysisumo9422
    @rilysisumo9422 4 роки тому

    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.

    • @GameMakerStation
      @GameMakerStation  4 роки тому +1

      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

    • @rilysisumo9422
      @rilysisumo9422 4 роки тому

      @@GameMakerStation Thanks fam

  • @emilkummerfeldt9836
    @emilkummerfeldt9836 3 роки тому

    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

  • @76avram
    @76avram 2 роки тому

    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?

    • @SpringDavid
      @SpringDavid Рік тому +1

      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

    • @anonymone453
      @anonymone453 7 місяців тому

      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
      }

    • @76avram
      @76avram 2 місяці тому

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

  • @easiecat
    @easiecat 3 роки тому

    2:47 I dont have resourses

  • @nst_presents243
    @nst_presents243 Рік тому

    it doesnt work

  • @lebronsthirdson
    @lebronsthirdson 4 роки тому +1

    THE VOICE

  • @loquendero-vi5sp
    @loquendero-vi5sp Рік тому

    -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 :(

    • @peterd677
      @peterd677 8 місяців тому

      make sure you check mark "Persistent" in your player object