Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | omarkebrit |
extends KinematicBody2D
var motion = Vector2()
var dir = -1
func _ready():
pass
func _process(delta):
motion = move_and_slide(motion,Vector2.UP)
pass
func _physics_process(delta):
motion.x = 50 * dir
$AnimationPlayer.play(“move”)
if is_on_wall():
dir *= -1
$Sprite.flip_h = $Sprite.flip_h
if is_on_floor() == false:
motion.y += 10
pass
func _on_hitbox_body_entered(body):
if body.is_in_group(“player”):
queue_free()
pass