How to Change Scenes Smoothly in Godot 4

Поділитися
Вставка
  • Опубліковано 21 кві 2023
  • In this video we are going to go over how to change scenes smoothly step by step, being able to change scenes is really important in any game you create, so I though it would be nice to create a tutorial so I can teach others how to change scenes in godot!
    Download Free art pack: game-endeavor.itch.io/mystic-...
    make sure to download the free as that is all we will need for this series.
    Link RPG Godot 4 series playlist: • How to Make an RPG in ...
    ----------------------------------------------------------------------------------------------------------------------------------------
    Thank you so much for watching I really hope this video helped.
    if you did enjoy then please go and click that subscribe button to help out the channel. I means so much and I love your feedback in the comments to let me know what it is that you enjoyed. Again thanks so much and I would love to see you again!
    have a great rest of you day and of course be safe :)
    - thanks DevWorm,
    ----------------------------------------------------------------------------------------------------------------------------------------

КОМЕНТАРІ • 209

  • @dev-worm
    @dev-worm  Рік тому +6

    link to the full series: ua-cam.com/play/PL3cGrGHvkwn0zoGLoGorwvGj6dHCjLaGd.html

  • @47gal47
    @47gal47 8 місяців тому +34

    Great guides! keep up the good work.
    One SUPER importent thing though that can save a lot of people from throwing their original "world" scene to the trash is to save the tileset locally BEFORE copying the tilemap between the scene.
    This solves the issue of tilesets jumping between scenes, thus removing the tilesets from the original scene.
    To save the tileset: inspector tab -> right click on tileset -> save

    • @dev-worm
      @dev-worm  8 місяців тому +4

      very good point. Thanks!

    • @snouzypasta4466
      @snouzypasta4466 8 місяців тому +1

      Thank you so much you saved me lol

    • @sl5945
      @sl5945 3 місяці тому +1

      Yep, I went to copy my tileset from the world map as he did in the video when he sped up and it deleted my main world stuff and I couldn't get it back, oh well made it far enough in the tutorial, don't feel like redoing that lol

    • @sweetpeach1138
      @sweetpeach1138 2 місяці тому +1

      Thanks, this saved me!

  • @spwngg6407
    @spwngg6407 Рік тому +11

    Loving this bro! Keep it up! Doing amazing things for the Godot Community!

  • @keithestanol3771
    @keithestanol3771 8 місяців тому +9

    It took me a week to figure out what was going on with this particular tutorial. Scene changes are HARD, man. But there were several things in my way: godot 4.12 freezes on my system when a project 5.56mb in size is displayed on a 4k resolution screen. Who knows why. And then there were errors in my code, errors in the placement of tilemaps, errors in the placement of colliders. Just all sorts of stuff. Just got to the end of this tutorial and everything works! Thank you! Now on the tutorial #8!

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

    Keep these coming, top tier!

  • @vinbinssbm12
    @vinbinssbm12 Рік тому +3

    Great tutorials bro, subscribed to your last video waiting on this one! Waiting on the next one too! much love bro

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

    Thankyou for your uploadddss!!!

  • @BruceWayneReal
    @BruceWayneReal 6 місяців тому +18

    So I was having issues transitioning between scenes because when it went to the new scene it would run the _body_exited_ code just before running the finish_changing_scenes code so it would never actually change the current_scene to "cliff_side". I was eventually able to find a fix to this by simply removing the _body_exited_ code. Now it works perfectly.

    • @user-ql4zs5mp1y
      @user-ql4zs5mp1y 5 місяців тому

      This saved me. Thanks.

    • @hyu1791
      @hyu1791 5 місяців тому +3

      Thanks man. I encountered the same issue and have to use a similar workaround. But this issue is kinda weird I don't understand why the body_exited is triggered immediately

    • @pogolaugh
      @pogolaugh 4 місяці тому +1

      Saved me 3, TY!

    • @syptocrypto
      @syptocrypto 4 місяці тому +1

      it is triggered immediatly because you exit the area (world) on transition form world to cliff

    • @wiwita63
      @wiwita63 2 місяці тому +1

      thanks, i was having the same issue and it was causing my camera to not change when returning to world.tscn, I deleted the body_exit function in both world and cliff_side scripts and now it works perfectly.

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

    Love your video!!

  • @crocherapia_
    @crocherapia_ Місяць тому

    Another great tutorial, keep it up, @DevWorm! I have spent a little time adjusting some errors in my follow up project, but everything works now 😃 Thank you so much to share your Godot knowledge with us 😍

    • @dev-worm
      @dev-worm  Місяць тому +1

      i appreciate it!! thank you it means so much!! goodluck with all future game dev adventures!

  • @CodingQuests
    @CodingQuests Рік тому +15

    hey, Im really happy to see another fellow tutorial youtuber pooping up in my feed more! If i could give a quick tip on thumbnails tho, I would suggest moving the text to any other corner, mainly bcuz on youtube, the time tag of a video is always slapped on the bottom right so it makes a bit harder to read what the full thumbnail says. otherwise keep up the great work man!

    • @camash125
      @camash125 11 місяців тому +3

      This, is what they would call perfect constructive criticism.

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

      Pooping, lol

    • @Rai2M
      @Rai2M 3 місяці тому +1

      "fellow tutorial youtuber pooping up in my feed"
      indeed 😂

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

    Thanks for the tutorials bro keep it up!

    • @dev-worm
      @dev-worm  Рік тому

      thanks brother, many more to come soon

  • @daviddreglea
    @daviddreglea Рік тому +3

    best tutorials bro 👌

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

    This series is awesome!

    • @dev-worm
      @dev-worm  Рік тому +1

      so glad to hear that bro

  • @shadowflame3620
    @shadowflame3620 Рік тому +9

    I didn't have to do the camera code and all that, cuz I just made another camera in the other scene, and then made it the child of the player in that scene.

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

      You can also change the camera's limits through the script, it's much easier if you have a lot of scenes

  • @peterzinn2058
    @peterzinn2058 9 місяців тому +10

    The content in this series has be really helpful, but this is the first video of yours that I've had to rewatch three or four times in order to successfully decipher the correct path to the end as you stumble. Your methods feel good, but it's hard to get down to them. I'd highly recommend some more editing or scripting if you can make some time for it.

  • @Dracossaint
    @Dracossaint 21 день тому

    I'm still going boss, i plan to keep going on and on. I thank you for your encouragement :)

    • @dev-worm
      @dev-worm  19 днів тому

      goodjob bro! I am so proud of you! keep going and if you ever need anything just let me know!

  • @krew1230
    @krew1230 8 місяців тому +4

    Hi amazing tutorial! I was wandering if you would do one on how to make multiple scenes because I’m having trouble figuring it out? Thank you so much for this series it’s helped so much.

    • @catastrophe15
      @catastrophe15 5 місяців тому

      Yeah I'm wondering about this too. Thoughts?

  • @yeti25934
    @yeti25934 6 місяців тому +4

    I was wondering, is there any reason why you're not calling change_scene() inside of the _on_cliffside_transition_body_entered method rather than the _process method?

  • @Draconicgames207
    @Draconicgames207 3 місяці тому +3

    My scene won’t change back to the first scene of my code. I checked my code and it looks identical to his. Does anyone have any advice?

    • @undergroundgaming7053
      @undergroundgaming7053 2 місяці тому +2

      re3move the exit signals from both, your not getting through the finishing changing scenes function.

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

    Now the game works that we can only be on start position OR if we are not here we are on the cliffside exit (it is what else says in the world script). What if we wanted multiple scenes? What about multiple enemies? When we duplicate current enemy weird things happen like the second slime is running away from me. I hope this tutorial will teach that in the future and will be legitimate start to making a RPG game by just filling the game with context. This is my impression but don't get me wrong - your tutorial series is still the best I ever watched on Godot 4! That is because when I follow all your steps 1:1 I can't go wrong. Other skip a lot or pre-assume the learner has some knowledge while some of us start from real zero. Thank you from the heart for making this series, I can't wait for more and more episodes.

    • @dev-worm
      @dev-worm  Рік тому +1

      the multiplying enemy's should be fine. just tested it on mine with no issue... and the scenes work too just have to create a couple extra variables to have multiple scenes and improve the ready func in world. thanks you, my goal is to teach everything 100% step by step so Im glad you can see that, many more tutorials coming soon and I will implement your feedback to make them better.

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

      @@dev-worm I think I don't even know how to copy properly (which nodes do get copied and so on). I also noticed that player has set the amount of damage he is receiving and so does enemy. Shouldn't it be the other way around? Player's code say how much damage does he does and enemy's code says how much damage does he do. That would allow to create new enemy with his own damage value rather than everyone doing the same damage to a player.

    • @Daniel.LeePhotography
      @Daniel.LeePhotography Рік тому +1

      ​@@dev-wormwhat are the extra ready functions we have to create?

    • @joshua.h
      @joshua.h 9 місяців тому +2

      THANK YOU! I'm watching this tutorial because I am completely new to Godot and want to watch some tutorials to get a handle of how it works, but this code is such a mess and is full of flaws. As is, there is no way to do anything more with this code without the game becoming a mess of spaghetti code. A great example of this is how the enemy attacking the player is handled in the players script. This is a terrible way of doing things as it makes multiple enemies not be able to attack at once. All stuff pertaining to the enemy should be in the enemy script! Another thing is having the cameras in the player. If you had 100 scenes for a full sized RPG, you would nee to have 100 cameras in the player which is totally unfeasable. A better way to do this would be to put the camera in the scene so each scene has one camera. My plan is to follow this tutorial to the end so I get the concepts, and then completely revamp the code to make it work in a useful way.

    • @FiggsNeughton
      @FiggsNeughton Місяць тому +1

      @@joshua.h All good points!

  • @HomingAsatoMass
    @HomingAsatoMass 7 місяців тому +2

    Is there a reason you call the change_scene function in your process loop instead of just directly in the trigger function?

  • @misamisoART
    @misamisoART Рік тому +6

    Thanks for the awesome video! It feels awesome getting back into Godot, and I'm loving the new changes!
    Question: When exiting the cliff_side and entering back into the world, I notice a bit of stuttering/jumping. Is there a way to make it look a bit smoother? Cheers!

    • @dev-worm
      @dev-worm  Рік тому +4

      thanks bro, so normally in games they have a fade animation with they switch scenes, that is to cover up that stutter, so the only way to get rid of it is to cover it up with a fade animation

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

    Great video. I just have a small issue. When I set my limit for the cliffside camera and try to use it for the cliffside map, it just freezes in place and doesn't move. Any solutions?

  • @embers89
    @embers89 5 місяців тому +3

    could you explain better Y Sort please, in the new version 4.2.1 it does not act in the same way as in the video, thank you very much!

  • @RealObservr
    @RealObservr Місяць тому +1

    Great video! But I want to ask help on something because I've been having trouble figuring out how to transition between scenes in a room with multiple doors/exits, and while I've read through a few of the comments in this comment section, and seen you answering a few of them, I am still a bit confused on how to go about transitioning between multiple scenes.
    So, I'd be really greatful if you could give me some advice or/and tips on how to go about transitioning between multiple scenes, or redirecting me to a youtube video or another source that'd lead me in the correct direction because every video I've found, be they be your's or other's, don't talk about how to transition between multiple scenes.
    And, while teaching the basics might be enough for most people to understand how to do things by themselves, I happen to be a smooth brain!
    So, like what I said, I'd really be great if you helped me but, of course, you don't have to.
    Keep up the good work, because your videos are really easy to understand for a begginner like me, and I honestly don't know what I'd have done without your content!

  • @flamingsteve5883
    @flamingsteve5883 6 місяців тому +4

    i followed you step by step and my tileset became corrupted, so uh fuck me i guess

    • @1tsKayne
      @1tsKayne 4 місяці тому +1

      same happened to me. Had to repaint the world. Then I did make sure that I save the whole Tileset as a Scene, so I cant delete it by accident

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

    I have a few questions about this method. First, we have to do this for every single level we have in the game, which can be very time qonsuming, is there a better/faster way?
    Also, important, our player is not "summoned" in the levels, we have to manualy put the player in each scene and this code just changes the positions. Wouldnt this cause problems with the players data? For example, if he has an inventory system and he got an item or a piece of information (for example a code for a puzzle) from the previous scene,wouldnt us manually putting 'players' in all scenes mess with that?

    • @dieudesmicro-ondes
      @dieudesmicro-ondes Рік тому

      Personally, I changed a few things to allow multiples doors in a scene. Each scene has now a 'roomTransitionning' variable, which is changed in the area2d node connection (body_entered / body-exited) for each door with the name of the room you want to go. In the change_scene method, the path is now dynamically set depending on this variable. I'm currently working on the position system, but the system I described works for me

  • @pogolaugh
    @pogolaugh 4 місяці тому +2

    @dev-worm Love your videos. Maybe you have already improved on this but I recommend editing out mistakes on your part. Especially when if someone is following along they will have to redo things.

    • @dev-worm
      @dev-worm  4 місяці тому +1

      yes i have worked on that!! sorry about that in the older videos!! i apologize!

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

    Hey bro! Quick question, I got the transitions working, but whenever I got from cliffside to world, the camera in my "world" no longer follows the player, any idea what could be going on?

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

    When I call current_camera() under func_physics_process(delta): - the camera won't follow me. However, if I don't call current_camera() it works fine? Not sure I understand what's happening here.

  • @digitalruslan750
    @digitalruslan750 7 місяців тому +3

    Hello! It doesn't tell me about the presence of errors in the scripts, but it doesn't transfer the player to the scene I need. What could be the problem?
    The problem is similar to 16:48 but I didn't forget to call the change_scene() function

    • @goncalosousa7865
      @goncalosousa7865 6 місяців тому +3

      i got the same error, and yet i did everything :,)

  • @NickersonGeneral
    @NickersonGeneral 11 місяців тому +2

    Hey bud! Thanks for the video! Super helpful! Got a question. Suppose I want my character to be facing a different direction once he enters a scene (like for example, if he enters from the bottom of the scene, I'd want him facing north, and not the default south).
    I created a vector2 variable in my player script called "starting position" which controls the direction he's facing at the beginning of the scene, and for some reason, $Player can't seem to access that. Do I need to use a different method to get that variable?

    • @NickersonGeneral
      @NickersonGeneral 11 місяців тому

      Nevermind. Figured it out. Just modified the variable in the player script with the _ready func.

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

      please tell me how you did it, thank you@@NickersonGeneral

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

    Great vid again! I just want to ask if there is an option for e.g. in the global script to change cameras, just like the scenes and not in the player? Theoretically, global script can find out the scene on the screen so, it could be change to the camera which binded to the scene too, with a simple embedded if or stg..., right?

    • @dev-worm
      @dev-worm  Рік тому +1

      yes that would be the idle way to go about it to keep the code clean, glad you spotted that I should have done that

  • @colefitzgerald8467
    @colefitzgerald8467 Місяць тому +1

    I want to have a game with lots of rooms without lots of scenes destroying my organization. How would I make that?

  • @cicicimolcimol
    @cicicimolcimol Місяць тому

    hey thank you for the tutorials, i manage to get through everything and im trying to expand the world more. i want to ask if u have a lot of scene, how do call ur character position on every scene transition, like in this tutorial u have if Global.game_fist_loading == true and else. what if i want to call my player back to the world scene but above the cliff without loosing the position/variable before? how do i call my variable? and one more time thank you so much, u are such a great person!

    • @dev-worm
      @dev-worm  Місяць тому

      you would have to keep a global variable.. that is keeping track of what scene the player is in (so maybe you can change that variable in the ready function of the new scene) - (you'd also have to keep a global variable of all the starting positions for the main scene). Then once you have all those variables.. set up the main scene to check to see what that current scene variable is and match it to its corresponding position variable!! hope that is able to help with having many scenes a little bit

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

    When i copy + paste map it crashes from 1st scene, why?

  • @ashishg.chhetri1938
    @ashishg.chhetri1938 Місяць тому

    My player can only enter and exit cliffside once, when i try to do it again nothing happens and the player goes out of bounds. Any solution?

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

    CollisionPolygon2D don't have any "Split nodes" function?
    If you place 40 nodes, you can't even undo ?
    Something wrong there for sure..

  • @FourLionsClips
    @FourLionsClips 9 місяців тому +1

    i accidently deleted everything the world kept changing into an area2d and now i cant get my files back

  • @Daniel.LeePhotography
    @Daniel.LeePhotography Рік тому +1

    absolute loving your work. im learning so much from you. just curious how would you adapt the scripts if you had more then one scene or level?

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

    Good video! Can you make a change on the enemy speed however? I want them to move a set speed not fast when they are away and slow when they are near. Just one speed for everything. Thanks alot!

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

      yeah, replace the enemies movement script with:
      rot = position.angle_to_point(player.position) # this gets an rotation value (in radiants) towards the players position
      dir = dir.from_angle(rot) # this rotates the dir Vector2 towards the player with the rot value
      position += dir # offsets the enemies position towards the player

    • @camash125
      @camash125 11 місяців тому

      @@Nesisorator legend

    • @joshua.h
      @joshua.h 9 місяців тому

      For my enemy movement (with the animation stuff) I did this:
      if player_chase and position.distance_to(player.position) >= 15:
      position = position.move_toward(player.position, speed)

      $AnimatedSprite2D.play("walk")

      if(player.position.x - position.x) < 0:
      $AnimatedSprite2D.flip_h = true
      else:
      $AnimatedSprite2D.flip_h = false

      else:
      $AnimatedSprite2D.play("idle")

      move_and_slide()
      This not only moved the enemy towards the player at a constant rate, but also made it stop just in front of the player so it doesn't push them. The move_and_slide also allows the enemy to interact with the environment just like the player so it doesn't phase through objects.

  • @panpan6014
    @panpan6014 21 день тому +1

    Hey everyone, as many, impossible for me to came back from cliffside... like there was no collisionbox ... I tried tot remove the exit body connection ... but still not working ... a bit of help ... it drive me mad !

  • @breme7726
    @breme7726 Рік тому +4

    Perfect tutorial for scenechanging in godot 4, but i have one problem with this. If you kill let's say 3 enemies in the main scene and then go to the cliffside and back again, then these 3 enemies are still there. how can you change this so that the 3 enemies you killed no longer exist in the main scene???

    • @dev-worm
      @dev-worm  Рік тому +2

      that is cause the enemys are just instances of the world scene to fix that you would need to work with a separate global script between the enemy and world scene or you could try and make the enemy a singleton but im not 100% if that still works in godot 4.

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

      @@dev-worm could you maybe try to fix this in a future episode or make a seperate video im really curious how this works

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

      Every scene initiates upon entry. All items in the scene are initiated as well. This includes everything, the Tilemap, the slimes, the player, all things are instantiated upon entry.
      The only way to keep track of what has happened in each scene when you leave and come back is to save all positions, all status included things like health, and who has died etc.
      As an example, you saw in the cliifside scene there was a player in there. There is also a player in the world scene. If the player in the world scene takes damage from the slime, when you go to the cliffside scene that player has full health because it is not the same player, it is a different player instantiated in the cliffside scene. When you go back to the world scene from the cliffside scene the player there is also instantiated again and that player will also be at full health.
      All information must be saved from scene to scene and then loaded into the character, or the monsters. In the tutorial you noticed how he was using global variables to place the player in a certain position. You are able to use the globals or singletons from scene to scene without change. However, if you have 20 slimes in a level and you want to keep track of all of them that can become cumbersome, and might weigh on the speed of your game.
      I watched another video about scene transition. They pass the variables another way but it is still not dynamic.
      My wife plays Stardew Valley and I watched what they do. When you go into a different scene everything is randomly spawned, rocks, monsters, everything except the level map, that looks the same. But, there are some levels that have special items that only spawn once, and that information has to be stored somewhere.
      I am looking into using JSON files save to disk when leaving a scene and then loading everything when you arrive in the new scene.
      Valheim is a perfect example of saving world data. If you have ever played Valheim you noticed that about every fifteen minutes or so you get a "World Save" warning and then about ten seconds later the game freezes for about 5 seconds while they take all of the world data and dump it to disk. Valheim is the epitome of a dynamic world, and they are always saving and reloading information.

  • @kestrel77
    @kestrel77 3 місяці тому

    Why do you not just change the scene on the body entered function?

  • @user-ep5vv8yd8l
    @user-ep5vv8yd8l 2 місяці тому

    Hello,
    I would like to know what I do when I have 2 doors in a room. In this case, each door takes you to a different place. Therefore, when the character enters through door 1, he must be on the side of door 1, and when he enters through door 2, he must be on the side of door 2. I don't know if it's very clear lol.
    Could you help me with this?

    • @dev-worm
      @dev-worm  2 місяці тому

      you'd have to save the position of where you want the player to spawn for each door. then when the player walk through a door remember what door the player walked through in a global script. so when the player walks back into the main you can use that information to handle where to place the player based on what door number was saved.

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

    are you going to make a 3d game series sometime in the future???

    • @dev-worm
      @dev-worm  Рік тому +2

      I am currently playing around with 3d so maybe!

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

    Anyone else's camera do a quick snap into place, maybe only lasts 1 frame between the cliffside and world scenes? I am going to go back through the last 2 episodes to make sure I do things the same way, then will look to solve with a fade-in or maybe something like that to mask it, but just wanted to see if this happened to anyone else first.

    • @dev-worm
      @dev-worm  Рік тому

      adding a fade is probably best just to cover it up

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

    hi, and congratulations for your series of tutorials on rpgs. I followed the scene change carefully, it worked perfectly. but I tried to put a new scene change from my main scene, I copied the code that you did for the cliffside scene. however this does not work. how should I be able to have several scene changes from my world scene? THANKS

    • @kristianlavigne8270
      @kristianlavigne8270 6 місяців тому

      His code design is not scalable. Reminds me of coding BASIC back in the 80s using only global variables... terrible

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

    I am getting an error "Identifier "global" not declared in the current scope. Can't seem to find the cause. Any help would be appreciated. Thanks

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

      capital G should fix this

    • @pogolaugh
      @pogolaugh 4 місяці тому

      @@jui6y THANK YOU!!! I hate how one letter being capital or not can mess up an entire function in your game. This time you saved me a lot of time figuring it out.

  • @yohannaje
    @yohannaje 28 днів тому

    man i really wish you hadnt sped-run the cliff scene and camera setting process. For a reason my player never showed up on the second scene, and trying to grasp what you had done i saw you used the original tilemap, tried to copy it from my world scene, and somehow it got bugged and lost all the original design from the world scene. So many hours of my day lost. Anyway, I still cant make my player show up on the cliff scene and I dont know how to debug it either, the scene loads but just the player is not showing. Any thoughts? Also it'd be great if you uploaded the project somewhere, some lines already dont work on Godot 4.2 is kinda hectic trying to learn like this :(

    • @forteforay3346
      @forteforay3346 15 днів тому

      you need to link the player into the scene. Otherwise, the scene will run without the player character. The link button is located at the top left (next to the plus button). Hope this helps.

  • @xaber2612
    @xaber2612 Місяць тому

    everything was working fine until I copy and pasted the tilemap of world to cliff_side, the tilemap in world went blank with caution symbols and for some reason the global parts of the player weren't working. any idea what happened?

    • @dev-worm
      @dev-worm  Місяць тому +1

      new error that is going around Godot! I believe if you close your project and reload it then it resolves it

  • @cydeYT
    @cydeYT 28 днів тому

    This is not working properly for me, whenever I change scenes it doesn't bring the camera with it or the player.

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

    its good 💜💜💜but what if my change scene big? I mean back to same positions looks bad when I have a huge gate or door.... 🤔

  • @y_4665
    @y_4665 6 місяців тому

    i followed your tutorial but my scens are not changing

  • @gruffmadness
    @gruffmadness 17 днів тому

    I copied this got into my first game, but I must be doing something wrong. the Collision shape just doesn't seem to trigger the transition. Code looks fairly identical. No errors... so something isn't potentially named right maybe?

    • @gruffmadness
      @gruffmadness 17 днів тому

      Ah.. I had the player on a different layer

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

    had difficulty with the transition between scenes. I ended up doing what some people had to do in the comments. This tutorial gave me visual issues. But fortunately, I never experienced Errors. I'll take visual issues over Errors any day 👍

    • @dev-worm
      @dev-worm  2 місяці тому +1

      glad you were able to get pass the problem!! hope the rest of the series proves to be helpful!

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

      @@dev-worm thankfully, I was able to finish the entire Playlist.
      Unfortunately, the Survival Game episode 1 is already messing up with the walking part. The code is not really being accepted by Godot 4.2

  • @jui6y
    @jui6y 5 місяців тому +3

    Hi great series! Thank you. Quick question : changing scenes from world to cliff side works , but I cant figure out how to go from cliff side back to world... Its like the collision rectangle is not working or something. Need help please

    • @embers89
      @embers89 5 місяців тому

      i got the same issue :( , you find the solution?

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

      @@embers89 remove the body_exited code from the world and cliff_side scripts.

    • @anitasaleki8312
      @anitasaleki8312 4 місяці тому

      @@syptocrypto thank you

    • @1tsKayne
      @1tsKayne 4 місяці тому

      solution anyone : (@@anitasaleki8312

    • @CHR1SMOV1ES
      @CHR1SMOV1ES 4 місяці тому

      Thank you so much! Could you explain why it works? I do not really understand why it works, when I remove it.@@syptocrypto

  • @cydeYT
    @cydeYT 28 днів тому

    Yep it does not switch cameras when siwtching worlds.

  • @AterKenshi
    @AterKenshi 9 місяців тому +2

    Copying and pasting the tilemap in a different scene screwed my world map :C

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

      So I figured this out.
      You have to save the tileset in the inspector while selecting the tileset.
      There's a 3 dot menu there.
      When used somewhere else, before editing, click the same 3 dot menu and click make unique.

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

    "This shouldn't do anything, but we'll add it in case it does" yeah, I hear that.

    • @dev-worm
      @dev-worm  2 місяці тому

      better safe then in a pool of errors lol

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

    Hi, I'm having a problem.
    I'm trying to make a game where you can enter a cave and I used the code you used in the video, but when I exit the cave, my camera starts at it's starting position when I start the game and then quickly moves to the player's position.
    I tried adding new variables to the global script that would represent the position of the camera and added them into the _ready(): function in the world script in the same manner the character's position was handled like in 19:38, but it didn't work.
    Would you please help me figure out the solution to this problem?

    • @dev-worm
      @dev-worm  2 місяці тому

      hmm it must be the way it is set up but then again this is super common if the camera isnt directly attached to the player. Most games do a little fade animation or something so that it covers up the little glitch in the camera. I would recommend adding the camera to the players scene directly. But what you tried with the players postion should work as long as you set the cameras postion to match that of the players after you set the players postion variable.

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

      @@dev-worm Thank you for the reply, I think I’ll try adding a transition animation for now.

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

      @@dev-worm I encountered another problem. I enabled the Y sort settings of the tilesets, character, and world in my game and everything seemed to work well except for when I move upward, I eventually disappear.
      My guess is that because I enabled the world node’s Y sort, when my character’s Y position is less than the world node’s Y position, my character goes behind the background node because it’s a child of the world node.
      So I thought disabling the world node’s Y sort would do the trick but then the Y sorting of the objects in my game (characters and tilesets) didn’t work anymore.
      So whether I disable or enable the Y sort of the world node it causes problems.
      I wonder if my setup has anything to do with it?
      What do you think will solve this issue?

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

    man i can't work this one out, can't get the player to transition scenes, itll activate and send me text showing me the lines are going through but the character never transitions, able to just walk in and out of the transition zone.
    tried tweaking it, started from scratch and refollowed twice now, still same issue, i have no clue where im going wrong XD

    • @agasimkhitaryan8585
      @agasimkhitaryan8585 9 місяців тому +2

      I think he missed a detail. You need to add the player scene to the cliff_side scene, by clicking "Instantiate child scene" above the cliff_side top node, next to plus sign "Add child node"

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

    I have a problem where when I go from my world to another scene it works and it works when I come back but when I go back the other scene it doesn't work and it only switches scenes when you leave the transition area2D
    help would be greatly appreciated

  • @kevins.5573
    @kevins.5573 Місяць тому

    At first I have to say that you did great guides. I also stuck at the transition scene, camera of the cliff side and the world_camera from the player-scene. Could anybody tell me where I have to place the world_camera from the player and how to fix the crossmark to change move the window? I I click on the mark I just can move itself but not the window around what I want to do.
    Next issue is if I enter the CollisionShape 2D to reach the cliff_side I get the greyscreen although I set the collisions wrote same code. I can´t go back to world-scene too. I tried since days to find the problem but don´t see it 🤦‍♂.
    Hopefully its understandable and maybe anyone knows why :/

  • @miguelestacio2983
    @miguelestacio2983 7 місяців тому +1

    Does anybody know how to be able to switch between more scenes? How would the code look?

    • @rompevuevitos222
      @rompevuevitos222 6 місяців тому

      You can simply load more scenes to switch to.
      I'd use a Dictionary to keep them all under the same variable
      var scenes: Dictionary = {
      "east_starter": load("res://Scenes/EastFromSpawn.tscn") as PackedScene,
      "west_starter": load("res://Scenes/WestFromSpawn.tscn") as PackedScene,
      "north_starter": load("res://Scenes/NorthFromSpawn.tscn") as PackedScene,
      "south_starter": load("res://Scenes/SouthFromSpawn.tscn") as PackedScene,
      }
      Then you can check which you should be switching to.
      func transition_scene():
      if player.position.x > 1000:
      get_tree().change_scene_to_packed( scenes["east_starter"] )
      Personally, i'd make each level use a dedicated class, and have that class contain 4 scenes that the level can switch to when the player moves far enough in either direction.
      That way you can set per level which other levels are connected to it.

  • @Coolton-fc7sh
    @Coolton-fc7sh 10 місяців тому +1

    this was a great tutorial and easy to follow but when I wrote down all of the code for entering the cliff side, it didn't work (I changed the name of cliff side to cave 1 in all of its mentions). If you could reply and either let me know how to fix this or another tutorial for scene changing. -thanks

    • @FourLionsClips
      @FourLionsClips 9 місяців тому

      same

    • @pogolaugh
      @pogolaugh 4 місяці тому

      @@FourLionsClips I am not certain but perhaps it's because you have a space in the name. Maybe try Road1 or Road_1 I am trying it with road_01 and will edit this post if that doest work out.

  • @cydeYT
    @cydeYT 28 днів тому

    Wont teleport me back either from cliffside to world

  • @RealObservr
    @RealObservr Місяць тому

    I am not sure if I am starting to hate tinkering with games or like it because I am here, going through the code again and again, trying to figure out why it isn't working, and I see the smallest mistake breaking the whole code.
    Great video btw! It'd be even greater if you found a way to fix my stupidity too but that's not something mortals can do.

    • @dev-worm
      @dev-worm  Місяць тому

      haha!! the smallest mistakes cause the most frustration!!

  • @mateusdossantos9480
    @mateusdossantos9480 4 місяці тому

    Hey so I'm having struggles with the coding for this part. The "global" part of every code for world and cliff_side say that global isn't defined in the scope. Do you know what the issue could be?

    • @dev-worm
      @dev-worm  4 місяці тому

      mhm.. all i could think is maybe you didn't autoload the "global"

    • @nightfeathers
      @nightfeathers 3 місяці тому +1

      @@dev-wormFor me I have to use Global for everything instead of global.

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

      @@nightfeathers fixed it for me thank you

    • @catwell-white
      @catwell-white 2 місяці тому

      @@nightfeathers thank you so much bro your a lifesaver

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

    Already finished the tutorial series.
    But Now im stuck.
    How to change multiple scenes?
    Not only cliff_side but:
    Like in the (world scene) in tutorial have road so we can have 3 to go like cliff_side/village/river.
    I try by myself but either it get error or always looping world>cliff_side

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

      Lol nevermind its its work now 😂

    • @Daniel.LeePhotography
      @Daniel.LeePhotography Рік тому

      How did you fix this? I'm having the same problem but can't figure out how to solve it

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

      hey@@Daniel.LeePhotography i fixed mine by lessining the = sign xDthis is my code
      func finish_change_scenes():
      if transition_scene == true:
      transition_scene == false //i have two equals here it worked when i used 1
      if current_scene == "stage_1_start":
      current_scene = "stage_1_hallway"
      else:
      current_scene = "stage_1_start"

    • @pogolaugh
      @pogolaugh 4 місяці тому

      @@deca2572 how does this help you transition to a third scene?

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

    The y sort in the second scene doesn't work even though it's a copy of the other one

    • @dev-worm
      @dev-worm  2 місяці тому

      check all the settings again on the new tilemap

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

    After I added the second scene, whenever I loaded the game, the scenes weren't there, it was just a grey void. Anyone know a fix?

    • @inke1034
      @inke1034 4 місяці тому +1

      that happend to me too, I've relized after saving that I copied the whole scene from world when doing the other one. even though i copied it... im currently redoing my whole scene and I did a bigger one ... :(

    • @CHR1SMOV1ES
      @CHR1SMOV1ES 4 місяці тому

      I deleted my whole maps too. I think it is because, under "TileMap" -> "Resource" -> "Path" it was still linked to "World" insteadd of "cliffside" ._. :(@@inke1034

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

    I’m having a problem where when you enter the area in cliff_side scene to got world scene it won’t switch but if you go from world scene to cliff_side scene it does, it’s confusing since it’s the same code just minor tweaks with the names. PLSSSS HELP

    • @aidenanthony6166
      @aidenanthony6166 6 місяців тому

      I'm having the same issue, been looking at it for hours trying to understand what I could be doing wrong😭

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

      same here, i have done everything from scratch for the second time and still can t get over this

    • @bodymeat1199
      @bodymeat1199 6 місяців тому +4

      i got rid of these func lines in the cliffside and world script pasted below that he says are inconsequential and it ended up finally working for me. unsure whats going on here but was stuck in the same boat as yall until i deleted these.
      cliffscript:
      func _on_cliffside_exitpoint_body_exited(body):
      if body.has_method('player'):
      global.transition_scene = false
      world script:
      func _on_cliffside_transition_point_body_exited(body):
      if body.has_method("player"):
      global.transition_scene = false

    • @damiansmoczyk4455
      @damiansmoczyk4455 6 місяців тому

      I tried your method and although it worked.. it reset the camera when I first entered the cliff_side instance and when I went back into the world_instance. It reset my position to x0y0 and only let me move the camera up and to the left from that in the viewer.@@bodymeat1199
      I followed his code, methods exactly and with his code I can move into the cliff_side instance but I cannot move back into the world instance...

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

      @@bodymeat1199 Man thank you ! I did what you recommended and it worked perfectly, your awesome :D

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

    it's a bit odd to check if it's the player by searching for a method name (and a method called player at that, that's not really a good method name), why not just use groups? That's exactly what they are for.

    • @dev-worm
      @dev-worm  Рік тому

      your right, should have done that

    • @1tsKayne
      @1tsKayne 4 місяці тому

      how does groups work?

    • @kaboomsihal1164
      @kaboomsihal1164 4 місяці тому

      @@1tsKayne won't be able to give you a full on explanation of everything to do with groups in a comment mate but basically groups work like searchable tags. There's a tab in the node properties (on the right by default) where you can add a node to a group and then you can identify members of that group with a bunch of functions. Look at the documentation for groups, it explains them quite well. This example would really be one of the easiest examples, you would simply add the player to a group called "player" and then instead of searching for a method you basically just ask "does this node have the group player". I think it's "node.has_group()" but it's been a while, look at the docs. That's by far the easiest way to categorise things in godot. I use it for enemies, destructible objects etc. Instead of having to set some sort of internal property for each and every one you just add everything to a group and then check that instead. There's also more complex things you can do with groups like running a method on every node that shares that group or organising save data by having all nodes that contain save data in a group you can iterate over. But the most basic way to use it is just for the "is this node in group xzy" check.

  • @naemnikdub
    @naemnikdub 11 місяців тому

    Do you have a Discord server?

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

    Mine has been looping, what should i do?😢T.T

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

      never mind i dit it

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

    i get the error "Identifier "global" not declared in the current scope."

    • @dev-worm
      @dev-worm  10 місяців тому

      did you make global an autoload?

    • @doc8527
      @doc8527 8 місяців тому +4

      @@dev-worm "global" is a reserved keyword, for 4.2, you need to capitalize it to "Global" due to the conflict I believe. Just don't use "global" as the script name to avoid all the potential issue.

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

      THANK YOU!!! IT WORKED@@doc8527

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

      @@doc8527 thank you king

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

    Bro can you please upload a video about platform enemy ai Pathfinder with auto jumps pleasssseeeeee❤❤❤😀😃😃😃😃😃

  • @FourLionsClips
    @FourLionsClips 9 місяців тому

    entering cliff didnt work i copied everything

  • @1tsKayne
    @1tsKayne 4 місяці тому

    When I want to go back from cliff to world, nothing happens... code is the same

    • @syptocrypto
      @syptocrypto 4 місяці тому +5

      remove the body_exited code from the world and cliff_side scripts

  • @srravencroft4924
    @srravencroft4924 3 місяці тому

    Tried following your tutorial but I could not go back to the main map and I followed all of the directions.

    • @dev-worm
      @dev-worm  3 місяці тому

      are you getting any errors?

    • @Spaced0ut000
      @Spaced0ut000 3 місяці тому

      @@dev-worm im also having this issue with no errors. i can go to the second scene, but i cannot get back to the main scene and all code is the same

    • @FreedomTFS
      @FreedomTFS 3 місяці тому

      @dev-worm I was as well. @BruceWayneReal in his comment mentions, "So I was having issues transitioning between scenes because when it went to the new scene it would run the body_exited code just before running the finish_changing_scenes code so it would never actually change the current_scene to "cliff_side". I was eventually able to find a fix to this by simply removing the body_exited code. Now it works perfectly." I just tested it and it did allow me to transition scenes, but I had to fix my camera. I removed it from BOTH scripts (World and Cliffside) not sure if it's actually the right fix, but it worked for me hope it helps.

    • @Spaced0ut000
      @Spaced0ut000 3 місяці тому +1

      @@FreedomTFS yeah I tried all of that and it didn’t work either. :(

  • @markerg7915
    @markerg7915 4 місяці тому

    I tried the same way as you did but the the scenes doesn't change
    I need help

    • @dev-worm
      @dev-worm  4 місяці тому

      are you getting any errors?

    • @markerg7915
      @markerg7915 4 місяці тому

      @@dev-worm no errors found
      i walk onto the collision shape and nothing happens

    • @markerg7915
      @markerg7915 4 місяці тому

      ​@@dev-worm
      Well it kinda worked but when I go back to the first scene the game freezes

    • @markerg7915
      @markerg7915 4 місяці тому

      Now I fixed the freeze but the exit point doesn't work

    • @markerg7915
      @markerg7915 4 місяці тому

      ​​@@dev-worm lmao I fixed it by changing the current scene in the "world2" script to "world1"
      Godot is getting weird those days

  • @SoftTehCustomer
    @SoftTehCustomer День тому

    17:47

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

    16:00 you can change it
    from:
    if global.translition_scene == true:
    to:
    if global.translition_scene:
    and
    from:
    if global.translition_scene == false:
    to:
    if not global.translition_scene:

  • @mayedalshamsi
    @mayedalshamsi 2 місяці тому +1

    Man, I'm sorry to say this, but I have zero confidence in everything in this guide. Too many mistakes, too much hesitancy. I don't want to learn something and then have to unlearn it when I discover the proper way to do things. :(
    Please prepare a script next time.

    • @dev-worm
      @dev-worm  2 місяці тому

      sorry! this is older! In the newer things I have a script placed out

  • @cydeYT
    @cydeYT 28 днів тому +1

    This is your worst tutorial in this playlist.

  • @FreedomTFS
    @FreedomTFS 3 місяці тому +1

    @dev-worm @BruceWayneReal in his comment mentions, "So I was having issues transitioning between scenes because when it went to the new scene it would run the body_exited code just before running the finish_changing_scenes code so it would never actually change the current_scene to "cliff_side". I was eventually able to find a fix to this by simply removing the body_exited code. Now it works perfectly." I just tested it and it did allow me to transition scenes, but I had to fix my camera. I removed it from BOTH scripts (World and Cliffside) not sure if it's actually the right fix, but it worked for me hope it helps.

    • @dev-worm
      @dev-worm  3 місяці тому

      glad to hear that!! seems like the correct fix, glad you were able to figure it out! that is amazing

  • @HippocritterXD
    @HippocritterXD 9 місяців тому

    I get an error after 20:40 it says invalid get index 'position' (on base: 'null instance') 0 - ress://Scenes/World.gd:7 - at function:_ready does anyone know how i can fix it?

    • @sirethicvalorant2467
      @sirethicvalorant2467 9 місяців тому

      try to put $player.position.x as $Player.position.x
      the P is capital

    • @HippocritterXD
      @HippocritterXD 9 місяців тому

      @@sirethicvalorant2467 thanks I will try that tomorrow 👍🏻

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

      did it work?@@HippocritterXD

    • @HippocritterXD
      @HippocritterXD 8 місяців тому +1

      @@nidakucukyildiz8550 I dont really remember 😅 but I think so, everything works now so I guess it did. Been doing a lot of tutorials, hard to keep track of it all 😅

  • @Dracossaint
    @Dracossaint 23 дні тому

    17:41