Godot 3.2 - Changing Scenes Tutorial

Поділитися
Вставка
  • Опубліковано 9 лют 2025
  • In this video, I go over how to change scenes in your game by having your player walk towards certain areas in your map.
    / arkevegames
    itch - arkeve.itch.io/

КОМЕНТАРІ • 80

  • @spacedghoststudios
    @spacedghoststudios 3 роки тому +2

    How do i do this without the global.gd file that you have? I don't know how to define "Global" and thats the error that keep getting

  • @philipbooker8511
    @philipbooker8511 4 роки тому +2

    As always Arkeve, incredible work. This is helping me so much!

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

      Happy to help!

    • @spider-fan9123
      @spider-fan9123 3 роки тому

      @@Arkeve Can You please tell me where you have got the sprite please...

  • @nomoyohoo5232
    @nomoyohoo5232 2 роки тому +3

    For anyone wondering about the error "The identifier "Global" isn't declared in the current scope.":
    Try changing your global.gd to uppercase Global.gd - it needs to be uppercase.
    Also don't forget to put the Global.gd to autoload as Arkeve mentions in the video.

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

    I have been trying to figure this out for hours, thank you so much!

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

    Thanks for the help! can you think of any reason why the portal works on the initial scene but i cannot return once in the second scene?
    edit I made it work. i just turned the layers and masks on and off until it worked. cant say i solved it.

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

    Great dude. Your game design looks cool, when I watch a tutorial with a weird game, I'm always having doubts about the real talent of the dude.

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

    This is probably too late to get a response but when I try to use Global.player_initial_map_position = player_spawn_location
    in my Portal script for example I get an error saying "The identifier "Global" isn't declared in the current scope." Any help would be appreciated, thanks!

  • @Stonekom
    @Stonekom 3 роки тому +2

    How to do handle having the player enter from 2 sides of a scene? For example if the player enters from the left of the mines or the right, would you just have 2 player nodes in the scene and hide depending on which side you've entered from?

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

    Congratulations you have earned yourself a new subscriber

  • @biggestscrimpus2025
    @biggestscrimpus2025 4 роки тому +3

    Trying to implement this into my game ( also thank you for being the only person to post a video on this!! ) but was wondering what is your global script attached to? I have a base world node and was wondering if i should put it on that or how to use the global script? Thanks for any help you can offer!!

    • @Arkeve
      @Arkeve  4 роки тому +4

      You don't have to attach the global script to any node. You would have to make it an Autoload script though. Go to Project Settings -> Autoload tab and select the Global.gd script and click add. By making it an autoload script, the script automatically loads onto your scene tree and you should be able to access the script's variable in other scripts through: `Global.variable_name`

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

      @@Arkeve Thank you so much for the quick response!! Gonna try it now, hopefully I can get it to work lol

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

    Simple enough! Good tutorial. Now how about that sweet inventory and menu?

    • @Arkeve
      @Arkeve  4 роки тому +3

      I'll make it my plan to make a video on it soon :)

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

      @@Arkeve and so, a subscriber you have made out of me!

  • @JavaJack59
    @JavaJack59 4 роки тому +2

    I'm wondering if it would work out to have invisible nodes in each scene to pinpoint the spawn locations. Then you'd have to reference that node by... a string, or something, I guess.

  • @elysehargreaves
    @elysehargreaves 4 роки тому +2

    Really amazing tutorial, thank you.

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

    Nice video bro 🙌 thank you so much

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

    I know this is from at least a year ago, but I keep running into not being given the option of next scene path, I genuinely need some help with this-

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

    I wonder in your game if you decided to add the cave part before you get to the cave, as a few intro tiles, to let you know you're entering into a new scene? I've seen that a lot since the 80s on various games, in NES. It builds anticipation of the next area.

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

      Yup thats definitely a good idea!

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

      @@Arkeve super :)

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

    I know this goes kind of out of the scope of this tutorial, but I would personally prefer having some singleton managing the scene changes, and having it create a signal that can then be called by any node that wants a scene change, one of which could be the portal.

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

    Great tutorial.
    Clear and to the point.

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

      Thanks a bunch!

  • @Ordynarnynie
    @Ordynarnynie 4 роки тому +2

    "The identifier "Global" isn't declared in the current scope.'
    This shows in both Player and Portal script. Setting the Global script to autoload in project settings, did nothing.

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

      I've preload the script and = it to var Global. The previous error is gone but another shows !
      "Invalid get index 'player_initial_map_position' {on base: 'GDScript'}"

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

      Change to "var Global = load("res://Scene/Global.gd").new();" as suggested
      on godotengine forums. When i put it in player script the game crashes on entering the portal.If added to both player and portal script, change scene works but teleports me in default position set in global script. I give up.

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

      Hey, you shouldnt have to preload the global script. After setting it as an autoload script you should be able to access it in any script be "Global.variablename". It might have glitched when you first tried, try restarting the engine and accessing again. Hope it works!

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

      Again if i don't make a variable Global in some way in Door and Player script Godot gives me error:
      "The identifier "Global" isn't declared in the current scope.'
      Player and or Door script seems to not see Global script even if autoloaded. Restarting Godot did nothing. Thanks for quick answer, maybe i find some other solution.

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

      Holy shit, it worked! I just repeat every step once more from the start!!
      I'm so sorry for pester you like this. But you are literally the only person on youtube who explain how to change scene with custom spawn points. Works like a charm!!

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

    Thank you for these godot video tutorials :D I need all the help I can get, specially for 2D haha so I subbed ^^

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

      Appreciate it!! I'm sure you'll start making some great 2D games! Keep learning!

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

    Hey, thanks for all the help. I noticed you mentioned that if the game is top down, you have to worry about 4 directions. My game is top down. I tried implementing Vector2 in the facing directions but that didn't work. Can you help me out?

    • @Arkeve
      @Arkeve  4 роки тому +2

      It really depends on how you implement movement in your game. I assume you change the player's direction depending on their velocity. But if you want to start the player in a certain direction, you can play the corresponding animation (idle direction animation) depending on a Vector2 value.
      Vector2(1, 0) -> facing right
      Vector2(-1, 0) -> facing left
      Vector2(0, 1) -> facing down iirc
      Vector2(0,-1) -> facing up.
      In your player ready function, you load this Vector2 value from the Global.gd script and play the corresponding idle animation.

  • @n30hrtgdv
    @n30hrtgdv 3 роки тому +2

    Amazing tutorial!! question: Can you have multiple portals? as in multiple exits that take you to different maps? I think it's possible to just add more portals but I haven't tested.

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

      By having exportable variables you can indicate which scene and part of the map you want to go to. You should only load the string from the path of the specific scene

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

    hmmm what if id want to have a the transition fluent/flawless/smooth instead of imidiate jump to different scenery. The ideal would be to have the camera and background follow the player in seamless long transition or even a huge, long map. But i have no idea how to do it. When working in Godot i can only see the rectangle that is limiting what player will see on the screen. How to make big platformer game with seamless camera transition to other location of the level map if action is on seen in that rectangle? Any ideas? Anyone?

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

    Thank you for this tutorial, keep it up.

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

    Error parsing expression, misplaced: Built-In Func
    I'm getting this error

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

    How did you change the game engine theme

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

    I've followed the video but my player completely dissapears when I play the game, Does anyone know how I can fix this?

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

    hi! what if I want to press a key before changing scenes? what part in the script do I add that key checker?

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

    Worked great. Thanks.

  • @maxd.o.826
    @maxd.o.826 3 роки тому

    thank you very much for this!

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

    Nice video! How do you set it to remember the player costume and equipped items between scenes? Is it using the player's ready function?

    • @Arkeve
      @Arkeve  4 роки тому +2

      Yup, i store what the player is wearing in an autoload script and set those sprites in the player's ready function

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

    Great tutorial, thanks so much

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

    Thank you, Good sir!

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

    Looks good, thanks for sharing 👍

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

      Thanks, appreciate it!

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

    Amazing! thx !!

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

    How can one add to the search "Godot Visual Script" and everything is in GDScript, why???? I just need one stupid button to switch scenes ahhhhh

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

      Hello! Idk if u figured this out by now or not, but heres the solution to the question. Click (Project -> Project Settings -> AutoLoad) after this u can click the little folder icon right after the Path: text box and select what scrips u want to become a Singleton. After selecting click the Add button off to the right. Now it should be a singleton and accessible in the script for you. Hope this helps you out!

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

    HOLY BASED!

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

    Awesome.. Thank you!! :D

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

      Glad you found it helpful!!

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

      @@Arkeve Most welcome. I'm an almost complete Godot newbie. It's more of a side hobby off and on. I'm curious how do you have your player holding the sword?

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

      I create a separate sprite for the sword and then animate its position and rotation to align with the player's animation

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

      @@Arkeve oh wow! So you can just change the weapon and replace it easily?

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

      @@Arkeve I need to practice making more animated sprites. I only made one so far, an enemy that moves its eyes up and down while it walks. lol

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

    OH! I just typing File and not FILE
    That's why my exports were yelling at me!

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

    thanks!! i don't speak english, but you help me 👍

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

      Happy to help

  • @cmds.learning7426
    @cmds.learning7426 4 роки тому

    hanks for sharing

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

      Thanks for watching!

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

    I had to make that my player died and it worked woth this tutorial i dont know how but it did

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

    Thanks

  • @billw.wonder6160
    @billw.wonder6160 4 роки тому

    It just work ^.^

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

    this is so overly convoluted..