- Edited
extends KinematicBody2D
var velocity = Vector2()
export var direction = -1
func _ready():
if direction == -1:
$AnimatedSprite.flip_h = true
func _physics_process(delta):
if is_on_wall():
direction = direction * -1
$AnimatedSprite.flip_h = not $AnimatedSprite.flip_h
velocity.y += 10
velocity.x += 25 * direction
velocity = move_and_slide(velocity,Vector2.UP)