Beginner Godot Tutorial - Make Flappy Bird in 12 Minutes!
ฝัง
- เผยแพร่เมื่อ 6 ก.ย. 2024
- Learn the basics of Godot by making a flappy bird clone in this tutorial.
The code for the game is built from scratch and will cover setting up the different scenes and their nodes as well as linking everything together using signals. I will add a pipe generator as well as collision detection for the pipes and ground.
Code and assets for this video: github.com/rus...
Annnnd thats how you watch a 12 minutes video in 1.5 hours !
hell yeah. I mean would it kill him to pause a little bit between actions, and show what he is clicking on a bit longer than half a second? :-D
Thanks for this. I've been trying to learn GDScript. I didn't understand everything you showed, but this is definitely a good start for when I make more progress.
Thanks! Yea this video is a little bit fast, I probably shouldn't have called it a beginner tutorial as it's difficult to follow if you've never used godot before.
Keep doing complete projects on Godot 4, you are gold!
extends CharacterBody2D
const GRAVITY : int = 1000
const MAX_VEL : int = 600
const FLAP_SPEED : int = -500
var flying : bool = false
var falling : bool = false
const START_POS = Vector2(100, 400)
I used this to spawn in a ball for a new plinko clicker I am making. It was super helpful. Thanks!
Great tutorial, I like that you didn't spend too much time explaining concepts. Great when coming from Unity
really good tutorial! It was perfect as a "hello world" to get me used to this game engine. I was easily able to change things to my liking and even add a
"Get Ready!
"TAP TAP"
screen, like in the original game. I'll probably add the ability of changing the color of the bird next as a little challenge
Thanks! I like the little tweaks you're adding :)
Thank you so much for the guide!
I just tried godot this year and haven't fully grasp the UI yet. But, this video explained it very well for a beginner. of course it's probably will be better if you can slow it down at some specific point.
I'll definitely watch the other guide to make games!
i agree
:)
Thank you very much, I'd say one of the best explained. You do need a high level of attention to detail, it took me two attempts to make it work (says a lot about me i guess).
I can understand the editing took a lot of time and effort but in some places it was not easy to follow so lowering the setting playback speed helped.
Having said that this was a brilliant video and great to see someone make a complete game with all of the code available.
Keep up the great work it is appreciated!
Thanks! The funny thing is that with all the editing, this video took me about as long to make as it would have if I made a full length tutorial 😅
Glad you found it useful though!
After following a few other in depth tutorials to get a basic understanding of core Godot features, this was a fantastic next step for me! Such a fast and rewarding way to help grasp concepts and actually prove to people that they can make a game. As I was pausing and copying code it had me thinking "oh yeah that makes sense" and "OH so this is connecting from what we already implemented here" I will definitely be checking out your other videos. Thank you!
i really like how concise this is. it encourages you to actually learn the software instead of just copy what you see
Thanks!
These tutorials are really good.
I do have one issue though.
In this game and the dino run, when I plug the same data, the game movement speed is way faster.
Example, I had the same numbers, and the pipes moved at blistering speeds.
It was the same for me, try to change the SCROLL_SPEED from 4 to a lesser number like 2 for me it should help
Great tut. On point, no time wasted.
This was very well done, although 12 Minutes video turned into 1.5h of actually doing the steps :P
idk 12 min. rebuilding and really understanding hours xD. very good video but i like longer videos with more explanations!
Thanks, Russ, for sharing your knowledge. I'm trying to convert a video poker app I wrote in Python/Pygame to Godot 4. After Snake and TicTacToe, I'm finally 'getting' Godot a little bit. I haven't watched Flappy Bird yet, but I'm sure it'll be helpful.
Glad to hear it's starting to come together. I switched from pygame to Godot not too long ago so it's a learning curve for me too!
Idk if this bug is because of the new Godot version, but 5:28 didn't work for me. After messing around a little, I figured that the reason was that the variable "scroll" didn't have a type assigned to it (I'm sorry if I'm making some kind of mistake with the proper names), so changing the line 5 from "var scroll" to "var scroll : int" fixed the problem and let me run the game with the ground moving
09:05 I found another bug here which could also be from the version. My pipes still didn't have collision and the pipe scene had a yellow triangle on the collisions, saying that they couldn't be connected to a sprite2D node. I changed the order, connecting them directly to Area2D "Pipe" node and that fixed everything. I ofc changed the names for better understanding of what was what
09:57 now I realize that I just did it wrong when I was setting it up, mb
After following the video and doing everything in it, I found out I suck a FlappyBird
Thanks for the video
thanks for the tuts Russ...
I really don't like the copy paste approach that you've been using in your latest couple of vids. The old coding along style was much better imho. hope you can return to using that instead
Thanks for the feedback, it's good for me to know whether people like the new approach or not. I thought people would find the code along style repetitive plus those videos take much longer to make so I switched it up. I have a few more short style tutorials planned so once they are done, I'll look at which style is preferred and try to find a balance.
I've been playing Marshmallow Land (it's a built-in hidden Android game) so it's quite good timing that you make this. xD
I had to google that, can't believe I never heard of it before...I've had an android phone for years 😅. Looks like a very similar concept game.
4:07 hey I got an error here
when I clicked play, the engine says to me there's an error, which is the reset() function isn't declared in the original Bird scene
is there any solution to this glitch ???
I have the same glitch, idk what to do
this error should mean that you haven't created the function reset in the Bird.gd script. when you declare it it should look like this:
func reset():
falling = false
flying = false
position = START_POS
set_rotation(0)
You may have accidentally declared it inside another function (for example the _ready() function)
When I press the mouse button nothing happens
Did you set up the input correctly in project settings?
Hello Russ, who did all the graphics for you?
I'm still working on your pygame tutorials but I like the look of the Godot games much better. I'll see if I can follow along on this tutorial and just might switch over to Godot for my future games.
Thanks, Gary
Hi Gary, I just find them online, there are lots of open source images that can be used with or without attribution. I try to credit all my sources in the video description although I couldn't remember where I got the images for this game so I couldn't reference them.
Thanks Russ and keep on making these great tutorials!
Hey Russ, I'd like to ask about the formulas in your tutorial, like:
`if flying:
set_rotation(deg_to_rad(velocity.y * 0.05))`
or
`pipe.position.y = (screen_size.y - ground_height) / 2 + randi_range(-PIPE_RANGE, PIPE_RANGE)`
As a newcomer to game development, I'm curious about their origin. Are these from your game dev experience, established best practices, or custom calculations for this project? Those techniques work great, and I'd like to learn more about them. Thanks!
Hello. I'm self taught so this stuff comes from previous experience making these kinds of games (I made flappy bird in pygame a couple years back) and also just trying different things and refining them until they work.
I try to avoid manually entering numbers and instead use the data available in the game, so that's what is going on with the second formula. I sketched out the position that I wanted to calculate, then looked at what existing variables I can use for reference and came up with an equation to tie them together.
A really great tutorial. I had managed to get everything working, but after customizing the textures of the pipes to my own designs, the game keeps crashing (freezing/Not Responding) when the "generate_pipes()" function is run. Whenever the timer first ends, it freezes and in the "Stack Trace" window, it says "Cannot call method 'instantiate' on a null value. And then in Stack Frames are below that message in the window, it lists the "at function: generate_pipes" and "at function: _on_pipe_timer_timeout" in the list. I've looked through the tutorial and can't seem to find what's different between the code. Any ideas what could be the problem or how to fix?
Note: I don't really know what caused the crashing, because I did get it to work with the different textures for a couple runs of it.
Update: I fixed it. For some reason, the problem was that the pipe scene got unlinked from the variable. Idk how it happened, but I linked it back and it works now. Again, thanks for the great tutorial!
Very helpful and I did learn! Thank you!
Glad to hear!
i have a problem my charecter is stuck at one place and doens not go up nor done when clicked it just rotates but does go up or down please help
Thank you for sharing your knowledge and for being straightforward.
Im trying to make it go to the center but it just stays on the corner
this short video style is awesome. But it helps if one knows a little Godot. i have used Godot 4 for just a week and i can easily follow along. However the classic ross will work effectively for non beginners. either way this is super cool.
I have a glitch where the pipes don't appear at all, is there any reason ?
Nice and clearly explained! Everything worked here
THIS MAN IS SO UNDERRATED! HOW DOES HE NOT HAVE 1 MILLION SUBS??
I love the vid dude but i have one problem when i try to run the game it has a error with $Bird.reset() and the error it gives is
main.gd:24 @ new_game(): Node not found: "bird" (relative to "/root/Main").
i tried for so long how do i fix this?
I think it's because your 'bird' has a lower case b. Make the node Bird and it should be okay.
@@dezatoosweet I'll try thanks
I would definitely do code along. it seems like your niche. because people like me who are web developers and want to dabble in video game creation... so those people will love code explanations and walk throughs to increase their knowledge
Hello im making this in Godot 4.2 and i did all the same and this happen
Invalid get index 'position' (on base: 'previously freed'). and the game instantly crash and doesnt let me even execute it.
2 breakpoints are marked.
1) Line of code 10: var screen_size : Vector2i
2) Line of code 60: for pipe in pipes:
pipe.position.x -= SCROLL_SPEED
I had this same issue.
Be sure to add the "pipes.clear()" function below this call.
It did this because the "queue_free" method removes the pipes from memory, so it's basically looking for a "null" value when accessing the position.x of the pipe in the pipes array (even tho we're generating new pipes... idk memory management 101 I guess).
Not sure if this exactly helps, I'm still learning myself! LMK what happens.
my bird doesnt go up and down and i am unsure why i have written your code exactly but my bird just flaps once for a second and then just stays in the animation and doesnt move properly he kind of jolts and tilts a bit but its llike he is stuck with a pin to a certain place. is this because i used a different texture than you?
the amount of times i pause in this video prob equivalent to me watching a 1 hour tutorial, but still, i pretty much prefer this type of fast pace tutorial
do you know why when pipes spawn sometimes there are space between pipes and ground ? and when new game pipe spawn in front of bird ?
Hi - When creating the bird you say "Save the scene in that same folder". What do you mean? When I try to save the scene in the same folder as the background, I just get an errorr.
hopefully with this i can finally get the grade i need to pass one of my tech classes, thank u for giving what was supposed to be gave
loved it !💯💯
Glad to hear it!
been struggling along for hours. more and more issues as i got deeper in. double and triple checked the code compared to the gdscript provided and shown in video. can't get the pipes to appear. and the bird falls through the floor for a very very long time. and the ceiling area detection doesn't seem to be at the right height
started over from scratch and spent another day struggling through. i finally got it to work. thank you for this and the pong tutorial. what i've learned is that you have to be extremely exactly perfectly precise. part of the difficulty for me is that this one felt a bit too fast. "blink and you miss it" kind of stuff threw a wrench in things several times
I love these videos, but sometimes you go too fast and I miss some code lines or something
I'm new to Godot and I appreciate the example here, thank you. I do have a quick question. Is it normal for autocomplete to sometimes not work? Like while I was following along, when I typed pipe.position or $Bird.falling, it wouldn't autocomplete position or falling. Does it behave that way for you too?
yeah it did the same thing for position for me
im pretty sure its jsut random
how do i stop Godot from anti-aliasing my pixel art?
Go into the project settings, under rendering and textures set the default texture filter to nearest instead of linear
Well done thx dude
Glad it helped
thank you!
Tengo un problema, mis tubos se colocan muy abajo dejando poco y casi nada de espacio para que el ave pueda pasar, cómo lo puedo solucionar?
I think I'm cursed i followed this to the exact and i got to 4:05 mins and nothing happened lmao
same
found the solution . in bird script i changet this line from = to += ( velocity.y += GRAVITY * delta)
Hard to follow along, try to show slower steps.
I wish you would explain why instead of just a step-by-step.
where can i get the animation
i'm learning godot but it is just so Madding!
Мне кажется или спрайты дергаются?
its says that it doesnt exist
Deep.
Bird_hit doesnt work for me, My bird continues flying through pipes even after 9:00
I had the same issue. Turns out I'd created the node in the Main scene as a "Node2D" instead of just a "Node"
Have the same issue. I am trying to make a computer game for the first time at all. Don't understand whats nok... My main scene is "Node". @TechnicalParadox did you solve your issue and how?
@@aija_papaya I didn't specifically fix this issue but I took a Godot course on udemy. Make sure the area or body of the bird has the on_area_entered or on_body_entered linked to the script. If that's good then check the collision properties of the bird and of the pipes, other than that I can't think of anything else it wouldve been
I found my issue :) In Pipe script the function "func _on_body_entered(body):" was not connected. :)
@@aija_papaya sorry I had typed out a reply earlier but must not have sent it. I never fixed this issue in this project but I took a udemy course for godot since and yeah it's either that the script wasn't connected to the signal or the collision layers are messed up, or you have a mix up between area/body and are using wrong function
Is this work on mobile?
I haven't tried
Thanks
Can you make tutorial for mobile?
Thanks
Please actually explain what your doing at a slower pace, if I just blindly follow along as a beginner I won’t actually learn anything.
Plz make a 3d foghting game in ursina of guns plz
it works!
@Coding With Russ
Can you make tutorials for roblox studios please?
I wanna learn how to make games in roblox but I don't have that much money. Thanks
6:48
TERRIBLE tutorial, I just started Godot 4.3, and I was looking for a simple tutorial to fit my needs. I have some experience with python so I thought it would be easy. I found this tutorial, and it went WAY too fast for an absolute beginner. He 'explained it' and what I mean is he said what the code would do and not what the code actually does functionally. Not recommended for anyone with no Godot experience, like me.
Hello nice video, would it be possible to send me the entire code please?
this is a lot of code
I actually find this more complex than just coding the game from scratch!😅
you cant just copy and paste it in the video you gotta type with us
You see what is written, just read
my pro hacker coder friend says ur code is DOODOO please make easier code for us beginners UwU!!!!! TY DADDY mwahh!!!
thank you for the tutorial but when i opened it up it said
E 0:00:00:0637 Main.gd:28 @ new_game(): Node not found: "ScoreLabel" (relative to "/root/Main").
Method/function failed. Returning: nullptr
scene/main/node.cpp:1634 @ get_node()
Main.gd:28 @ new_game()
Main.gd:20 @ _ready()
i did just copy paste the code so im guessing thats where i went wrong but how do i fix it or do i just gotta redo the code parts?
yeah, really wanted solution to this. I also copy and pasted code and followed all the tutorial but same error is occuring. Please explain whats the issue
finally found the error, in code of github underscore"_" was missing like _body, _delta and another mistake was i wrote names of node in small letters but in code it was capital
really nice. thanks a lot
Thanks!