|
|
@ -1,9 +1,8 @@ |
|
|
|
extends Node2D |
|
|
|
extends Camera2D |
|
|
|
|
|
|
|
@export var zoom_increment: Vector2 = Vector2(0.1, 0.1) |
|
|
|
@export var move_speed: int = 250 |
|
|
|
|
|
|
|
@onready var camera: Camera2D = $Camera2D |
|
|
|
@export var move_speed: int = 250 |
|
|
|
@export var zoom_increment: Vector2 = Vector2(0.1, 0.1) |
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> void: |
|
|
@ -14,13 +13,9 @@ func _process(delta: float) -> void: |
|
|
|
position += Vector2(velocity_x, velocity_y) |
|
|
|
|
|
|
|
func _unhandled_input(event: InputEvent) -> void: |
|
|
|
if event.is_action_pressed("Reset Zoom"): |
|
|
|
zoom = Vector2.ONE |
|
|
|
if event.is_action_pressed("Zoom In"): |
|
|
|
camera.zoom += zoom_increment |
|
|
|
zoom += zoom_increment |
|
|
|
if event.is_action_pressed("Zoom Out"): |
|
|
|
camera.zoom -= zoom_increment |
|
|
|
if event.is_action_pressed("Reset Zoom"): |
|
|
|
camera.zoom = Vector2.ONE |
|
|
|
|
|
|
|
|
|
|
|
func update_position(pos: Vector2) -> void: |
|
|
|
camera.position = pos |
|
|
|
zoom -= zoom_increment |