Added level mods and updated sprite imports

This commit is contained in:
Nathan Anderson
2022-08-04 18:05:48 -06:00
parent 417044bfda
commit 7843bf2b8d
19 changed files with 288 additions and 114 deletions
+10 -5
View File
@@ -9,8 +9,10 @@ export var FRICTION := 2000
var player_velocity = Vector2.ZERO
var state = State.IDLE
var follower : KinematicBody2D
var leader := self
onready var sprite := $AnimatedSprite
onready var chevron_sprite := $ChevronSprite
enum State {
MOVE,
@@ -21,11 +23,14 @@ enum State {
func _physics_process(delta: float) -> void:
match state:
State.MOVE:
move_state(delta)
_move_state(delta)
State.IDLE:
idle_state(delta)
func move_state(delta: float) -> void:
_idle_state(delta)
chevron_sprite.visible = follower != null
if follower != null:
chevron_sprite.rotation_degrees = rad2deg((follower.house_position - global_position).angle()) - 90
func _move_state(delta: float) -> void:
var input_vector := Vector2.ZERO
input_vector.x = Input.get_action_strength("ui_right") - Input.get_action_strength("ui_left")
input_vector.y = Input.get_action_strength("ui_down") - Input.get_action_strength("ui_up")
@@ -47,7 +52,7 @@ func move_state(delta: float) -> void:
if player_velocity == Vector2.ZERO:
state = State.IDLE
func idle_state(delta: float) -> void:
func _idle_state(delta: float) -> void:
if Input.is_action_just_pressed("ui_up") or Input.is_action_just_pressed("ui_down") or Input.is_action_just_pressed("ui_left") or Input.is_action_just_pressed("ui_right"):
sprite.set_animation("run")
state = State.MOVE