![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | G3no_666 |
i dont know how to double jump using my specific code
here is the code i have
extends KinematicBody2d
var velocity = Vector2.ZERO
const SPEED = 210
const GRAVITY = 35
const JUMPFORCE = -1100
func _physics_process(delta):
if Input.is_action_pressed(“right”):
velocity.x = SPEED
$AnimatedSprite.play(“walk”)
$AnimatedSprite.flip_h = false
elif Input.is_action_pressed(“left”):
velocity.x = -SPEED
$AnimatedSprite.play(“walk”)
$AnimatedSprite.flip_h = false
else:
$AnimatedSprite.play(“idle”)
if not is_on_floor():
$AnimatedSprite.play("jump")
velocity.y = velocity.y + GRAVITY
if Input.is_action_just_pressed("jump") and is_on_floor():
velocity.y = JUMPFORCE
$SoundJump.play()
velocity = move_and_slide(velocity,Vector2.UP)
velocity.x = lerp(velocity.x,0,0.1)
func _on_fallzone_body_entered(body):
get_tree().change_scene(“res://level one.tscn”)