feat: add Rocket Swarm, Mortar, and BouncingProjectile weapon types
This commit is contained in:
@@ -2,6 +2,7 @@ extends ExplosiveProjectile
|
|||||||
class_name BouncingProjectile
|
class_name BouncingProjectile
|
||||||
|
|
||||||
var fuse_time: float = -1.0 # -1 means no fuse started yet
|
var fuse_time: float = -1.0 # -1 means no fuse started yet
|
||||||
|
var bounce_fuse_delay: float = 3.0 # How long to wait after bouncing
|
||||||
var impact_detonate_time: float = 2.0
|
var impact_detonate_time: float = 2.0
|
||||||
var bounciness: float = 0.4
|
var bounciness: float = 0.4
|
||||||
var flight_time: float = 0.0
|
var flight_time: float = 0.0
|
||||||
@@ -41,7 +42,7 @@ func _physics_process(delta: float) -> void:
|
|||||||
|
|
||||||
# Start the fuse if it hasn't started
|
# Start the fuse if it hasn't started
|
||||||
if fuse_time < 0.0:
|
if fuse_time < 0.0:
|
||||||
fuse_time = 3.0 # Explode 3 seconds after the first bounce
|
fuse_time = bounce_fuse_delay
|
||||||
|
|
||||||
# If it hits an entity directly, still bounce, it's a heavy mortar shell!
|
# If it hits an entity directly, still bounce, it's a heavy mortar shell!
|
||||||
else:
|
else:
|
||||||
|
|||||||
+2
-1
@@ -68,7 +68,8 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
|||||||
proj.owner_player = player
|
proj.owner_player = player
|
||||||
|
|
||||||
# Mortar Bouncing logic
|
# Mortar Bouncing logic
|
||||||
proj.fuse_time = 3.0 # Explodes 3 seconds after launch if it bounces
|
proj.fuse_time = -1.0 # Don't start ticking until it bounces
|
||||||
|
proj.bounce_fuse_delay = 3.0 # Explodes 3 seconds after first bounce
|
||||||
proj.impact_detonate_time = 2.0 # If flying > 2s, explode on impact instead
|
proj.impact_detonate_time = 2.0 # If flying > 2s, explode on impact instead
|
||||||
proj.bounciness = 0.4 # Heavy, loses momentum on bounce
|
proj.bounciness = 0.4 # Heavy, loses momentum on bounce
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ func _spawn_custom_projectile(origin: Vector3, fire_dir: Vector3) -> void:
|
|||||||
|
|
||||||
# Logic
|
# Logic
|
||||||
proj.weapon_source = self
|
proj.weapon_source = self
|
||||||
proj.turn_speed = 12.0 # Faster turn radius so they can aggressively home in
|
proj.turn_speed = 4.0 # Slower turn radius so they sweep nicely
|
||||||
|
|
||||||
proj.position = origin # Start at origin to spread outward around camera
|
proj.position = origin # Start at origin to spread outward around camera
|
||||||
proj.logical_source = origin
|
proj.logical_source = origin
|
||||||
|
|||||||
Reference in New Issue
Block a user