15 lines
332 B
GDScript3
15 lines
332 B
GDScript3
|
extends Control
|
||
|
|
||
|
func _input(event: InputEvent):
|
||
|
if event.is_action_pressed("zoom_in"):
|
||
|
zoom(true)
|
||
|
elif event.is_action_pressed("zoom_out"):
|
||
|
zoom(false)
|
||
|
|
||
|
const SCALE_FACTOR := 0.1
|
||
|
|
||
|
func zoom(direction: bool):
|
||
|
var scaleFactor := 1 + SCALE_FACTOR
|
||
|
if not direction:
|
||
|
scaleFactor = 1 - SCALE_FACTOR
|
||
|
$Board.scale *= scaleFactor
|