forked from unfa/liblast
Added score based on kill count
parent
e8ce94ed61
commit
abf9f5af5c
|
@ -1,7 +1,7 @@
|
|||
extends Spatial
|
||||
|
||||
var first = true
|
||||
var velocity = 200
|
||||
var velocity = 350
|
||||
|
||||
const bullet_hit = preload("res://Assets/Effects/BulletHit.tscn")
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ sync func play():
|
|||
player.pitch_scale = PitchScale + rand_range(-RandomizePitch /2, RandomizePitch/2)
|
||||
else:
|
||||
player.pitch_scale = PitchScale
|
||||
|
||||
|
||||
player.play()
|
||||
|
||||
ready = false
|
||||
|
|
|
@ -295,23 +295,31 @@ func fall(delta):
|
|||
|
||||
was_on_floor = is_on_floor()
|
||||
|
||||
sync func on_damage_dealt(damage, target, is_kill):
|
||||
if is_kill:
|
||||
player_stats.score += 1
|
||||
game.get_node("PlayerListContainer").update_player_list()
|
||||
|
||||
master func on_hit(damage, location):
|
||||
set_health(health - 30)
|
||||
master func on_hit(damage, location, source):
|
||||
set_health(health - damage)
|
||||
|
||||
rpc("blood_splatter", location)
|
||||
|
||||
|
||||
var source_player = get_parent().get_node(source)
|
||||
|
||||
if health <= 0:
|
||||
rpc("kill")
|
||||
kill()
|
||||
source_player.rpc("on_damage_dealt", damage, self.name, true)
|
||||
else:
|
||||
$Sounds/Pain.rpc("play")
|
||||
source_player.rpc("on_damage_dealt", damage, self.name, false)
|
||||
|
||||
sync func blood_splatter(location):
|
||||
var effect = bodyHitEffect.instance()
|
||||
get_tree().root.add_child(effect)
|
||||
effect.global_transform.origin = location
|
||||
|
||||
master func kill():
|
||||
func kill():
|
||||
if is_dead:
|
||||
return
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ func shoot(camera):
|
|||
var hit = result.collider
|
||||
|
||||
if hit.has_method("on_hit"):
|
||||
hit.rpc("on_hit", 30, result.position)
|
||||
hit.rpc("on_hit", 30, result.position, player.name)
|
||||
|
||||
if hit is Player:
|
||||
var kill = true if hit.health <= 0 else false
|
||||
|
|
Loading…
Reference in New Issue