everything_has_a_price_jam/CameraMove.gd
2026-09-26 18:14:10 -06:00

37 lines
811 B
GDScript

extends Camera2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
var mouse: = get_viewport().get_mouse_position()
var size: = get_viewport().get_visible_rect().size
if (mouse.x < (0.10*size.x)):
position.x -= 3
elif (mouse.x > (0.90*size.x)):
position.x += 3
if (mouse.y < (0.10*size.y)):
position.y -= 3
elif (mouse.y > (0.90*size.y)):
position.y += 3
func _input(event):
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_WHEEL_UP and event.pressed:
zoom.x +=1
zoom.y +=1
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN and event.pressed:
zoom.x -=1
zoom.y -=1