Browse Source

Improve build_charge for neg values; use that

master
Luna 7 years ago
parent
commit
65452ced08
4 changed files with 9 additions and 5 deletions
  1. +1
    -1
      scripts/heroes/0.gd
  2. +1
    -1
      scripts/heroes/4.gd
  3. +1
    -1
      scripts/heroes/5.gd
  4. +6
    -2
      scripts/player.gd

+ 1
- 1
scripts/heroes/0.gd View File

@ -27,7 +27,7 @@ func control_player(state):
if get_node("MasterOnly/Boost").is_pressed() and switch_charge > cost:
walk_speed *= 2
air_accel *= 3
switch_charge -= cost
build_charge(-cost)
.control_player(state)
wallride(state)
walk_speed = original_speed


+ 1
- 1
scripts/heroes/4.gd View File

@ -36,7 +36,7 @@ func _process(delta):
destroy_ability.disabled = false
if Input.is_action_just_pressed("primary_ability"):
if switch_charge > looking_at.destroy_cost:
switch_charge -= looking_at.destroy_cost
build_charge(-looking_at.destroy_cost)
looking_at.rpc("destroy")
else:
destroy_ability.disabled = true


+ 1
- 1
scripts/heroes/5.gd View File

@ -31,7 +31,7 @@ func _process(delta):
get_node("MasterOnly/Crosshair").set_text(crosshair)
var can_build = switch_charge > portal_ability.cost
if placement.place_input(radius, can_build, true) and is_second:
switch_charge -= portal_ability.cost
build_charge(-portal_ability.cost)
teleport_ability.disabled = placement.placed.size() <= 1


+ 6
- 2
scripts/player.gd View File

@ -98,8 +98,6 @@ func _process(delta):
switch_charge = switch_charge_cap
switch_bar.value = switch_charge
switch_bar_extra.value = switch_charge - 100
# ... And it's network value
rset_unreliable("switch_charge", switch_charge)
# AI recording
if "record" in player_info:
@ -133,7 +131,13 @@ func build_charge(amount):
if obj.right_active != player_info.is_right_team and obj.active:
# Point against us (right active and left, or vice versa)
amount *= uncapped_advantage
else:
# Only build down to 0
amount = max(amount, -switch_charge)
switch_charge += amount
if is_network_master():
rset_unreliable("switch_charge", switch_charge)
return amount
sync func spawn():
emit_signal("spawn")


Loading…
Cancel
Save