Top Down Survival Shooter In Godot | Part 2 - Player Movement
HTML-код
- Опубликовано: 1 июн 2024
- Learn how to make a game from scratch in Godot. This survival shooter will be a top down game with 8 directional movement. Endless waves of enemies attack the player with each wave getting more and more difficult.
In this part, I focus on creating the player and adding 8 directional movement.
Explanation of 8 directional movement by kidscancode here: kidscancode.org/godot_recipes...
Code and assets for this video: github.com/russs123/Prairie_K...
Credits for images
Character: axulart.itch.io/small-8-direc...
Goblins: 0x72.itch.io/dungeontileset-ii
Tileset: cupnooble.itch.io/sprout-land...
Pistol: arcadeisland.itch.io/guns-ass...
Coffee: skalding.itch.io/coffee-cup-001
Finally!!! Thanks Russ! Can't wait for part 3!! Please do make a platformer tutorial like Coco code did!! You two are the best at explaining and are my favorite teachers!!
You are truly the best, you don't know how much I love you. ❤
Love your videos, very informative
9:11 - I'm confused. We use position variable that we didn't declare previously. Same with velocity.
These variables are part of the CharacterBody2D Node already. When the script is created, the first line is "extends CharacterBody2D" and what this means is that the script can use all the functions and variables that are part of that Node. That includes the position and velocity variables. Hope that helps!
Yes, thank you. That explained enough to understand what's going on
Keep it up!🤩
So with the input_dir variable it doesn't actually need to be normalized. Part of the Input.getvector function is that it does do that for you. I saw this as strange and so I checked the numbers (not just with the eye test). And the velocity was indeed normalized be itself.
For added thought though I add the normalized function onto input_dir and low and behold, the result came back the same so its not hurting anything if its there, its just not needed.🙂
Ah that's handy to know! Thanks for checking it 🙂
Love your channel. 2 questions if I may: 1) Why you picked Godot for it? 2) What do you think the best language/engine to make light 2d games?
godot is best for small and large 2d games unity good for 2d games and smaller 3d games unreal good for large 3d games
Viewport rect size function doesn't work for me, it doesn't start my scene from point 0,0 so i can't get near the east and northern gaps. Any idea what's wrong?
very good😍
I was the First to like🎉🎉🎉
Please make it survival io style, like this a rougelike
var mouse_position= get_local_mouse_position()
var angle = rad_to_deg(atan2(mouse_position.x , mouse_position.y))
if angle > -22.5 and angle < 22.5:
$AnimatedSprite2D.play("walk_D")
elif angle > 22.5 and angle < 67.5:
$AnimatedSprite2D.play("walk_DR")
elif angle > -67.5 and angle < -22.5:
$AnimatedSprite2D.play("walk_DL")
elif angle < -157.5 or angle > 157.5:
$AnimatedSprite2D.play("walk_U")
elif angle > 112.5 and angle < 157.5:
$AnimatedSprite2D.play("walk_UR")
elif angle > -157.5 and angle < -112.5:
$AnimatedSprite2D.play("walk_UL")
elif angle < 112.5 and angle > 67.5:
$AnimatedSprite2D.play("walk_R")
elif angle > -112.5 and angle < -67.5:
$AnimatedSprite2D.play("walk_L")
if velocity.length() == 0:
$AnimatedSprite2D.stop()
$AnimatedSprite2D.frame= 1
This is what i did