adding all slides

This commit is contained in:
Eefschmeef2310 2024-09-27 00:44:53 +10:00
parent 44328e3a2d
commit 575eaa9b31
10 changed files with 310 additions and 110 deletions

21
rug_player.gd Normal file
View file

@ -0,0 +1,21 @@
extends CharacterBody2D
@export var SPEED = 100.0
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
func _physics_process(_delta: float) -> void:
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction := Vector2(Input.get_axis("left", "right"), Input.get_axis("up", "down"))
if direction:
velocity = direction * SPEED
if direction.x != 0:
animated_sprite_2d.flip_h = direction.x >= 0
animated_sprite_2d.play("default")
else:
animated_sprite_2d.play("idle")
velocity.x = move_toward(velocity.x, 0, SPEED)
velocity.y = move_toward(velocity.y, 0, SPEED)
move_and_slide()