adding all slides
This commit is contained in:
parent
44328e3a2d
commit
575eaa9b31
10 changed files with 310 additions and 110 deletions
21
rug_player.gd
Normal file
21
rug_player.gd
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue