feat: Implement core game mechanics including player, enemies, bullets, HUD, and level setup.
This commit is contained in:
24
scripts/camera_zoom.gd
Normal file
24
scripts/camera_zoom.gd
Normal file
@@ -0,0 +1,24 @@
|
||||
extends Camera2D
|
||||
|
||||
@export var zoom_speed: float = 0.5
|
||||
@export var min_zoom: float = 1.0
|
||||
@export var max_zoom: float = 5.0
|
||||
@export var zoom_smoothing: float = 10.0
|
||||
|
||||
var target_zoom: Vector2
|
||||
|
||||
func _ready():
|
||||
target_zoom = zoom
|
||||
|
||||
func _process(delta):
|
||||
zoom = zoom.lerp(target_zoom, zoom_smoothing * delta)
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseButton:
|
||||
if event.is_pressed():
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||
target_zoom += Vector2(zoom_speed, zoom_speed)
|
||||
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
target_zoom -= Vector2(zoom_speed, zoom_speed)
|
||||
|
||||
target_zoom = target_zoom.clamp(Vector2(min_zoom, min_zoom), Vector2(max_zoom, max_zoom))
|
||||
Reference in New Issue
Block a user