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.
 
 
 

54 lines
1.6 KiB

# Hero 4 stuns people at a distance, removing their linear velocity
extends "res://scripts/player.gd"
var stun_charge = 1
var velocity_charge = 10 # This one is instantaneous, so it gets quita weight
# --- Godot overrides ---
func _ready():
colored_meshes.append("Yaw/Pitch/Beam")
func _process(delta):
if is_network_master():
var stun = Input.is_action_pressed("hero_4_stun")
var is_stunning = false
if stun:
var players = get_node("/root/Level/Players").get_children()
var player = pick_from(players)
if player != -1:
# We get charge for just stunning, plus charge for how much linear velocity we cut out
switch_charge += stun_charge * delta
switch_charge += velocity_charge * players[player].get_linear_velocity().length() * delta
rpc("stun", players[player].get_name(), get_node("TPCamera/Camera/Ray").get_collision_point())
is_stunning = true
if not is_stunning:
rpc("unstun")
# --- Player overrides ---
# --- Own ---
sync func stun(net_id, position):
# Stun the thing!
var player = get_node("/root/Level/Players/%s" % net_id)
player.set_linear_velocity(Vector3())
# Show the beam!
var beam = get_node("Yaw/Pitch/Beam")
get_node("Yaw/Pitch").look_at(position, Vector3(0,1,0))
beam.show()
var us = get_node("TPCamera/Camera").get_global_transform().origin
var distance = position - us
beam.scale = Vector3(1,distance.length(),1)
# We move the beam up by half the scale because the position is based on the center, not the bottom
beam.translation.z = -distance.length() / 2 # We face -z direction
sync func unstun():
var beam = get_node("Yaw/Pitch/Beam")
beam.hide()