15:11 Bonus: if you add the following line of code you can make your character do a wall jump too: if Input.is_action_just_pressed("jump") && is_on_wall(): velocity.y=-jump_force
Excellent video- exactly what I was looking for! I'm new to the engine and was wondering why move_and_slide() is called before gravity/jumping velocity calculations are done, instead of after, since it takes velocity as a parameter. Thanks again!
i typed everything like you did but when i try to jump it only jumps a very small height of the ground. it only jumps normally when moving to the left and jumping while moving. idk what the problem is
heres the code if your having trouble with it: extends KinematicBody2D onready var sprite = $Sprite onready var animation_player = $AnimationPlayer const MAX_HORIZONTAL_SPEED = 128 const MAX_FALL_SPEED = 128 const FRICTION_WEIGHT = 0.15 var input_vector = Vector2.ZERO var velocity = Vector2.ZERO var acceleration = 256 var jump_force = 128 var gravity = 256 func _physics_process(delta): # horinzontal movement
15:11 Bonus:
if you add the following line of code you can make your character do a wall jump too:
if Input.is_action_just_pressed("jump") && is_on_wall():
velocity.y=-jump_force
having trouble getting it to work
would be great if you could teach us how to make a simple 2d fighting game in godot :)
Thank you very much, waiting for basic tutorial 🔥
Great video. Waiting for the Tutorial)
thank you, it was a very helpful tutorial, please make more godot tutorials.
Your welcome, I will! Make sure to subscribe and ring the bell to get notified when I upload
Excellent video- exactly what I was looking for! I'm new to the engine and was wondering why move_and_slide() is called before gravity/jumping velocity calculations are done, instead of after, since it takes velocity as a parameter. Thanks again!
Np! Glad you liked it Robert
I just discovered you, your tutorials are amazing. Would you make videos about animation state machines and Godot shader.
Thanks a lot! I’m definitely going to create more tutorials about Godot, so stay tuned.
Thank you this was very helpful
i typed everything like you did but when i try to jump it only jumps a very small height of the ground. it only jumps normally when moving to the left and jumping while moving. idk what the problem is
Şahane bir anlatım tebrikleeeeeer👌🏻
Tesekkurler :)
This is fantastic - THX
Your welcome!
git repo?
Thank you!
You’re welcome!
Çok güzel olmuş
Perfectttt 🙏🏼😍
adam türk ama kimse bilmiyo adasdasd abi düşman nasıl yapılır anlatırmısın lütfen
Daha detaylı bir platformer serisi gelmek üzere
heres the code if your having trouble with it:
extends KinematicBody2D
onready var sprite = $Sprite
onready var animation_player = $AnimationPlayer
const MAX_HORIZONTAL_SPEED = 128
const MAX_FALL_SPEED = 128
const FRICTION_WEIGHT = 0.15
var input_vector = Vector2.ZERO
var velocity = Vector2.ZERO
var acceleration = 256
var jump_force = 128
var gravity = 256
func _physics_process(delta):
# horinzontal movement
input_vector.x = Input.get_action_strength("move_right") - Input.get_action_strength("move_left")
velocity.x += input_vector.x * delta * acceleration
# look in right dir
if input_vector.x == -1:
sprite.flip_h = true
elif input_vector.x == 1:
sprite.flip_h = false
# friction
if input_vector.x == 0:
velocity.x = lerp(velocity.x, 0, FRICTION_WEIGHT)
if abs(velocity.x) 0:
animation = "run"
if velocity.y < 0 && !is_on_floor():
animation = "jump"
if velocity.y > 0 && !is_on_floor():
animation = "fall"
animation_player.play(animation)