How to Change Scenes in Godot (Building a Level Switcher #1)

  Рет қаралды 43,994

jmbiv

jmbiv

Күн бұрын

Пікірлер: 86
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
Can you say "scene switching system" 10 times fast? Hope you enjoy this tutorial and can use it to build a robust scene switching system (!!!) in your own game. Make sure to join the Discord server if you haven't: discord.gg/e4BxZbe
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Also, the code for this tutorial now exists in its own repository, if you want to use it as an example (the code in the repo is the form after the end of video 3, not this video): github.com/josephmbustamante/Godot-Level-Switcher-Tutorial
@commoner9835
@commoner9835 2 жыл бұрын
Thank you for making a multipart, practical, AND original tutorial. Honestly refreshing to see and really helps out devs like me who are a little into the awkward phase of game development.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Thanks for the kind words, glad that it was helpful! I get that, there's a bit of a hump to get over when you know enough about game dev/programming but still trying to figure out the engine enough to be dangerous with it. Hope that these videos help you get there!
@KozelPraiseGOELRO
@KozelPraiseGOELRO Жыл бұрын
I was arround the first minute like "Well, I know how to do that, but I came from #3 cause I didn't fully understood." but from 5:25 to around 12:00 I was like "Head inner fleshy stuff hurt" then I could understand what was going on and rewatched from 7:40 to the end. That was more complex than the average Godot video, but very (very, very) useful, thanks.
@Juliaardbei
@Juliaardbei 4 ай бұрын
I struggled with this concept for quite some time. This tutorial was super helpful, and I really like how you send the 'level_name' argument with the signal to create a signal that's unique and very dynamic. I wanted to have multiple interconnected levels with two 'exits', so I experimented with also sending a 'trigger_name' argument, based on which new level I'm trying to access. It took a lot of fiddling, but it worked! Now it's super easy to add a new level, and put in multiple buttons/area2Ds to go to the next level. Thanks so much for this tutorial, it really gave me a better understanding of how to simplify my code and make it as dynamic and versatile possible. Awesome!
@OJsmith7
@OJsmith7 Жыл бұрын
for GODOT 4. if you're getting errors around 17:55 , and your scenes aren't actually switching, you need to make some changes after the "match" ``` var temp = load("res://"+next_level_name+"_level.tscn") # crates PackedScene next_level = temp.instantiate() # this is required in order to see the scene call_deferred("add_child",next_level) # call_differred fixes a few errors next_level.connect("level_changed",_handel_level_changed) # syntax is a little different in version 4 current_level.queue_free() current_level = next_level ```
@CinderellaCostallas
@CinderellaCostallas 5 ай бұрын
for me, it's still not changing, and I get no errors at all so no idea why it's not working...
@CinderellaCostallas
@CinderellaCostallas 5 ай бұрын
I had to change the main scene in project settings to the scene switcher
@boerbol9422
@boerbol9422 2 жыл бұрын
Amazing tutorial. What I like about your tutorials is that it teaches recipes and good coding at the same time.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
I’m so glad to hear that the tutorials have been helpful!
@rashadfoux6927
@rashadfoux6927 4 ай бұрын
This is classic and I was able to easily translate it not only to Godot 4, but to a multiplayer context
@erengazioglu
@erengazioglu 3 жыл бұрын
VERY high quality tutorial, you're a great teacher! I only recently stumbled upon your page (after a year of _Godot-ing_ ) and I'm glad I did. *THANKS*
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
Thanks so much, I really appreciate the kind words! So glad you're finding the videos helpful.
@marcdirian6370
@marcdirian6370 Жыл бұрын
Thousand thank's for this algorithm witch is so helpful ! Also, and this is not the less thing, you explain so clearly your mindset that I am becoming a "fan" of you. Nice work !
@FernandoCruzBello
@FernandoCruzBello 3 жыл бұрын
thank you so much for this tutorial , I have learned a lot and I am waiting for the next video to see how you make the transitions between scenes.
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
No problem, glad to hear that it was helpful! Next video will come out this Thursday 🙂
@Secularis.
@Secularis. Жыл бұрын
Correct me if I'm wrong, but this seems the best way to make a game in Godot since most games consist of switching from menu to menu, to character sheet, to level, to credits etc. Seems to be a very clean solution with everything very organised. And that might be the reason I like Godot so much
@jmbiv_dev
@jmbiv_dev Жыл бұрын
There are definitely other ways to do it (and even this way will need some code tweaking as your game grows), but I've found it to be my favorite way of implementing a system like this! Hope it's helpful for you 🙂
@nirajacharya6668
@nirajacharya6668 Жыл бұрын
Haha I was looking for this. Keep it up mate.
@ChristianParent
@ChristianParent 3 жыл бұрын
This is perfect, great timing, I was talking about this just yesterday. Cant wait for the rest of this series
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
Glad to hear that it was helpful!
@ChristianParent
@ChristianParent 3 жыл бұрын
@@jmbiv_dev Now the long wait for the next part !
@God_of_Art
@God_of_Art Жыл бұрын
still works on 3.5.3 - if scenes aren't switching at the end - make sure you run scene, not a whole game. Stupid stuff, but it take me a while to fuigure that out lol. TY for the video
@maudwelshpot1026
@maudwelshpot1026 9 ай бұрын
Thank you so much!! I thought I was going crazy with how EVERYTHING looked correct but didn't work
@craftmoon-vas
@craftmoon-vas 3 жыл бұрын
Thanks!
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
No problem! Thanks so much for the tip - much appreciated!
@steevejobs1395
@steevejobs1395 3 жыл бұрын
My guy this is awesome I'm so thankful I found your video
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
Thanks for the kind words! Glad the video is helpful.
@Markolainen_
@Markolainen_ Жыл бұрын
Thank you! Great tutorial and explanation.
@yvanvan3729
@yvanvan3729 3 жыл бұрын
13:45 Just drag and drop scene from FileSystem to the text editor and Godot will write the complete name for you. BTW good job
@Snafuey
@Snafuey 3 жыл бұрын
Or right click the scene in the file system and copy path then paste where needed
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
In all the years I've used Godot, I never knew you could do that 🙃 thanks for the tip, super helpful!
@Snafuey
@Snafuey 3 жыл бұрын
Glad we can give back to you since you are giving all of us so much. FYI I prefer the copy over the drag cause sometimes the drop goes somewhere I don’t want it. It’s really personal preference though.
@Betegfos
@Betegfos Жыл бұрын
Very nice tutorial! I am trying to implement it on Godot 4 for an open world game. One thing I am not sure how to do is how to save the game state so that the game remembers on which level the player was when the game was saved. In other words, how do I make a save system that saves the progress of the player. Perhaps it is in one of the next episodes. In that case I apologize for my ignorance. Keep up the good work!
@justinnng3118
@justinnng3118 3 жыл бұрын
Amaaazing video Thx for that, will be great for my game :n But one question How can I adapt this to my autoload where if I switch scene, it will save the experience, health, or “currency” the player carrys? Thx! As I have been a long fan :n
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
So glad that you found it helpful! And good question - pt. 2 and 3 will cover more about sending data between scenes, so be on the lookout for that (: but quick answer before then - if you have an autoload that has experience, health, etc. of the player, just make sure before you "queue_free()" your current scene that you update the variables on your autoload, and then in your next scene you might want to have a function that grabs the variables from the autoload and does whatever it needs to with them (you would want to call this function from your scene switcher, so something like "next_scene.function_to_load_variables()" after you updated those variables from your current scene). Hope that helps!
@justinnng3118
@justinnng3118 3 жыл бұрын
Thx very much! Looking forward to your next videos :n
@EnderCrypt
@EnderCrypt 3 жыл бұрын
hey man, your playlist is in the wrong order and has a private video, you might wanna fix that
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
Thanks for catching that! I had to re-upload the 3rd video, which caused the old one to be private. Should be fixed now.
@suthamonhengrasmee8182
@suthamonhengrasmee8182 Жыл бұрын
very wise
@ikim76
@ikim76 2 жыл бұрын
Great tutorial, thanks! I have notice a strange bug, at least I think it is one. When yo instantiate scenes with instance() and add_child(), one-way collisions set in a Tileset in the instanced scene do not work as one way collisions, but as complete solid platforms. Have you had this or any similar issues?
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Hey sorry, that's a weird bug! I've never noticed that before. If you can't find any issues about that on GitHub, you should open one up there (or try asking on the Godot Discord server!)
@dmnu4ll
@dmnu4ll Жыл бұрын
How do I define current level in Godot 4? What is the variable type? Also if you're using typed variables, why you are not using them on node references?
@juanrivas1336
@juanrivas1336 2 жыл бұрын
I found this video very useful. I have a question about the Level.gd script; how do you make both the Grass Level and Dessert Level share the Level.gd script. Do you just create it in both canvass layers, or is there a particular way of making the two scenes share the Level.gd script. Thank you
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Any scene can use any script, even one that other scenes are using! In your scene tree on the left, you'll see the little script button with a green "+" symbol - you can use that to either create a new script, or select a script in your file system that already exists to load into the current scene. With that in mind, you can create the Level.gd script in either the grass or desert level, and then load that same script into the other scene. Hopefully that makes sense!
@robertnett9793
@robertnett9793 3 жыл бұрын
Ha. Got it to work :D That's really great advise you give here. However one question - the moment I use my stage-transition (I implemented your code in my stage-teleporters instead of a button, and also it's a platformer using tilemaps and such) the program throws about 100 errors like 'body_set_shape_disabled: Can't change this state while flushing queries Use call_deferred() or set_deferred() to change monitoring state instead.' The program doesn't break, though, so I guess it's some internal stuff crying, because it was killed mid-frame. Is there a way to avoid this? Is this a problem to be worried about? Or can one leave it like this? Besides that - Thank you. That's exactly the level of complexity I need right now. It's not yet grand code wizardry, but above beginner level. There are sooo much 'how do I asign a variable' level courses - and then a lot of very arcane high-end ones. But that intermediate level seems always so underdeveloped. I mean, diving in is great and all - but how exactly should one take all those steps between beginner and grand-master if there isn't any intermediate stuff. So again - thanks a lot for your help.
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
I'm so glad that you found these videos helpful and the right amount of complexity! Yea, that sweet spot between super basic but not too advanced is where I try to land whenever possible. As far as your question, you're right, that error happens a lot whenever you free/change scenes where a lot of physics work is happening. It can be hard to find the root cause, but shouldn't actually affect your game. As long as you use queue_free, Godot should make sure everything necessary is cleaned up before it frees a scene.
@zacharyturner5096
@zacharyturner5096 2 жыл бұрын
@@jmbiv_dev Hi man, thank you so much for the great tutorial. I am getting the same errors as this person is, except it is preventing me from changing scene... any thoughts?
@kennethgrady1986
@kennethgrady1986 2 жыл бұрын
so I got the lvel switching between 1 and 2 working thanks to your advice. Now I'm trying to add in a function to restart level when I hit enemy. heres the code I put on my main node extends Node2D onready var enemy = get_node("res://scenes/enemy.tscn") func _ready(): enemy.connect("enemy_hit", self, "handle_enemy_hit") func handle_enemy_hit(): print("restart level") I can't figure out how to properly connect any signals from nodes other than level 1 that you explained. I watched a ton of videos on connecting signals and I just don't get how to properly link scenes that aren't directly within the parent node. do you know any good resources to explain how to get_node or get_tree or whatever I need to do to get my custom signals to work? I have a bunch of instances of enemy scene in each level and I need any one of them to be able to tell my scene switcher to restart level. some are in the level already loaded and some are in other level scenes that aren't
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Great question! A couple things that I hope will help. 1. get_node() can only access nodes/scenes that exist in your scene tree, but in your code you're trying to access a PackedScene (a scene file that exists in your file system, but not in your game). Instances of your enemy scene file (the PackedScene) might be in your game, and get_node() can get access to those instances. 2. It sounds like you've got a lot of enemies, and you want to get access to them all. There are a lot of ways to do this, but here are two I would suggest. This code should probably go in your _ready() function before you call connect. Here they are: 2.1 In your base enemy scene, add them to a group called "enemies". Then, whenever you instance your enemy scene, each instance will be in the same group. You can get all currently instanced scenes that belong to a group by calling "get_tree().get_nodes_in_group("enemies"). This is a helpful page if you aren't familiar with groups: docs.godotengine.org/en/latest/tutorials/scripting/groups.html 2.2 Add a basic Node2D (or Spatial, if 3D) node called EnemyContainer that is a child of your Main scene, and make all of your enemies children of EnemyContainer. Then, in your Main script, you can do $EnemyContainer.get_children() to get a list of all the enemies instanced in your game. 3. Now that you have ways to get all of your enemies, you can connect to their "enemy_hit" signal. The code you have in _ready() is mostly good, but you have to connect to that signal for each individual enemy instance, so we'll need to loop through them. However of the previous two ways you got your list of enemies, loop through them now (something like "for enemy in enemy_list" - replacing "enemy_list" with whatever variable you stored your enemies in.). Then, in each iteration of the loop, you can use that "enemy.connect(...)" line you already have. I didn't explain much of the concepts behind all that, so apologies for that, but hope that is at least helpful in getting you started. I think part of your struggle is just trying to differentiate between a scene as 1) a concept/file that exists in your file system that you can edit in the editor, vs. 2) a scene that has actually been instanced in a running game. Functions like "get_node()" can only be used for the latter of those. Hope that this helps!
@Dad3353
@Dad3353 2 жыл бұрын
Good evening, jmbiv... Is there any chance of obtaining a copy of this Project, so that I may study it in more detail, and use it as inspiration for inclusion in my own modest Projects..? I'm a total newcomer to this friendly system, but, at 71, I don't pick things up quite as quickly as I used to. I have tried copying from the (excellent...) video, but it's very laborious, pausing, swapping windows, typing stuff etc... Just a thought, it would save so much trouble. I had a quick look at Discord, but I came quickly to understand that it's not for me; I can't see what to do with it. So, hoping this meets with your favour, thanks in advance, and I'll continue with the next video in this series. Meanwhile... Keep well, stay safe Douglas
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Hey Douglas, thanks for the note, and glad the tutorial has been helpful! I've had a couple people ask me for the project before and I've meant to make it accessible, but just haven't gotten around to it. But I'm committed now - I'll try and do it in the next day or two, and let you know with a GitHub link where you can copy the project yourself. Thanks for asking, and best of luck as you're getting into Godot! Please feel free to ask more questions if any come up.
@Dad3353
@Dad3353 2 жыл бұрын
@@jmbiv_dev Splendid..! Onwards and Upwards, then..! No rush; in your own time.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
@@Dad3353 Hey Douglas, just to follow-up -- this tutorial project is now available on GitHub at this link: github.com/josephmbustamante/Godot-Level-Switcher-Tutorial As a note, the GitHub project is the finished project after episode 3 of this video, so that's the form of the code you'll find there. Hope it helps!
@flashback4588
@flashback4588 2 жыл бұрын
for some reason the camera attached to my player character stopped working when i changed scenes D: i was able to fix it by using get_tree().change_scene() instead of the addChild() and queue_free() i think ill still be able to pass data between scenes if follow along tho
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
That's weird! Did you make sure your camera was still a child of your player, and was marked as "current"? using change_scene() definitely works, but you might have some trouble passing data between scenes later on that way (but maybe not!)
@rlplayz6643
@rlplayz6643 3 жыл бұрын
i am trying to make this but with levels as an integer, I'm really not sure what to do from here and when I copied this code with strings instead, it still didn't work
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
It should work to do it as an integer - maybe try making an enum level dictionary where each level is a constant value of the enum? If you're still having issues we can help out in the discord server!
@rlplayz6643
@rlplayz6643 3 жыл бұрын
@@jmbiv_dev OK thanks!
@togashi-azul
@togashi-azul 2 жыл бұрын
Pretty good tutorial, I really learned the foundations of this system But when I tried to implement it on my game I ended up having a problem; I made a menu that would lead to the first level by clicking on it but my first level root node is a Node2D so when it reads the line "current_level.layer = 1" it causes a bug Did I do an oopsie or it just wont work with this node? I though about changing my root node into a CanvasLayer but that sounds wrong for me... If someone can help me with this problem I would be grateful :)
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Good question! You can definitely just use a Node2D - instead of changing the "layer" property, you'll want to change the "z_index" property to 1. Note that if some of your "levels" (or menus, etc, that you change with this system) are CanvasLayers, those will still draw over other levels that are Node2Ds because CanvasLayers are entirely new draw layers. That shouldn't be an issue though, and hopefully this helps!
@springerplayz29
@springerplayz29 2 жыл бұрын
Good tutorial tho i keep getting an error saying "invalid type in function 'add_child' in base 'Node (SceneSwitcher.gd)'. The object-derived class of argument 1 (PackedScene) is not a subclass of the expected argument class." what did i do wrong? Edit: i found out what was wrong. Tho this style of changing scenes doesnt work for my game sadly even tho its very easy. Edit of the edit: nvm i realised i forgot to add the important part.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Glad you were able to figure it out!
@springerplayz29
@springerplayz29 2 жыл бұрын
@@jmbiv_dev ok so after that happened, i found a problem cus with my system it didnt work for some reason, like i could go once but not twice. I tried making my own system and again same problem. Is there a way i could show you the system and maybe you could help me out with making it work right. I asked for help on the official discord server but got no response unfortunatly.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
@@springerplayz29 If you join my Discord server we can try and help you there! Less people than the official Godot one but tends to be a very active and helpful community!
@kennethgrady1986
@kennethgrady1986 2 жыл бұрын
Thank you for the great video I'm having trouble with this. I've been playing with this for 4 hours and I CANNOT get my level 2 to switch back to level one. I am using a flag at the end of my level with a collision shape sending the body entered signal instead of the button. I've entered "level-1" and "level_2" at the exported variable. Nothing I do works. super frustrated. heres my code for the level switcher extends Node onready var current_level = $level_1 func _ready(): $level_1/level_end_flag.connect("level_changed", self, "handle_level_change") func handle_level_change(current_level_name:String): var next_level var next_level_name: String match current_level_name: "level_1": next_level_name = "level_2" "level_2": next_level_name = "level_1" return next_level = load("res://scenes/" + next_level_name + ".tscn").instance() add_child(next_level) next_level.connect("level_changed", self, "handle_level_change") current_level.queue_free() current_level = next_level and heres the code for the level_end_flag extends Area2D signal level_changed(level_name) export (String) var level_name = "level" func _on_level_end_flag_body_entered(body): emit_signal("level_changed", level_name) print(level_name) I have verified with the print function that I'm emiting the correct signal at each flag, I just can't get the signal from my level_2 flag to connect with the handle_level_change function I think. any help would be much appreciated.
@kennethgrady1986
@kennethgrady1986 2 жыл бұрын
I created a seperate scene for my level_end_flag and instanced that in each level. Could that be my problem? does the "button" have to be a direct child of level scene instead of an instanced scene?
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
I think your problem is that in your "handle_level_changed" function, you're trying to connect to your "level_changed" signal on your next level itself, when in reality the signal exists not on your next level but on that next levels' end flag. So, you should change this line: next_level.connect("level_changed", self, "handle_level_change") To instead be this line: next_level.level_end_flag.connect("level_changed", self, "handle_level_change") I would probably add "onready var level_end_flag = $LevelEndFlag" (replace that with whatever your flag node name is, and make sure that name is consistent across all of your levels). Hope that makes sense and helps! Let me know if not.
@kennethgrady1986
@kennethgrady1986 2 жыл бұрын
Thank you so much! I could NOT figure out how to reference the level_end_flag node in the connect function. I’m excited to try that out! I’ve only been learning to code for the last 2 months or so and I get stuck pretty easily. I appreciate the great tutorial and for responding so quickly!
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
@@kennethgrady1986 No problem, happy to help! If you've ever got questions as you're learning to code or use Godot, we'd love to have you in our Discord server - we've got a friendly community with a ton of people who can answer your questions. Also feel free to leave any comments here, too. Best of luck!
@Zetimenvec
@Zetimenvec 2 жыл бұрын
While I'm a huge fan of your style of actually explaining how things are working, I have to say I'm a little miffed when people add complexity and call it simplifying, when really it's just making it more human readable. Maybe that's 'simplifying' in some esoteric sense, but it's not a literal simplification. It's literally complicating things.
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
I definitely understand the semantic quabble! This is really not an important issue, so this isn't me arguing with you, but just my thoughts - I would actually argue simplifying is the best term here. For example, with any software API, their might be a lot of complexity under the hood (complexity as in a lot going on), but all of this complexity might be necessary for a very simple user-facing API. It doesn't mean the underlying code isn't complex, but you can have important parts of something be simple while the overall whole might be complex, and I think that example is kind of what's going on in this tutorial. More than that, though, having more code does not necessarily mean "more complex." Rich Hickey developed the Clojure language and is one of my favorite programmers. He has a really good talk called "Simple != Easy" that I would highly recommend looking up. Basically, his point is that we shouldn't just define simple as "less" (and, conversely, say that anything that has "more stuff" is complex). This is especially true in software terms. Anyway, I didn't explain all that well and just wanted to pose a potential counterpoint since I think the notion of "simplicity" is actually a really important concept to consider. Very much understand your point though that in some sense what I'm calling "simplifying" is actually adding complexity. I think I just choose to use a different definition of simple 🙂
@Mekano_Turbo
@Mekano_Turbo Жыл бұрын
does not work at godot 3.5.1
@God_of_Art
@God_of_Art Жыл бұрын
it does work for 3.5, maybe you tried to launch the game at the end out of habit, but you need to launch the scene
@son9012
@son9012 11 ай бұрын
@@God_of_Art wdym. i press play and it just crashes when i press the change scene button TT.
@God_of_Art
@God_of_Art 11 ай бұрын
@@son9012 press F6
@aben776
@aben776 3 жыл бұрын
The tutorial video need to improve a bit. Avoid backtracking too much (write, erase, then rewrite code differently) as it confuses beginners.
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
Thanks for the feedback, it's always appreciated! You're right that this video isn't my best or most concise one, and it's good feedback for me to be aware of going forward, so thanks for saying that. That said, there's only so much you can ask for with free tutorials, and sometimes I'd rather just publish an imperfect video if it will be helpful rather than re-record it all, so it's always a balance 🤷‍♂️
@gryzman
@gryzman 3 жыл бұрын
this is getting super complex
@jmbiv_dev
@jmbiv_dev 3 жыл бұрын
Yea, there are definitely "simpler" ways to make this but I'm trying to give at least one example of a well-architected way of creating a scene transition system - that said, no claims this is the best way to do it, so do whatever works for you!
@bubblemage
@bubblemage 2 жыл бұрын
So what if I don't make the "change_scenes" folder but instead have different level scenes in different folders? like "HouseInteriors" folder or "Dungeons" folder. That way the "next_level = load("res://change_scenes...............)" part won't work because that's not my levels' path!
@jmbiv_dev
@jmbiv_dev 2 жыл бұрын
Sorry for the delayed response, but good question! You could do this a few different ways. One way would be to include the high-level folder in each scene's name (so every dungeon scene would have "Dungeons/ThisDungeon" as its scene name). Another, and probably better way, would be to have your levels have a "Level Type" variable that stored whether it was a dungeon, interior, etc - this could be an enum that you selected a preset option for. Then, your scene changer would insert the correct folder prefix depending on the level's LevelType (so if a scene called Dungeon1 had a LevelType of "Dungeon," your scene switcher would automatically add "Dungeons/" as a prefix to the scene name it used to find the next level. A lot of text, but hope that helps! Feel free to join our Discord server too if you need any more assistance and we'd be happy to help you there!
@randompast
@randompast Жыл бұрын
In Godot 4: get_tree().change_scene_to_file("res://Scenes/Win.tscn")
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 1,7 МЛН
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 45 МЛН
Когда отец одевает ребёнка @JaySharon
00:16
История одного вокалиста
Рет қаралды 13 МЛН
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 2,8 МЛН
How You Can Easily Make Your Code Simpler in Godot 4
6:59
Bitlytic
Рет қаралды 440 М.
10 Things I Wish I Knew Sooner with Godot
10:39
Jon Topielski
Рет қаралды 64 М.
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 350 М.
6 Tips to Better Organize your Godot Projects
11:39
GDQuest
Рет қаралды 135 М.
BETTER 2D visuals in 7 EASY TIPS
10:38
MrEliptik
Рет қаралды 71 М.
Finite State Machines in Godot 4 in Under 10 Minutes
7:16
Bitlytic
Рет қаралды 294 М.
13 ADDONS to SPEED UP your game creation in GODOT!
11:23
MrEliptik
Рет қаралды 109 М.
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 1,7 МЛН