made tracker gun

This commit is contained in:
Derek
2024-11-24 16:27:48 -06:00
parent 05b8c0d760
commit 0312da48b8
21 changed files with 1008 additions and 242 deletions

View File

@@ -13,8 +13,9 @@ var bounces = 0
var start_time
var end_time
const EMISSION_MAX : float = 20
const EMISSION_LIFETIME : float = 2 #in seconds
const EMISSION_MAX : float = 200
const EMISSION_LIFETIME : float = 1.75 #in seconds
const VELOCITY_REQUIRED_TO_HIT : float = 10
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
@@ -38,21 +39,11 @@ func _on_body_entered(body: Node) -> void:
if bounces >= max_bounces:
despawn()
if body != null and !body.is_in_group("player"):
if body.is_in_group("enemy_target"):
SignalBus.emit_signal("enemy_hit")
body.hit(bullet_damage)
if body != null and !body.is_in_group("player") and linear_velocity.length() >= VELOCITY_REQUIRED_TO_HIT:
if body.is_in_group("switch"):
body.hit()
#move rigidbodies
if body.is_in_group("scene_rigidbody"):
body.linear_velocity += transform.basis * Vector3(0,0,-1 * bullet_force_mod)
if body.is_in_group("breakable"):
var current_velocity = transform.basis * Vector3(0,0,-1 * bullet_force_mod)
body.breaking(current_velocity)