44 lines
1,012 B
GDScript
44 lines
1,012 B
GDScript
extends Character
|
|
|
|
class_name PlayerHEHEHE;
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
print(get_tree().root);
|
|
pass
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
other_input();
|
|
move(get_direction_input())
|
|
|
|
|
|
func get_direction_input() -> Globals.Direction:
|
|
var direction : Globals.Direction;
|
|
if Input.is_action_just_pressed("GoRight"):
|
|
direction = Globals.Direction.RIGHT;
|
|
elif Input.is_action_just_pressed("GoDown"):
|
|
direction = Globals.Direction.DOWN;
|
|
elif Input.is_action_just_pressed("GoLeft"):
|
|
direction = Globals.Direction.LEFT;
|
|
elif Input.is_action_just_pressed("GoUp"):
|
|
direction = Globals.Direction.UP;
|
|
else:
|
|
direction = Globals.Direction.NONE;
|
|
|
|
|
|
return direction;
|
|
|
|
|
|
|
|
|
|
|
|
func other_input() -> void:
|
|
if Input.is_action_just_pressed("Replay"):
|
|
get_tree().reload_current_scene()
|
|
|
|
|
|
|
|
func _on_end_area_entered(area: Area2D) -> void:
|
|
GameManager.next_level();
|