base_level.gd 456 B

123456789101112131415161718
  1. extends Node2D
  2. @onready var camera : Camera2D = $Camera2D
  3. func _ready() -> void:
  4. EventBus.player_changed_room.connect(move_camera)
  5. func move_camera(new_position : Vector2) -> void:
  6. camera.position = new_position
  7. func _unhandled_key_input(event: InputEvent) -> void:
  8. var key = (event as InputEventKey).keycode
  9. if key == KEY_R:
  10. SceneManager.change_to_scene("CURRENT")
  11. elif key == KEY_B:
  12. SceneManager.change_to_scene(SceneManager.level_select)