Work on pickups and multiplayer
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
class_name Projectile extends RigidBody3D
|
||||
class_name Projectile extends Area3D
|
||||
|
||||
var id : int = 0
|
||||
var direction : Vector3
|
||||
var speed : float
|
||||
var friend_safe : bool = true
|
||||
var damage
|
||||
var time_remaining : float
|
||||
func _ready() -> void:
|
||||
linear_velocity = speed * direction
|
||||
time_remaining = 2
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
global_position += speed * direction * delta
|
||||
time_remaining -= delta
|
||||
if time_remaining <= 0:
|
||||
queue_free()
|
||||
|
||||
func _on_body_entered(body: Node) -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
|
||||
func _on_hit_area_entered(body: Node3D) -> void:
|
||||
if body is PawnController:
|
||||
body.hurt(damage)
|
||||
if !friend_safe or id != body.id:
|
||||
body.hurt(damage)
|
||||
queue_free()
|
||||
else:
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user