A team game with an emphasis on movement (with no shooting), inspired by Overwatch and Zineth
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.

45 lines
1.2 KiB

  1. extends RigidBody
  2. var left = 0
  3. var right = 0
  4. var active = false
  5. var right_active = false
  6. var activation_margin = 0.1
  7. var build_rate = 1
  8. func _integrate_forces(state):
  9. var rot = get_rotation().x
  10. if active:
  11. activation_margin = 0
  12. if rot < -activation_margin:
  13. active = true
  14. right_active = false
  15. if rot > activation_margin:
  16. active = true
  17. right_active = true
  18. if active:
  19. if right_active:
  20. get_node("../HUD/LeftTeam").add_color_override("font_color_shadow", Color(0,0,0,0))
  21. get_node("../HUD/RightTeam").add_color_override("font_color_shadow", Color(1,0,0))
  22. else:
  23. get_node("../HUD/LeftTeam").add_color_override("font_color_shadow", Color(1,0,0))
  24. get_node("../HUD/RightTeam").add_color_override("font_color_shadow", Color(0,0,0,0))
  25. func _process(delta):
  26. if active:
  27. if right_active:
  28. right += delta * build_rate
  29. else:
  30. left += delta * build_rate
  31. if left >= 100:
  32. get_node("../HUD/Finish").set_text("Left wins!")
  33. Engine.set_time_scale(0.1)
  34. left = 100
  35. if right >= 100:
  36. get_node("../HUD/Finish").set_text("Left wins!")
  37. Engine.set_time_scale(0.1)
  38. right = 100
  39. get_node("../HUD/LeftTeam").set_text("%d%%" % left)
  40. get_node("../HUD/RightTeam").set_text("%d%%" % right)