Great video, but the bump back mechanic doesn't work correctly. If you run into an enemy and keep pressing the movement button, it will only bump you vertically. That's because the bump back sets your velocity.x at a certain value so you're thrown back, but having the movement button pressed simply resets that velocity.x to a different value. So as it is now, this part only works if you stop pressing your movement button right as you hit the opponent, otherwise you just awkwardly jump up. I the easiest way to fix it without changing lots of things is probably adding another variable telling if your running is disabled or not, disabling it as you hit the opponent and enabling it again after you hit the ground. The more complex solutions I can think of would require changing the running mechanics, so instead of setting a different velocity when your movement button is pressed, they add a bit of it (until it exceeds a certain threshold). Then when being bounced back and trying to move you'd only get pushed back less instead of nullifying it completely. I was talking about this video, not the bonus lesson. I didn't watch it yet.
My issues with the bonus lesson: 1. It's not related to the lesson itself, but it's annoying - for some reason the video on the Coco Code site restarts every time the browser window is hidden (like when click to change to my Godot window for example). I put both my browser and Godot on separate monitors to solve the problem, otherwise I'd have to play the video again and set it to the right time every time I want to change something in my game. This issue happens at least on Firefox in Windows 11. 2. I'd recommend adding the "jump_count += 1" to the parts of code making us bounce back from the enemies when they damage us, otherwise it's possible to triple jump by getting hit and then jumping twice in the air. Unless we actually want that. 3. If we change the platforms to be smaller and and allow passing through them from the bottom in the TileMap's settings... it works, but it seems to only change it for the specific level. I think it'd work if I made the TileMap node into a scene earlier and placed the scene on the levels, but I didn't (since it wasn't mentioned). I can just change it by hand on both levels, but in big projects it'd probably be better to think of making such things into scenes early.
Thank you very much for this series of videos. I am an indigenous person from Quebec, and with these videos, I will be able to create a small 2D platformer with legends from my ancestors to interest young people in their history. I wish you a beautiful day. May the Creator protect you, my friend.
That sounds amazing! Good luck on this and your future projects! Pssst: Remember that you can access 4th video in the series here: cococode.net/courses/godot-mega-tutorial
Thank you so much! the bonus lesson was exactly what I needed. I was so frustrated by the extra parts of some tiles which the character's collision box always detected. but then your extra lesson helped me fix it.❤
Is anyone facing the problem in which when we touch the enemy from the side,we donot go flying in the opposite direction if we are still pressing the movement keys?
It has to do with their hit boxes and also in the enemy script maybe lower the "If (x_delta > 0) :" to a -1. Somewhere along those lines got it working for me
Yeah, but you didn't do anything wrong. This is a thing the video's author missed. When you bump into an enemy, it sets your velocity.x to a certain value to move you back, but since your movement button is pressed, it also executes the line in the main character's script that resets its speed to "direction * speed", so the bump back's effect (it's horizontal part) is almost instantly erased.
im so confused (and a little tired, it was late) i followed it exactly and when i jump on the enemies it says its been destroyed but the sprite and collisions are still there they haven't been cleared
Don't worry bro its a normal thing Expect that every time u start programming,every time there is going to be that one bug that will make you hit your head to the wall a lot of time to fix then when you find the reason, u will say how dumb I'm 😂😂😂😂😂😂it always happens to me 😂
For the health bar section it's printing that it's decreasing my health, but it is not counting down and it is not sending me back to the start of the level when I lose all my health
my problem is that the heart display on the level that i do it but when i'm on onther level when i touch the enemy it give me an error and quit the game out of bound get index '0' (on base; 'Array[Node]')
the y_delta is not fixed on the enemy but it change depends ont the postion on map so the code wont work with fixed numbers how can you help the first two enemy always work but the other whne i go down in map start to only show negative results on both side so it wont do the job it will always decrease health another thing dunno why the queuefree() aint working too
Spoko film, tylko brakuje mi tej rzeczy w prawym górnym rogu co pokazuje ile do nastęnego etapu :// (schociaż co ja narzekam patrząc na jakość moich filmów)
Could you possibly show how to keep scores over different levels? I get my pineapples counted, but then they don't continue for the next level. It would be a great help. And maybe adding ai to the enemies
can someone help figure out how to make the points not reset every scene? Ive been follwing this tutorial but no matter how much searching i cant find a clear answer of how to do it.
hello dev i did make a good progress with ur tutorials but i lost the game file from a trojan ransomware can u help me to remove (vepi) format from my file?
Don't know if this is worth a shot, but when I first introduced my enemies, they simply weren't appearing at all. I saved and reset Godot and suddenly now my enemies are here plane as day. Unfortunately, they appear to be bouncing on their heads for some reason... Little help? Best I might be able to do is just simply start over and see if that fixes the issues.
Part 2: Okay, I don't know why my enemies were standing on their heads when I loaded them, but I"m sure it had something to do with how I scaled them into the program. Funny thing is that they're right-side up in the editor, but upside down when I load the game. Short of just starting all over, I just flipped the image for now. I'm still learning, but getting the enemies to respond is more important for now. Even so some of the problems just seem to fix themselves, so I'm not too worried about it now. THanks
Yes its okay, i have the same. Its depending on where your level is. You can see it in the 2D Tab. If you Zoom in (left top corner a plus sign) you can see the values of the enemies on the X and Y position relatively clear.
I NEED HELP, whenever I load up level 1 the lives drain nonstop and i respawn 300 times per second, every line of code i have matches his as far as I can tell, if i remove the line that tells the game to respawn it works and if I switch the life counter from negative to positive the lives count up so he obviously doesn't respawn also works. but the live still instantly count up or down upon starting how to I make it to where they only count down when the player walks into the mushroom instead of the moment i spawn in.
12:40 I'm stuck at this point because the values for walking into the enemy and then jumping on top of the enemy are the same or at least really similar Here's my code: func _on_hit_box_area_entered(area): if area.get_parent() is Player: var y_delta = position.y - area.position.y print(y_delta) And then what it printed out: 143.92399597168 143.92399597168 btw I tried doing the body entered thing but it wasn't printing out any numbers. This was the only way I could get it to give a value
u would probably need to use on body entered instead, because the characterbody2d is inherited from the body instead of area, u should check out the signals too if it somehow not connected properly
Hey! Do you know why the function "jump_side" doesnt work for me? I copied that exact script but instead of doing a side jump, it does just a normal jump.
I had an issue with both running into and jumping on enemy "decreased player health" no matter what... Now even though i havent finished the tutorial yet, i believe i have a fix. And will update if i run into future problems. Heres the fix: FIX: In the video line 17 of the mushroom script ~~~ if (y_delta > 30): ~~~ was causing problems. You must flip the > to < to read as ~~~ if (y_delta < 30): ~~~ Hope this helps.
On 10:02 I'd usually prefer to do @export on the script and drag the scene file on the node inspector, this really helps to avoid breaking the path file if we decided to move around the mentioned scene. Oh yeah u would also need to use "change_scene_to_packed" instead for this one. Anyway, great video Coco! You've been helping me so much on my early gamedev project!!
I would love to see a tutorial with check points next! making a level with lots of holes on the ground and dying only for the game to restart might be quite annoying to some, is there a possibility that we get a checkpoint system in the next video?
Can someone help me because it doesn't let me play my project after I did the codings and it it only says that the "control" command doesn't support being use on a node, but it never tells me what I'm supposed to do
I notice you always change the texture filter from "inherit" to "nearest" : why not do it globally via the top menus? (the project settings, where you set the value it inherits from)
If your player becomes the mushroom, go to the player scene and check the idle animation, delete the mushroom sprites and import the ninja frog idle sprites. Then rename the mushroom's idle animation, because both the ninja frog and the mushroom have the name "Idle (32x32)".
I seem to be a little lost, I wrote the code that you had for figuring out the y_delta, and when doing so I get automatically closed out of the program and it tells me in the stack trace tab that there is invalid access to property or key 'position' on a bas object of type 'characterbody2d'... lol I feel like i have been stuck on this for hours and I have rewritten the code and looked over it multiple times, I think I am going crazy at this point.
@16:19 Why is this approach different to the player control jump/walk inputs? Why not write it like "input.is_action_just_pressed ("jump")" but create a "var esc_pressed instead?
A question for anyone who can answer: when hitting on my first enemy, i get a value of 5.etc, when jumping on it i get a value of -3.etc however this enemy is rather ight up on the map. an enemy directly under it (to the lower end of the map) gets a value of -400+ and when jumped on it gets a similar value. How do i fix
Nice tutorial series, but i would like to have the c# scripts, that would be nice! because i dont know how to implement the jump after killing an enemy and the side jump after getting damage in c#
hey coco code , i start creating games after founding your channel , i started also a youtube channel , any kinds of advices can you give me, such as how to edit my videos or how to make a tutorial series
Music in Different Areas with area2D and CollisionShape2 I am Currently developing a game for a projact at my university (simple 2D Topdown game). I have a map with 4 different areas. I want to change the background music as i enter the each area (area2D & CollisionShape2D). But i dont know how to do that. Could anyone help me?
Thx for the videos, they're super insightful! Quick question: at 08:04 - why not attach the script to collision child directly? Is it because the collision is a behavioral property of the "area 3D" and needs the latter to dictate what to collide with? I'm assuming it's like with world blocks - collision alone can't do much unless it has a parent to dictate what the object is colliding against.
Let's go, yes sir. Hey CocoCode can you do a gameover screen UI where you can restart from the gameover screen after you die in the levels. I'm doing that for my game but, I'm having serious trouble for implementing the feature, can you make a tutorial about it please.🙏
This is great tutorial, but there's a few weird things I've had to figure out on my own. Right now I'm trying to figure out why when touch an enemy to get damaged the character only gets knocked back if there is no input.
➡FREE Bonus lesson here: cococode.net/courses/godot-mega-tutorial?
- Double jump ⏫
- Background parallax 🌃
- and more!
19:45 Tried dragging the hearts, but they wouldn't show up.
Thank you very much for thoses videos i learned a lot !
I'm going to create my 1st godot platformer game next year, please continue this series. You're awesome at explaining & teaching.
Great video, but the bump back mechanic doesn't work correctly. If you run into an enemy and keep pressing the movement button, it will only bump you vertically. That's because the bump back sets your velocity.x at a certain value so you're thrown back, but having the movement button pressed simply resets that velocity.x to a different value.
So as it is now, this part only works if you stop pressing your movement button right as you hit the opponent, otherwise you just awkwardly jump up.
I the easiest way to fix it without changing lots of things is probably adding another variable telling if your running is disabled or not, disabling it as you hit the opponent and enabling it again after you hit the ground. The more complex solutions I can think of would require changing the running mechanics, so instead of setting a different velocity when your movement button is pressed, they add a bit of it (until it exceeds a certain threshold). Then when being bounced back and trying to move you'd only get pushed back less instead of nullifying it completely.
I was talking about this video, not the bonus lesson. I didn't watch it yet.
My issues with the bonus lesson:
1. It's not related to the lesson itself, but it's annoying - for some reason the video on the Coco Code site restarts every time the browser window is hidden (like when click to change to my Godot window for example). I put both my browser and Godot on separate monitors to solve the problem, otherwise I'd have to play the video again and set it to the right time every time I want to change something in my game. This issue happens at least on Firefox in Windows 11.
2. I'd recommend adding the "jump_count += 1" to the parts of code making us bounce back from the enemies when they damage us, otherwise it's possible to triple jump by getting hit and then jumping twice in the air. Unless we actually want that.
3. If we change the platforms to be smaller and and allow passing through them from the bottom in the TileMap's settings... it works, but it seems to only change it for the specific level. I think it'd work if I made the TileMap node into a scene earlier and placed the scene on the levels, but I didn't (since it wasn't mentioned). I can just change it by hand on both levels, but in big projects it'd probably be better to think of making such things into scenes early.
Visualizing the process with animations is considered a quality content in my book.
love your content. can't wait for more !
HECK YEAH! I have been waiting for this part!
Me too! I've been trying to make enemies forever and I can finally do it >:D
same
same here
if the code didnt work at 12:50 write: "if (y_delta > -30):" instead of "if (y_delta > 30):"
i think it will fixed
Sorry for commenting so late, but 8 month ago i asked for this video, thanks brother! Love ur videos they are the best❤
This is genuinely SO polished. It helped me more than those GDquest tutorials!
My code works well, but for some reason when I touch the enemy, I move up, but I don't get knocked along the x axis
same here if you find the fix lmk
same
have you found a solution by chance?
@@TimberLine534 nah
me too :(
Its been 7 months since i got off youtube just to wait for you, finally u dropped it
very very good, each step easily followable
Thanks for the feedback! I was afraid some of the sections might be harder to follow 😮💨
Thank you very much for this series of videos.
I am an indigenous person from Quebec, and with these videos, I will be able to create a small 2D platformer with legends from my ancestors to interest young people in their history.
I wish you a beautiful day.
May the Creator protect you, my friend.
That sounds amazing! Good luck on this and your future projects!
Pssst: Remember that you can access 4th video in the series here: cococode.net/courses/godot-mega-tutorial
Thank you so much! the bonus lesson was exactly what I needed. I was so frustrated by the extra parts of some tiles which the character's collision box always detected. but then your extra lesson helped me fix it.❤
Thanks! Glad you enjoyed it 🔥
YESSSS YESSS I LOVE YOU MAN.
YOU DONT KNOW HOW MUCH YOU HELPED ME
Omg yes I've been waiting for this part tysm I love your platformer series
Thanks man you are really helping me with my coding journey ❤🔥🔥
it's been so long finally
Is anyone facing the problem in which when we touch the enemy from the side,we donot go flying in the opposite direction if we are still pressing the movement keys?
Yes
It has to do with their hit boxes and also in the enemy script maybe lower the
"If (x_delta > 0) :" to a -1. Somewhere along those lines got it working for me
@@zpiks6729check my other comment
Yeah, but you didn't do anything wrong. This is a thing the video's author missed.
When you bump into an enemy, it sets your velocity.x to a certain value to move you back, but since your movement button is pressed, it also executes the line in the main character's script that resets its speed to "direction * speed", so the bump back's effect (it's horizontal part) is almost instantly erased.
this is so underrated man. I love your work and I wouldn't have gotten into coding if not for your tutorials.
finally after your last second godot video tutorial you made new best tutorial
Thank you, U helped me too much, Much love
thanks, im waiting for continuation
Yeah! finally
I needed this so bad
Heck I'm actually watching your 2nd tutorial right now for a project for school
Omg good job! Can’t wait for part 4
Thank you!
Be sure to check out the bonus video on cococode.net/courses/godot-mega-tutorial
im so confused (and a little tired, it was late) i followed it exactly and when i jump on the enemies it says its been destroyed but the sprite and collisions are still there they haven't been cleared
Don't worry bro its a normal thing
Expect that every time u start programming,every time there is going to be that one bug that will make you hit your head to the wall a lot of time to fix then when you find the reason, u will say how dumb I'm 😂😂😂😂😂😂it always happens to me 😂
When I start my game it starts with the pause screen and when I die the pause screen appears how do I fix it?
I was following you’re Gide and now my care Ther ceeps getting stuck bohind the background can’t eny one help me
I love you I watch you from egypt❤❤😂🎉
Thank you so much for doing this you might remember my comment on the last video
For the health bar section it's printing that it's decreasing my health, but it is not counting down and it is not sending me back to the start of the level when I lose all my health
I’ve been waiting for this for so long
my problem is that the heart display on the level that i do it but when i'm on onther level when i touch the enemy it give me an error and quit the game
out of bound get index '0' (on base; 'Array[Node]')
this game can export and make to play on phone?
the y_delta is not fixed on the enemy but it change depends ont the postion on map so the code wont work with fixed numbers how can you help
the first two enemy always work but the other whne i go down in map start to only show negative results on both side so it wont do the job it will always decrease health
another thing dunno why the queuefree() aint working too
Spoko film, tylko brakuje mi tej rzeczy w prawym górnym rogu co pokazuje ile do nastęnego etapu ://
(schociaż co ja narzekam patrząc na jakość moich filmów)
Oops 🙈
Remember to check out the video chapters for faster navigation 🏎️💨
Could you possibly show how to keep scores over different levels? I get my pineapples counted, but then they don't continue for the next level. It would be a great help. And maybe adding ai to the enemies
can someone help figure out how to make the points not reset every scene? Ive been follwing this tutorial but no matter how much searching i cant find a clear answer of how to do it.
Ur content has actually saved me for school
Very Good tutorial❤🎉
Hi, 17:57 my pause menu doesn't fit with my screen view when I launch the project and stay at the center of my scene. anyone ? :(
At enemies II I had a problem that the area 2d collision wouldn't collide with the player's and I think I tried everything. Can anyone please help!
👍
Can you make a video where you attack the enemy head on with a punch pressing on a certain key. Also the enemies to move around would be cool
19:45 Tried dragging the hearts, but they wouldn't show up.
hello dev
i did make a good progress with ur tutorials
but i lost the game file from a trojan ransomware
can u help me to remove (vepi) format from my file?
Don't know if this is worth a shot, but when I first introduced my enemies, they simply weren't appearing at all. I saved and reset Godot and suddenly now my enemies are here plane as day. Unfortunately, they appear to be bouncing on their heads for some reason... Little help? Best I might be able to do is just simply start over and see if that fixes the issues.
Part 2: Okay, I don't know why my enemies were standing on their heads when I loaded them, but I"m sure it had something to do with how I scaled them into the program. Funny thing is that they're right-side up in the editor, but upside down when I load the game. Short of just starting all over, I just flipped the image for now. I'm still learning, but getting the enemies to respond is more important for now.
Even so some of the problems just seem to fix themselves, so I'm not too worried about it now. THanks
YES!
Is it ok to have different values when colliding with the enemy? As when from the side I get -495 and the top -428.
Yes its okay, i have the same. Its depending on where your level is. You can see it in the 2D Tab. If you Zoom in (left top corner a plus sign) you can see the values of the enemies on the X and Y position relatively clear.
finallllllyyyyyyyyyyyyyyyyyyyyyy!!!!
Hey Coco Code? I have a question.
👋
@@CocoCode When I try to run my game it gives me the "Unable to initialize vulkan video driver" error... How Do I fix this? (Version 4.2.2 btw!!)
Very nice tutorial🎉😍
next part pls
In 12:55 there is an else error please help
I NEED HELP, whenever I load up level 1 the lives drain nonstop and i respawn 300 times per second, every line of code i have matches his as far as I can tell, if i remove the line that tells the game to respawn it works and if I switch the life counter from negative to positive the lives count up so he obviously doesn't respawn also works. but the live still instantly count up or down upon starting how to I make it to where they only count down when the player walks into the mushroom instead of the moment i spawn in.
Did U write the lives code inside
func _physics(delta)?
That might be running the code at every frame causing U die
i love you bro
10:11 Disclaimer please! Now i have to change the paths again :(
❤
yaaaaaaaaa
bro you can
pley my game
Man what happened to unity tutorials
Thanks so much you are the best!
Hell yeahh!! ❤️🩹
12:40 I'm stuck at this point because the values for walking into the enemy and then jumping on top of the enemy are the same or at least really similar
Here's my code:
func _on_hit_box_area_entered(area):
if area.get_parent() is Player:
var y_delta = position.y - area.position.y
print(y_delta)
And then what it printed out:
143.92399597168
143.92399597168
btw I tried doing the body entered thing but it wasn't printing out any numbers. This was the only way I could get it to give a value
u would probably need to use on body entered instead, because the characterbody2d is inherited from the body instead of area, u should check out the signals too if it somehow not connected properly
@@darilrafansyah5947 still not working
Edit: I figured it out eventually lol
@@darilrafansyah5947
19:45 Tried dragging the hearts, but they wouldn't show up.
actually the best godot tutorial , can you please show how to make attack animations and hitbox?
👍
Hey! Do you know why the function "jump_side" doesnt work for me? I copied that exact script but instead of doing a side jump, it does just a normal jump.
Do jump_slide
same problem here
@@Quick_Noise do jump_slide instead of jump_side
@@King-Sugaroo is jump_side a function built-in godot ?
@@Quick_Noise idk I just know that jump_slide works but jump_side doesn't so it must be
I had an issue with both running into and jumping on enemy "decreased player health" no matter what... Now even though i havent finished the tutorial yet, i believe i have a fix. And will update if i run into future problems. Heres the fix:
FIX:
In the video line 17 of the mushroom script ~~~ if (y_delta > 30): ~~~ was causing problems. You must flip the > to < to read as ~~~ if (y_delta < 30): ~~~
Hope this helps.
On 10:02 I'd usually prefer to do @export on the script and drag the scene file on the node inspector, this really helps to avoid breaking the path file if we decided to move around the mentioned scene.
Oh yeah u would also need to use "change_scene_to_packed" instead for this one.
Anyway, great video Coco! You've been helping me so much on my early gamedev project!!
Hey I love your videos man do you think you can make video on adding cutscenes in godot
maybe tutorial for how to add lucky blocks from mario? and power ups??
I would love to see a tutorial with check points next! making a level with lots of holes on the ground and dying only for the game to restart might be quite annoying to some, is there a possibility that we get a checkpoint system in the next video?
This guide is so helpful!
Can someone help me because it doesn't let me play my project after I did the codings and it it only says that the "control" command doesn't support being use on a node, but it never tells me what I'm supposed to do
I notice you always change the texture filter from "inherit" to "nearest" : why not do it globally via the top menus? (the project settings, where you set the value it inherits from)
Hey! I’m aware of this setting but I prefer to always mention it in order to avoid confusion from newcomers
I love your tutorials!
Thank you so much! 💙
Thanks very much. you are the best
really liked this video also and really excited to go to your website
help pls on 17:11 i tried it but it saying there is no comment as .show so what am i suppose to do?
Love your tutorials so much😭💯❤🔥❤🔥❤🔥❤🔥
If your player becomes the mushroom, go to the player scene and check the idle animation, delete the mushroom sprites and import the ninja frog idle sprites. Then rename the mushroom's idle animation, because both the ninja frog and the mushroom have the name "Idle (32x32)".
I seem to be a little lost, I wrote the code that you had for figuring out the y_delta, and when doing so I get automatically closed out of the program and it tells me in the stack trace tab that there is invalid access to property or key 'position' on a bas object of type 'characterbody2d'... lol I feel like i have been stuck on this for hours and I have rewritten the code and looked over it multiple times, I think I am going crazy at this point.
@16:19 Why is this approach different to the player control jump/walk inputs? Why not write it like "input.is_action_just_pressed ("jump")" but create a "var esc_pressed instead?
A question for anyone who can answer: when hitting on my first enemy, i get a value of 5.etc, when jumping on it i get a value of -3.etc however this enemy is rather ight up on the map. an enemy directly under it (to the lower end of the map) gets a value of -400+ and when jumped on it gets a similar value. How do i fix
Finally! I have been waiting for this for so long!
Nice tutorial series, but i would like to have the c# scripts, that would be nice! because i dont know how to implement the jump after killing an enemy and the side jump after getting damage
in c#
I was wondering if there would be a part 4 to this? and how do i make the enemy move? i tried a few ways but they didn't work
For some reason I can't get the touching to work properly
The health system work only in level 1 please give me a solution
i have a character that has an attack animation, how do i implement it into my game?
Now this is a Professor, i want more of this professors where buy them ?
There is no heart icon in that asset pack
literally the best tutorial ever!
Thanks ! Best tutorial
NEW DROPP!!!!
Big fan I watch all your tutorials and learn something new ❤❤❤❤😊😊
hey coco code , i start creating games after founding your channel , i started also a youtube channel , any kinds of advices can you give me, such as how to edit my videos or how to make a tutorial series
Please never stop these!! Can you make ladders or maybe even the ability to enter houses or text boxes??
Thank you! I'll try it 😊🎉
Music in Different Areas with area2D and CollisionShape2
I am Currently developing a game for a projact at my university (simple 2D Topdown game).
I have a map with 4 different areas.
I want to change the background music as i enter the each area (area2D & CollisionShape2D).
But i dont know how to do that.
Could anyone help me?
Can you please name another app for a hear
Thx for the videos, they're super insightful! Quick question: at 08:04 - why not attach the script to collision child directly? Is it because the collision is a behavioral property of the "area 3D" and needs the latter to dictate what to collide with? I'm assuming it's like with world blocks - collision alone can't do much unless it has a parent to dictate what the object is colliding against.
Let's go, yes sir. Hey CocoCode can you do a gameover screen UI where you can restart from the gameover screen after you die in the levels. I'm doing that for my game but, I'm having serious trouble for implementing the feature, can you make a tutorial about it please.🙏
This is great tutorial, but there's a few weird things I've had to figure out on my own. Right now I'm trying to figure out why when touch an enemy to get damaged the character only gets knocked back if there is no input.