Pixel Platformer Tutorial / Code Along P12 (RemoteTransform + Checkpoints) - Godot Engine

  Рет қаралды 16,779

Heartbeast

Heartbeast

Күн бұрын

Thanks for watching my video!
If you are interested in taking a deeper dive into the Godot game engine you can buy my 1-bit Godot Course at this link: www.heartgamed...
Check out my Patreon: / uheartbeast
Follow me on Twitch for GameDev livestreams: / uheartbeast
Twitter: / uheartbeast
Facebook: / heartgamedev
Thank you all so much for your support!

Пікірлер: 71
@uheartbeast
@uheartbeast 2 жыл бұрын
This video game me some trouble the first time I tried to record it (last Friday). We got it working this time, though! Here is the link to the 1-bit Godot course: www.heartgamedev.com/1-bit-godot-course-youtube Here is the link to the kenney assets: kenney.nl/assets/pixel-platformer I also uploaded the source to a githup repo and stuck it all under the MIT license. Here is link to the repo: github.com/uheartbeast/Pixel-Platformer See you all in the next video! Ben
@theindiegamedude
@theindiegamedude Жыл бұрын
First off, thank you so much for the detailed tutorial videos for this platformer made in Godot. I've been going through your video tutorial series using Godot 4.0. Quite a bit has changed, and I've been taking the time to learn how everything in this series would work using 4.0. It's mostly been some syntax changes along the way for certain lines of script. With the checkpoint though, I had a really hard time having it change to the "Checked" animation. Even though I knew I was colliding with it. I spent an hour on it yesterday, to find out that the Collision Mask for the Checkpoint's Area2D node needs to be set to "Characters" layer #2.
@jsonify
@jsonify Жыл бұрын
In Godot 4, replace: Events.connect("player_died", self, "_on_player_died") with: Events.player_died.connect(_on_player_died) That way we are calling the "Events" singleton, using the "player_died" signal and connecting it to the "_on_player_died" function. Make sure to leave off the parenthesis on the argument for the "_on_player_died()" method because we are trying to pass the result of calling the _on_player_died() function as the argument to the connect() method, rather than passing a reference to the method itself. In GDScript, when you place parentheses after a function name, you are telling the interpreter to call that function immediately. So in our code here, _on_player_died() is being called and its return value is being passed to the connect() method as an argument. and you no longer use the "yield" keyword. Instead you use "await" like this: await timer.timeout
@ÓscarHernándezSoler-f8r
@ÓscarHernándezSoler-f8r 9 ай бұрын
Thank you so much!!
@kirby745i
@kirby745i 3 ай бұрын
Make sure to use the function PlayerScene.instantiate() in Godot 4 as well, as PlayerScene.instance() is no longer used.
@GregX999
@GregX999 2 жыл бұрын
To fix that little "freak out", you need to set "Clamp Loop Interp" for the ping-pong animation. In the Animation pane, select the Bounce (ping-pong) animation, then click the icon on the far right of the unit_offset track (just to the left of the trash can), and select "Clamp Loop Interp". For the looping animation, it should be "Wrap Loop Interp". No need to set anything to 0.999.
@uheartbeast
@uheartbeast 2 жыл бұрын
Awesome! That is super useful. Thanks for sharing!
@Phrate
@Phrate 2 жыл бұрын
I tried that, and the animation simply stops at the end and doesn't bounce back.
@ribdot
@ribdot 2 жыл бұрын
@@Phrate I ran into the same issue after setting the Loop Wrap Mode to Clamp Loop Interp as Greg suggested. To fix this I duplicated the key at 0 secs for the unit_offset track (where unit_offset is 0) and put it at the end of the bounce animation. Eg: My bounce animation track is 8 seconds. At 0 secs the unit_offset is 0. At 4 secs my unit_offset is 1 (the half way point of the animation), and at 8 secs the unit_offset is 0 again. Hope this helps!
@tihc1
@tihc1 2 жыл бұрын
@@ribdot At first I had the stopping issue, then now I added the last frame. So my frames go 0, 1, 0(the unit_offset). I have Clamp Loop Interp on, but after a few deaths the little freakout still happens. Any advice??
@psyboyo
@psyboyo 2 жыл бұрын
THIS WORKS: to the left of the trash can icon, the middle button, Interpolation Mode, set it to Cubic. Goes ease-in-ease-out, smoother animation, gives extra frame calculation priority when reaching the point to loop back, so it doesn't glitch the start frame at the top.
@kobiuslol
@kobiuslol 2 жыл бұрын
Good job Ben, I really love your videos and after watching your action RPG Videos I was really inspired. Last night I successfully added coins, a coin counter a title and settings screen and more, exited to see your next video.
@neilwalker4277
@neilwalker4277 2 жыл бұрын
Great video, as an exercise in teaching remote transform and instancing. But the player is a constant in a game and best not to free. In this there was a need for a remote transform and to remember resetting the camera. Imagine having another dozen or so nodes in a larger game all referencing player, etc. Easiest way is simply provide a means of managing life within the player with/without aid from the world node there you don't need to re-reference everything or set up a remote camera transform.
@raphaelmorgan2307
@raphaelmorgan2307 Жыл бұрын
one of my favorite parts about watching gamedev videos is how much time is spent watching someone play a game and die on purpose
@kevinbreen4510
@kevinbreen4510 2 жыл бұрын
This is such a fun series to follow. Thank you for showing how to fix the issue as my character was sometimes spawning inside the ground, and I was thinking of moving the location of the flag higher to compensate, but it made far more sense to move the character up.
@lohovovepete
@lohovovepete Жыл бұрын
If your playing is dying but not respawning in GODOT 4, you need to call get_parent() ie add_child(player) is now get_parent().add_child(player) edit: I also had this issue where I was spawning in the ground below the flag. The solution I had to this was to made a new Vector2 with the coordinates 0,-5 and add it to the checkpoint position var addFive = Vector2(0,-5) player_spawn_location = checkpoint_position + addFive
@Deozaan
@Deozaan 2 жыл бұрын
I believe that the problem with the player respawning multiple times on death (at 20:00) had nothing to do with using global position and everything to do with the fact that you were adding it to the tree before repositioning it. It was spawning onto the spike monster at the world origin and immediately dying before being teleported to the intended spawn position. By moving your positioning code above adding the player to the scene tree, you positioned the player out of the way before it had a chance to interact with the spike monster.
@uheartbeast
@uheartbeast 2 жыл бұрын
Good analysis. I though along the same lines, however, you can't manipulate the global_position of a node until it is in the scene tree, so that is why I switched to use position instead of global_position. I guess I just didn't explain my reasoning very well in the video.
@dVaan
@dVaan 2 жыл бұрын
For quick waits theres a yield(get_tree().create_timer(wait_time), "timeout") so u dont even need to create a timer node, very convenient.
@uheartbeast
@uheartbeast 2 жыл бұрын
Yeah, I've used get_tree().create_timer in the past. I'm wary of yielding up the scene tree, though. There is the rule: signal up, call down. I also would suggest the rule: signal up, yield down. Of course, in this case get_tree().create_timer would work quite well since we can assume the World scene is not going to be freed.
@ThatElfNerd
@ThatElfNerd Жыл бұрын
So this definitely helped with making checkpoints, but with the game I'm making, I had to make several adjustments to fit what I needed. The player in my game actually doesn't respawn in the world they die in. They instead return to the level selection menu. Ended up needing to write in some global variables not only to keep the checkpoint active upon exit, but also written in such a way that it's only the checkpoint of that specific level that's active. But if the player hits a checkpoint in another level, that checkpoint will overwrite the data of the previous one. That way the player can't set every level to be on their checkpoints. Also had to set the end goal of levels to erase checkpoint data. That way they can't spam playing the same level from the halfway point each time they beat it then replay it.
@jon-marc3971
@jon-marc3971 9 ай бұрын
I was getting crashes when calling the _on_player_died function. Eventually found that in Godot 4, "instantiate" is used instead of "instance." My function looks like this which is working: func _on_player_died(): timer.start(1.0) await timer.timeout var player = PlayerScene.instantiate() add_child(player) player.connect_camera(camera) (Note that I am only 18 minutes into the video, had to pause to figure this out! LOL)
@crabscrabscrabs
@crabscrabscrabs 2 жыл бұрын
if i had to take a guess about what happened at 20:04, it could be that was the player respawning at 0,0 and instantly coming into contact with the pathing enemy but being moved to the respawn point in the same moment
@nevdevyt4015
@nevdevyt4015 2 жыл бұрын
Neat trick for everyone who wants to add the whole flag pole (pole + flag) if they also find the way it was used in the video kind of ugly: Just add both animated sprite and sprite nodes under your checkpoint. Animated or the flag part, sprite for the pole part, and then script only affects the flag part (while collision area goes over both). A very simple and obvious trick, but since people here are beginners or maybe didn't think of it, why not share? ^^
@Vampdude696696
@Vampdude696696 Жыл бұрын
So when I tried implementing the Player spawn i'm getting a strange thing where the character reloads as it should, but reloads below its zero position, and doesn't contact any of the tiles i've made. Anyhting i might be missing?
@icomputo
@icomputo 2 жыл бұрын
"yield" was removed in Godot 4.0. Use "await" instead. 🤕
@zcartre83
@zcartre83 2 жыл бұрын
@22:12 I think the solution was just connecting your camera after you set the players position (I just happened to order my code differently than you). I never had the same issue as you even using global_position.
@Ekozaak
@Ekozaak Жыл бұрын
I'm not sure to understand why we couldn't directly linked the player to the world through signal ? Does signals only link the current node of the scene , so when we create a new one it's not linked anymore ?
@rylanthegrea
@rylanthegrea 2 жыл бұрын
Just wondering if anyone is having the same problem as me. When I duplicate the checkpoint and the player interacts with it before dying when they respawn they are halfway in the ground Remember when ben shows how the player spawns halfway in the ground but Godot is smart enough to push the player out. It seems like for me it is not pushing me out of the ground. Does anyone have a solution?
@danielnangelone
@danielnangelone Жыл бұрын
I had the same problem. I went into the Player scene and selected everything and moved it up a couple spaces and then it started spawning in the right spot
@magenta_juice8166
@magenta_juice8166 Жыл бұрын
Change in World script "func _ ready" from "player_spawn_location = player.global_position" to "player_spawn_location = player.position".
@emreinkaya
@emreinkaya 2 жыл бұрын
Can you make a dash tutorial
@uheartbeast
@uheartbeast 2 жыл бұрын
Cool Idea! I might do that one.
@icomputo
@icomputo 2 жыл бұрын
Godot4. Error - Invalid argument for "connect()" function: argument 3 should be int but is String.
@AgnisNeZvers
@AgnisNeZvers 2 жыл бұрын
I didn't see a moving platform on your Trello board. Seeing your different approaches to several things, I'm really curious about your solution for moving platforms.
@mustafatuncay7644
@mustafatuncay7644 2 жыл бұрын
Hello Ben; Setting the value property on the animation track key edit section or anything that you change won't solve the problem. If you would set a higher playback scale value, the problem will happen again. The problem is on the PathFollow2D node of the movingspikeenemy scene. You have to uncheck the loop property. Also, you don't need this in your usage scenarios, you are controlling the enemy part of the scene by using AnimationPlayer.
@johnnylinares5126
@johnnylinares5126 2 жыл бұрын
Very awesome video. Think you can do the tutorial on the character select screen so that the player can make a selection on one of the characters?
@moxingames
@moxingames Жыл бұрын
Why does my Player object first die after the respawn , it fails to trigger die?
@pastuh
@pastuh 2 жыл бұрын
A little strange when player dies, all other objects still moves :) Somehow expecting to set ALL level enemies back to same position, but I think it's too much work.. So which best way to do this? Just reload all scene?
@Phrate
@Phrate 2 жыл бұрын
Yeah at that point reloading the scene would be easiest. Add a little fade to black or card cut transition and it'll look nice! If you're going that route and still want to use checkpoints though, make sure to save the checkpoint and return to it after the scene reloads!
@giantfrogstudios839
@giantfrogstudios839 2 жыл бұрын
Why the underscore before the function name '_on_player_died' ?
@GwyndolinOwO
@GwyndolinOwO 2 жыл бұрын
super late but functions that "signal" will have that in front of them. I haven't tested to see if functions work either way but it could be a visual way to see what functions you have that aren't connected to a signal, and what ones are.
@mugiwaraviraji8763
@mugiwaraviraji8763 2 жыл бұрын
Great video series and thank you so much for all the information. I hit a bit of an issue. I retraced the steps and tried troubleshooting on my own, but I was good until adding the remote transform and camera. Every time the character dies it still instantly resets, even though the checkpoint works (at least the animation works), it'll jump back to the beginning of the scene. I know its a vague question but what is the best way to troubleshoot how to fix this and have my checkpoints and scene resets work correctly? And for clarity, I’ve have all the code in from this current video. Thanks!
@giantfrogstudios839
@giantfrogstudios839 2 жыл бұрын
I found that when I reinstance the player its z_index is set back to 1 and so is behind the ladders. I just set its z_index to 10 again in code.
@IFarrell625
@IFarrell625 2 жыл бұрын
Thanks for this, I was wondering what was happening
@danielnangelone
@danielnangelone Жыл бұрын
at 22:28 when my character respawns, it does not detect hits from enemies any more. I die once, then respawn and walk through enemies without dying
@zcartre83
@zcartre83 2 жыл бұрын
Does anyone on MacOS know what the keyboard shortcut is to zoom in on the select frames menu of AnimatedSprite?
@tihc1
@tihc1 2 жыл бұрын
Instead of using Command like how you would use Ctrl on windows, just use Ctrl+Scroll, instead of Cmd+Scroll
@feedthepyre
@feedthepyre Жыл бұрын
I'm having a bit of a strange issue that doesn't crop up in this video as HB has sound effects off, but if I die several times in a row, my sound effects seem to keep increasing in volume for some strange reason? If anyone knows why this happens or has a solution, please let me know! Edit: It seems the issue was solved after I reorganized some spikes near the beginning of my level. I had a set of three spikes in a row and when I would land on two of them at a time, the audio would play for both of them which for some reason increased the volume permanently until I would restart the game. I fixed this by just not putting two spikes where you could hit both at once, but still and incredibly odd issue.
@Ratiosu539
@Ratiosu539 Жыл бұрын
could be wrong but i think the player it touching both spikes and dying so it runs the function twice, spawning two players at the same time and doubling the audio EDIT: yeah that seems to be the case. i made a workaround by assigning a variable that increases when the playerdie function is called that increases when it's called and then added a check that only allows the playerdied signal to send if the variable is at 0. then in the respawn function the variable resets to 0 when the player respawns
@uunnpaelp3866
@uunnpaelp3866 Жыл бұрын
@@Ratiosu539 thanks you are right
@jordentacoztm
@jordentacoztm 2 жыл бұрын
Will you teach us how to use particles? I feel like it's pretty important
@fottymutunda6320
@fottymutunda6320 2 жыл бұрын
Are we going to see some simple shaders?
@GGxv23
@GGxv23 Жыл бұрын
Ty
@TG-Nexus
@TG-Nexus 2 жыл бұрын
how many episodes is this series of godot?
@uheartbeast
@uheartbeast 2 жыл бұрын
It's looking like about 2-3 more.
@badunius_code
@badunius_code 2 жыл бұрын
Why not extract spawn_player into a function and use it at start&
@marwan.naasan
@marwan.naasan Жыл бұрын
Hello my friend, I am very grateful for these educational clips that you provide.. My language is Arabic and I offer to hold some conversations in English, but I am not fluent in the language, so the automatic KZbin translation helps me a little .. I want to ask you about something that worries me. I hope you give me a satisfactory answer. The matter is: I I understood writing the basic commands for walking or jumping, but when I got to the advanced videos, I noticed that I was having difficulty understanding or memorizing. Is this normal? I mean, if I want to do the same job in the future, I will not be able to do it alone. I have to watch how to code in your channel again in order to write it correctly .. Is this normal .... Thank you
@Azrael-vz7fg
@Azrael-vz7fg 2 жыл бұрын
Huh. Maybe this is a hint that I should still pursue game design.
@thegameissimple
@thegameissimple 2 жыл бұрын
yield(get_tree().create_timer(1.0), "timeout") no need for extra nodes
@uheartbeast
@uheartbeast 2 жыл бұрын
I should have mentioned this in the video. But I'm actually familiar with get_tree().create_timer and while it does work in this situation (since we can assume the World node will never be freed) I've had issues with yielding up the scene tree. That's why I have a personal rule of "yield down, signal up." Similar to the common "call down, signal up." Anyways, yeah. Using create_timer would work just fine here as well.
@thegameissimple
@thegameissimple 2 жыл бұрын
@@uheartbeast as a general advice I would say to avoid yield altoghether. Besides awaiting for a freed object, yield can cause all sorts of different hard to track unexpected problems, and doesn't work with any kind of multi-threading. Basically it works only in a very basic cases and even then it is potentially dangerous.
@uheartbeast
@uheartbeast 2 жыл бұрын
For better or for worse I have used yield a lot and love it. In the ways I use it, yielding down has solved all the issues I had previously experienced with it. That being said. I agree with you in principle. Yield's practical use for me is likely working well simply because I've found (possibly overfitted) my way around it's dangers and I haven't had need for multi-threading in my projects yet (I assume because I make relatively small 2D games).
@CodingWithAlbert-O
@CodingWithAlbert-O 10 ай бұрын
my checkpoint can't change animation to "checked"!!! >_< The code: func _on_Checkpoint_body_entered(body): if not body is Player: return animatedSprite.animation = "Checked" animatedSprite.play("Checked") print("CheckPoint!") P.S. I connected the signal/node/function whatever ALREADY HELP!!
@CodingWithAlbert-O
@CodingWithAlbert-O 10 ай бұрын
In fact, it isn't even printing "CheckPoint!" ! I went to Godot Forums and searched, someone DID has the same issue, but that question apparently has NO replies and solutions 😞
@CodingWithAlbert-O
@CodingWithAlbert-O 10 ай бұрын
I went to debug section and turned on Visible Collision Shapes, the player raycast did turn red, but the flag didn't do anything...
@CodingWithAlbert-O
@CodingWithAlbert-O 10 ай бұрын
SORRY! Fixed it. I forgot to adjust the collision layers >O
The Minecraft Movie memes are way too good.
8:10
Phoenix SC
Рет қаралды 1,4 МЛН
Don't underestimate anyone
00:47
奇軒Tricking
Рет қаралды 27 МЛН
From Small To Giant 0%🍫 VS 100%🍫 #katebrush #shorts #gummy
00:19
Smart Sigma Kid #funny #sigma
00:33
CRAZY GREAPA
Рет қаралды 30 МЛН
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 7 МЛН
I Made a Metroidvania in 48 Hours - Devlog
7:13
Goodgis
Рет қаралды 157 М.
How to Code (almost) Any Feature
9:48
DaFluffyPotato
Рет қаралды 701 М.
How Games Make VFX (Demonstrated in Godot 4)
5:46
PlayWithFurcifer
Рет қаралды 362 М.
Making a Game With C++ and SDL2
8:14
PolyMars
Рет қаралды 1,7 МЛН
Godot Scripts I add to Every Game
12:34
Aarimous
Рет қаралды 48 М.
Improve your Platformer’s Jump (and Wall Jump) | Unity
8:12
Dawnosaur
Рет қаралды 127 М.
How to Add Checkpoints to Your Game #GoGodotJam
22:57
rayuse rp
Рет қаралды 2 М.
HOW TO COME UP WITH GAME IDEAS - 5 TIPS
5:43
Blackthornprod
Рет қаралды 244 М.
I Made My First Game in Godot in 3 Weeks...
26:21
Jack Sather
Рет қаралды 438 М.
Don't underestimate anyone
00:47
奇軒Tricking
Рет қаралды 27 МЛН