mtd/PCs/Mechanic/ClassCards/BombLauncher/bomb_projectile.gd

20 lines
459 B
GDScript3
Raw Normal View History

2024-02-22 06:22:22 +11:00
class_name BombProjectile extends ExplosiveProjectile
2024-02-22 06:22:22 +11:00
var max_bounces: int = 1
var bounces: int = 0
func _ready() -> void:
apply_central_impulse(direction.normalized() * force)
#print(direction.length())
#print(force)
if owner_id == 0:
max_bounces = 0
func _on_body_entered(_body: Node) -> void:
bounces += 1
2024-02-22 06:22:22 +11:00
var collided_body: bool = get_colliding_bodies()[0].get_collision_layer_value(3)
if bounces > max_bounces or collided_body:
explode()