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.

36 lines
1022 B

  1. extends StaticBody
  2. var maker_node
  3. var touch_charge = 4
  4. var being_touched = 0
  5. func init(maker, color):
  6. maker_node = maker
  7. for player in get_node("/root/Level/Players").get_children():
  8. player.connect("body_entered", self, "count_bodies", [player, 1])
  9. player.connect("body_exited", self, "count_bodies", [player, -1])
  10. var mat = SpatialMaterial.new()
  11. color.a = 0.5
  12. mat.flags_transparent = true
  13. mat.albedo_color = color
  14. get_node("MeshInstance").set_surface_material(0, mat)
  15. func place():
  16. # Originally, the wall is disabled to avoid weird physics
  17. get_node("CollisionShape").disabled = false
  18. get_node("MeshInstance").get_surface_material(0).flags_transparent = false
  19. func make_last():
  20. var mat = get_node("MeshInstance").get_surface_material(0)
  21. mat.flags_transparent = true
  22. mat.albedo_color.a = 0.9
  23. func count_bodies(with, player, delta):
  24. if with == self:
  25. if player != maker_node:
  26. being_touched += delta
  27. func _process(delta):
  28. if being_touched > 0:
  29. maker_node.switch_charge += touch_charge * delta