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.

49 lines
1.5 KiB

  1. extends "res://scripts/player.gd"
  2. onready var placement = preload("res://scripts/placement.gd").new(self, "res://scenes/heroes/1_wall.tscn")
  3. onready var place_wall_ability = get_node("MasterOnly/PlaceWall")
  4. export var looked_at_charge_suck = 25 # charge / sec
  5. # --- Godot overrides ---
  6. func _ready():
  7. placement.start_action = "hero_1_place_wall"
  8. placement.confirm_action = "hero_1_confirm_wall"
  9. placement.delete_action = "hero_1_remove_wall"
  10. placement.max_placed = 5
  11. func _process(delta):
  12. if is_network_master():
  13. var can_build = switch_charge > place_wall_ability.cost
  14. if can_build:
  15. if placement.place_input():
  16. build_charge(-place_wall_ability.cost)
  17. func _exit_tree():
  18. ._exit_tree()
  19. if placement:
  20. placement.clear()
  21. # --- Player overrides ---
  22. func spawn():
  23. .spawn()
  24. if placement:
  25. placement.clear()
  26. # --- Own ---
  27. # Passive: suck the charge out of people who look at us!
  28. # This is a special method called by player when any object is looked at
  29. func on_looked_at(who, delta):
  30. # Why do we check this if we can't look at ourselves? Walls call this method from their looked_at
  31. # Also, why not use util.is_friendly? Because we're not master, we're slave (looker is master)
  32. if who.player_info.is_right_team != player_info.is_right_team:
  33. var subtracted = who.build_charge(-looked_at_charge_suck * delta)
  34. build_charge(-subtracted)
  35. # We rset our switch_charge because otherwise it won't be acknowledged
  36. # because we're not master
  37. # The *PICKER* is master, we're slave! Well, let's flip that for a mo'
  38. rset("switch_charge", switch_charge)