Added level 1, base-level to abstract from, and level-controller

This commit is contained in:
Nathan Anderson
2022-08-05 17:15:17 -06:00
parent c95b9f9928
commit 77386f7af6
42 changed files with 985 additions and 531 deletions
+12 -8
View File
@@ -13,13 +13,23 @@ var leader := self
onready var sprite := $AnimatedSprite
onready var chevron_sprite := $ChevronSprite
onready var camera := $Camera2D
onready var gui := $GUI
enum State {
MOVE,
IDLE
}
func set_camera_bounds(up: int, down: int, left: int, right: int):
camera.set_limit(MARGIN_TOP, up)
camera.set_limit(MARGIN_BOTTOM, down)
camera.set_limit(MARGIN_LEFT, left)
camera.set_limit(MARGIN_RIGHT, right)
func _process(delta: float) -> void:
gui.global_position = camera.get_camera_screen_center() - Vector2(get_viewport().get_visible_rect().size.x / 2, get_viewport().get_visible_rect().size.y / 2) # Get Height)
func _physics_process(delta: float) -> void:
match state:
State.MOVE:
@@ -28,6 +38,8 @@ func _physics_process(delta: float) -> void:
_idle_state(delta)
chevron_sprite.visible = follower != null
if follower != null:
if follower.name == "Trolley":
chevron_sprite.set_modulate(Color(0,0.9,0))
chevron_sprite.rotation_degrees = rad2deg((follower.house_position - global_position).angle()) - 90
func _move_state(delta: float) -> void:
@@ -58,11 +70,3 @@ func _idle_state(delta: float) -> void:
state = State.MOVE
else:
sprite.set_animation("idle")
# if Input.is_action_pressed("ui_up"):
# speed.y -= ACCELERATION
# elif Input.is_action_pressed("ui_right"):
# print("right")
# elif Input.is_action_pressed("ui_left"):
# print("left")
# elif Input.is_action_pressed("ui_down"):
# print("down")