Files
chaussette.sale/joueur.gd
Thomas fe463ad396 Initial commit
Un bout de jeu, qui fait pas grand chose mais on progresse.
2025-02-21 17:59:47 +01:00

21 lines
647 B
GDScript

class_name Player
extends CharacterBody2D
@export var speed = 450 # How fast the player will move (pixels/sec).
@export var direction = "down";
@export var verb = "idling";
@export var wants_to_grab = false;
@onready var state_machine := $AnimationTree.get("parameters/playback") as AnimationNodeStateMachinePlayback
func get_input():
wants_to_grab = Input.is_action_pressed("grab");
if state_machine.get_current_node() == "grabing":
velocity = Vector2(0,0);
else:
velocity = Input.get_vector("move_left", "move_right", "move_up", "move_down") * speed
func _physics_process(delta):
get_input()
# using move_and_slide
move_and_slide()