Changed resource spawning

added interact functionality
temp added zoom with scroll wheel
This commit is contained in:
2024-02-27 10:21:28 -06:00
parent 5467e044a7
commit f87b1cfa9a
17 changed files with 163 additions and 41 deletions

View File

@@ -7,6 +7,7 @@ var last_direction = 0
var interaction_location: Vector2i
@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var interaction_timer: Timer = $InteractionTimer
func _physics_process(delta: float) -> void:
var input_direction := Input.get_vector("ui_left", "ui_right", "ui_up", "ui_down")
@@ -14,6 +15,7 @@ func _physics_process(delta: float) -> void:
move_and_slide()
if input_direction:
animation_player.current_animation = "walk"
animation_player.play()
last_direction = input_direction.angle() + 3 * PI / 2
rotation = last_direction
@@ -24,4 +26,16 @@ func _physics_process(delta: float) -> void:
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_accept"):
print("Interacted with: %s" % Grid.get_location_data(interaction_location))
Grid.get_location_data(interaction_location).interact(interaction_timer)
print("interaction started")
func _finished_interaction(results: Dictionary) -> void:
print("interaction finished: %s" % results)
func _unhandled_input(event):
if event is InputEventMouseButton:
match event.button_index:
MOUSE_BUTTON_WHEEL_DOWN:
$Camera2D.zoom -= Vector2(0.01, 0.01)
MOUSE_BUTTON_WHEEL_UP:
$Camera2D.zoom += Vector2(0.01, 0.01)