Initial commit
Un bout de jeu, qui fait pas grand chose mais on progresse.
This commit is contained in:
20
joueur.gd
Normal file
20
joueur.gd
Normal file
@@ -0,0 +1,20 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user