Browse Source

Adding ability to reset zoom

master
Ryan Reed 1 year ago
parent
commit
0d39ee63ee
2 changed files with 7 additions and 0 deletions
  1. +5
    -0
      project.godot
  2. +2
    -0
      world.gd

+ 5
- 0
project.godot View File

@ -46,3 +46,8 @@ Menu={
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":45,"key_label":0,"unicode":45,"echo":false,"script":null) , Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":45,"key_label":0,"unicode":45,"echo":false,"script":null)
] ]
} }
"Reset Zoom"={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"echo":false,"script":null)
]
}

+ 2
- 0
world.gd View File

@ -69,6 +69,8 @@ func _input(event: InputEvent) -> void:
camera.zoom += zoom_increment camera.zoom += zoom_increment
if event.is_action_pressed("Zoom Out"): if event.is_action_pressed("Zoom Out"):
camera.zoom -= zoom_increment camera.zoom -= zoom_increment
if event.is_action_pressed("Reset Zoom"):
camera.zoom = Vector2.ONE
# #


Loading…
Cancel
Save