Public repository for MUR pre alpha
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB

  1. extends Spatial
  2. var player:Player
  3. onready var camera:InterpolatedCamera = get_node("camera")
  4. func _physics_process(delta):
  5. if is_network_master() && player != null:
  6. if player.is_out:
  7. camera.set_speed(0.1)
  8. if player.timer.get_time_left() > 0:
  9. get_node("hud/reset").set_text(str(int(player.timer.get_time_left()) + 1))
  10. else:
  11. get_node("hud/reset").set_text(tr("RESET"))
  12. if Input.is_action_pressed("controls_reset"):
  13. if player.reset():
  14. camera.set_speed(10)
  15. get_node("hud/reset").set_text("")
  16. else:
  17. if Input.is_action_pressed("controls_thrust"):
  18. player.thrust = 1
  19. elif Input.is_action_pressed("controls_break"):
  20. player.thrust = -1
  21. else:
  22. player.thrust = 0
  23. get_node("hud/speed").set_text(str(player.current_speed))
  24. if Input.is_action_pressed("debug_camera_1"):
  25. set_debug_camera(0)
  26. elif Input.is_action_pressed("debug_camera_2"):
  27. set_debug_camera(1)
  28. elif Input.is_action_pressed("debug_camera_3"):
  29. set_debug_camera(2)
  30. elif Input.is_action_pressed("debug_camera_4"):
  31. set_debug_camera(3)
  32. func set_player(path:String):
  33. player = get_node(path)
  34. get_node("inventory").set_player(player)
  35. camera.set_target_path(player.find_node("CameraTarget").get_path())
  36. camera.set_interpolation_enabled(true)
  37. camera.set_speed(10)
  38. func set_debug_camera(idx):
  39. if idx < gamestate.game.players.get_child_count():
  40. camera.set_target_path(gamestate.game.players.get_child(idx).find_node("CameraTarget").get_path())