From 96d36cee33d6321834565f0a5d412ef95c5ceffd Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Thu, 28 Dec 2023 09:07:41 +0100 Subject: next commit --- Scenes/Entities/Bombs/Bomb.gd | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Scenes/Entities/Bombs') diff --git a/Scenes/Entities/Bombs/Bomb.gd b/Scenes/Entities/Bombs/Bomb.gd index 96a5e62..3981122 100644 --- a/Scenes/Entities/Bombs/Bomb.gd +++ b/Scenes/Entities/Bombs/Bomb.gd @@ -7,8 +7,18 @@ signal body_exited signal exploded +enum COMPONENT_TYPE { + BREAKBLE, + REMOTE_CONTROL, + REMOTE_DETONATE, + WATER, + SALT, +} + + var Explosion = preload("res://Scenes/Entities/Bombs/Explosion.tscn") -var power = 2 +var power: int = 2 +var components: Array[COMPONENT_TYPE] = [] func _ready(): @@ -19,6 +29,8 @@ func _ready(): collision_area.connect("body_exited", Callable(self, "_body_exited")) add_child(collision_area) + self.components = Global.player.bomb_components + $AnimatedSprite2D.play() @@ -31,6 +43,8 @@ func _process(delta): func explode(): $CollisionShape2D.disabled = true + Input.start_joy_vibration(0, 0.5, 0.75, 0.1) + # explode on the spot var explosion = self.spawn_explosion(self.global_position) @@ -158,6 +172,9 @@ func _on_collide_group_bombs(): func _on_collide_group_breakables(): + if self.components.has(COMPONENT_TYPE.BREAKBLE): + return EXPLOSION_COLLISION_TYPE.HIT_CONTINUE + return EXPLOSION_COLLISION_TYPE.HIT_STOP -- cgit v1.2.3