summaryrefslogtreecommitdiff
path: root/Scenes/Entities/Bombs
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2023-12-28 09:07:41 +0100
committerDaniel Weipert <git@mail.dweipert.de>2023-12-28 09:07:41 +0100
commit96d36cee33d6321834565f0a5d412ef95c5ceffd (patch)
tree0dec02c5915cc154d48eef6ac9c2cd0be7df7982 /Scenes/Entities/Bombs
parent46556d864b9685c3b09a0038f5de83966fe7ff94 (diff)
next commit
Diffstat (limited to 'Scenes/Entities/Bombs')
-rw-r--r--Scenes/Entities/Bombs/Bomb.gd19
1 files changed, 18 insertions, 1 deletions
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