diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2023-12-28 09:07:41 +0100 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2023-12-28 09:07:41 +0100 |
commit | 96d36cee33d6321834565f0a5d412ef95c5ceffd (patch) | |
tree | 0dec02c5915cc154d48eef6ac9c2cd0be7df7982 /Scenes | |
parent | 46556d864b9685c3b09a0038f5de83966fe7ff94 (diff) |
next commit
Diffstat (limited to 'Scenes')
-rw-r--r-- | Scenes/Components/SceneTransition.gd | 1 | ||||
-rw-r--r-- | Scenes/Entities/Bombs/Bomb.gd | 19 | ||||
-rw-r--r-- | Scenes/Entities/Objects/Coin.gd | 2 | ||||
-rw-r--r-- | Scenes/Entities/Player.gd | 156 | ||||
-rw-r--r-- | Scenes/Entities/Player.tscn | 5 | ||||
-rw-r--r-- | Scenes/Global.gd | 1 | ||||
-rw-r--r-- | Scenes/Maps/Map.gd | 1 | ||||
-rw-r--r-- | Scenes/Maps/World.tscn | 14 | ||||
-rw-r--r-- | Scenes/Maps/World2.tscn | 49 | ||||
-rw-r--r-- | Scenes/UI/HealthBar.gd | 2 | ||||
-rw-r--r-- | Scenes/UI/Menu.gd | 27 | ||||
-rw-r--r-- | Scenes/UI/Menu.tscn | 84 | ||||
-rw-r--r-- | Scenes/Utilities.gd | 14 |
13 files changed, 302 insertions, 73 deletions
diff --git a/Scenes/Components/SceneTransition.gd b/Scenes/Components/SceneTransition.gd index ee01938..befeaf4 100644 --- a/Scenes/Components/SceneTransition.gd +++ b/Scenes/Components/SceneTransition.gd @@ -27,6 +27,7 @@ func _on_body_entered(body: Node2D): # var tween = create_tween() # tween.tween_property($Sprite2D, "modulate", Color(0, 0, 0, 1), 0.75) var tween = Utilities.fade_screen(Color(0, 0, 0, 0), Color(0, 0, 0, 1), 0.75) + Utilities.fade_bg_music(0.75) tween.connect("finished", func(): Utilities.change_scene_with_player_to_position( self.scene, player, NodePath(targetPlayerPositionNodePath) 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 diff --git a/Scenes/Entities/Objects/Coin.gd b/Scenes/Entities/Objects/Coin.gd index 77fc6c2..48e30b3 100644 --- a/Scenes/Entities/Objects/Coin.gd +++ b/Scenes/Entities/Objects/Coin.gd @@ -2,6 +2,8 @@ extends StaticBody2D func _ready(): + add_to_group("coins") + var collision_area = Utilities.Collision.Area.new(self, $CollisionShape2D, false) collision_area.connect("collided", Callable(self, "_collide")) add_child(collision_area) diff --git a/Scenes/Entities/Player.gd b/Scenes/Entities/Player.gd index a578bbb..12c5fc2 100644 --- a/Scenes/Entities/Player.gd +++ b/Scenes/Entities/Player.gd @@ -4,14 +4,19 @@ class_name Player signal damaged +signal health_changed const SPEED = 60 const KICK_SPEED = 300 const THROW_DISTANCE = 3 -@export var Bomb: PackedScene = preload("res://Scenes/Entities/Bombs/Bomb__Normal.tscn") +@export var BombScene: PackedScene = preload("res://Scenes/Entities/Bombs/Bomb__Normal.tscn") @export var bomb_power: int = 2 +@export var max_bombs: int = 5 +@export var bomb_components: Array[Bomb.COMPONENT_TYPE] = [] +var bombs: Array = [] +var last_planted_bomb: Bomb @export var maxHealth: int = 12 @export var health: int = self.maxHealth @@ -20,6 +25,9 @@ const THROW_DISTANCE = 3 var is_invincible = false var held_bomb: Bomb +var just_planted_bomb: bool = false +var accumulated_bomb_wait_delta = 0 +var bomb_wait_delta_mutiplier = 5 var DIRECTION = Vector2.DOWN @@ -38,55 +46,83 @@ func _ready(): func _process(delta): - if Input.is_action_pressed("ui_left"): - velocity.x -= SPEED - $AnimatedSprite2D.play("left") - self.DIRECTION = Vector2.LEFT - if Input.is_action_pressed("ui_right"): - velocity.x += SPEED - $AnimatedSprite2D.play("right") - self.DIRECTION = Vector2.RIGHT - if Input.is_action_pressed("ui_up"): - velocity.y -= SPEED - $AnimatedSprite2D.play("up") - self.DIRECTION = Vector2.UP - if Input.is_action_pressed("ui_down"): - velocity.y += SPEED - $AnimatedSprite2D.play("down") - self.DIRECTION = Vector2.DOWN - - if velocity.x < 0 && velocity.y < 0: - $AnimatedSprite2D.play("tl") - elif velocity.x > 0 && velocity.y < 0: - $AnimatedSprite2D.play("tr") - elif velocity.x < 0 && velocity.y > 0: - $AnimatedSprite2D.play("bl") - elif velocity.x > 0 && velocity.y > 0: - $AnimatedSprite2D.play("br") - - if Input.is_action_just_pressed("ui_accept"): - if self.held_bomb: - self.throw_bomb() + if (self.bomb_components.has(Bomb.COMPONENT_TYPE.REMOTE_DETONATE) + and Input.is_action_just_pressed("ui_cancel")): + if self.bombs.size() > 0: + self.bombs[self.bombs.size() - 1].explode() + + if (self.bomb_components.has(Bomb.COMPONENT_TYPE.REMOTE_CONTROL) + and self.last_planted_bomb and Input.is_action_pressed("ui_accept") and self.just_planted_bomb + and self.accumulated_bomb_wait_delta >= delta * self.bomb_wait_delta_mutiplier): + if Input.is_action_pressed("ui_left"): + self.last_planted_bomb.position.x -= SPEED * delta + if Input.is_action_pressed("ui_right"): + self.last_planted_bomb.position.x += SPEED * delta + if Input.is_action_pressed("ui_up"): + self.last_planted_bomb.position.y -= SPEED * delta + if Input.is_action_pressed("ui_down"): + self.last_planted_bomb.position.y += SPEED * delta + else: + if (self.just_planted_bomb and + self.accumulated_bomb_wait_delta < delta * self.bomb_wait_delta_mutiplier): + self.accumulated_bomb_wait_delta += delta else: - var interacted = false - var areas = $InteractionArea.get_overlapping_areas() - for area in areas: - if area.is_in_group("bombs"): - var bomb = area.get_parent() + self.accumulated_bomb_wait_delta = 0 + self.just_planted_bomb = false +# self.just_planted_bomb = false + + if Input.is_action_pressed("ui_left"): + velocity.x -= SPEED + $AnimatedSprite2D.play("left") + self.DIRECTION = Vector2.LEFT + if Input.is_action_pressed("ui_right"): + velocity.x += SPEED + $AnimatedSprite2D.play("right") + self.DIRECTION = Vector2.RIGHT + if Input.is_action_pressed("ui_up"): + velocity.y -= SPEED + $AnimatedSprite2D.play("up") + self.DIRECTION = Vector2.UP + if Input.is_action_pressed("ui_down"): + velocity.y += SPEED + $AnimatedSprite2D.play("down") + self.DIRECTION = Vector2.DOWN + + if velocity.x < 0 && velocity.y < 0: + $AnimatedSprite2D.play("tl") + elif velocity.x > 0 && velocity.y < 0: + $AnimatedSprite2D.play("tr") + elif velocity.x < 0 && velocity.y > 0: + $AnimatedSprite2D.play("bl") + elif velocity.x > 0 && velocity.y > 0: + $AnimatedSprite2D.play("br") + + if Input.is_action_just_pressed("ui_accept"): + if self.held_bomb: + self.throw_bomb() + else: + var interacted = false + var bomb = self.has_pickable_bomb() + if bomb: self.pick_up_bomb(bomb) - interacted = true - break - - if not interacted: - self.plant_bomb() - - self.collide(move_and_collide(velocity * delta)) - velocity = velocity.lerp(Vector2(0, 0), 1) + + if not interacted: + if self.can_plant_bomb(): + self.plant_bomb() + self.just_planted_bomb = true + #$JustPlantedBomb.start() + + self.collide(move_and_collide(velocity * delta)) + velocity = velocity.lerp(Vector2(0, 0), 1) + + +func can_plant_bomb(): + return self.bombs.size() < self.max_bombs func plant_bomb(): - var bomb = Bomb.instantiate() + var bomb = BombScene.instantiate() bomb.position = Utilities.get_level_position_grid(self) bomb.power = self.bomb_power @@ -96,9 +132,28 @@ func plant_bomb(): self.remove_collision_exception_with(bomb) ) + self.bombs.append(bomb) + self.last_planted_bomb = bomb + bomb.connect("exploded", func(_bomb): + self.bombs.erase(bomb) + if self.last_planted_bomb == bomb: + self.last_planted_bomb = null + ) + get_tree().get_current_scene().add_child(bomb) +func has_pickable_bomb(): + var areas = $InteractionArea.get_overlapping_areas() + for area in areas: + if area.is_in_group("bombs"): + var bomb = area.get_parent() + + return bomb + + return null + + func pick_up_bomb(bomb: Bomb): get_tree().get_current_scene().remove_child(bomb) bomb.position = Vector2(0, 0) @@ -183,6 +238,13 @@ func take_damage(amount): self.health -= amount self.emit_signal("damaged", self.health) + self.emit_signal("health_changed", self.health) + + +func heal(amount: int): + self.health = min(self.health + amount, self.maxHealth) + + self.emit_signal("health_changed", self.health) func set_invincibility(): @@ -200,3 +262,9 @@ func _collide(area: Area2D): self.take_damage(2) elif area.is_in_group("enemies"): self.take_damage(1) + elif area.is_in_group("coins"): + self.heal(1) + + +func _on_just_planted_bomb_timeout(): + self.just_planted_bomb = true diff --git a/Scenes/Entities/Player.tscn b/Scenes/Entities/Player.tscn index f4ef6ab..04d328f 100644 --- a/Scenes/Entities/Player.tscn +++ b/Scenes/Entities/Player.tscn @@ -115,4 +115,9 @@ shape = SubResource("RectangleShape2D_c6666") wait_time = 1.5 one_shot = true +[node name="JustPlantedBomb" type="Timer" parent="."] +wait_time = 0.05 +one_shot = true + [connection signal="timeout" from="Invincibility" to="." method="_on_invincibility_timeout"] +[connection signal="timeout" from="JustPlantedBomb" to="." method="_on_just_planted_bomb_timeout"] diff --git a/Scenes/Global.gd b/Scenes/Global.gd index 6fea884..7d0a26a 100644 --- a/Scenes/Global.gd +++ b/Scenes/Global.gd @@ -1,4 +1,5 @@ extends Node + var player: Player var last_area: Area2D diff --git a/Scenes/Maps/Map.gd b/Scenes/Maps/Map.gd index 4f57f0e..8e369f6 100644 --- a/Scenes/Maps/Map.gd +++ b/Scenes/Maps/Map.gd @@ -1,5 +1,6 @@ extends Node + func _ready(): self.add_hud() self.add_menu() diff --git a/Scenes/Maps/World.tscn b/Scenes/Maps/World.tscn index 2414d14..f59a8ee 100644 --- a/Scenes/Maps/World.tscn +++ b/Scenes/Maps/World.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://45xfj36bdsjw"] +[gd_scene load_steps=14 format=3 uid="uid://45xfj36bdsjw"] [ext_resource type="Script" path="res://Scenes/Maps/World.gd" id="1_7jam1"] [ext_resource type="PackedScene" uid="uid://d0t04jox4oxsv" path="res://Scenes/Components/TileMap.tscn" id="2_hrdtq"] @@ -6,6 +6,7 @@ [ext_resource type="PackedScene" uid="uid://dgyk1sged38ct" path="res://Scenes/Entities/Enemies/Enemy.tscn" id="3_p230b"] [ext_resource type="Script" path="res://Scenes/Components/MapArea.gd" id="4_5p13h"] [ext_resource type="PackedScene" uid="uid://cluuq4bwb8ebs" path="res://Scenes/Components/PlayerPosition.tscn" id="6_tmdwn"] +[ext_resource type="AudioStream" uid="uid://cbcrrlrhabvlv" path="res://Assets/goblins.mp3" id="7_d7rhd"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ts8f5"] size = Vector2(304, 208) @@ -124,5 +125,12 @@ position = Vector2(152, 368) [node name="InitialPlayerPosition" type="Node2D" parent="."] position = Vector2(64, 256) -[connection signal="body_entered" from="Areas/MapArea" to="Areas/MapArea" method="_on_body_entered" flags=18] -[connection signal="body_entered" from="Areas/MapArea2" to="Areas/MapArea2" method="_on_body_entered" flags=18] +[node name="MusicBackground" type="AudioStreamPlayer" parent="."] +process_mode = 3 +stream = ExtResource("7_d7rhd") +volume_db = -15.0 +autoplay = true +mix_target = 1 + +[connection signal="body_entered" from="Areas/MapArea" to="Areas/MapArea" method="_on_body_entered"] +[connection signal="body_entered" from="Areas/MapArea2" to="Areas/MapArea2" method="_on_body_entered"] diff --git a/Scenes/Maps/World2.tscn b/Scenes/Maps/World2.tscn index 216c4ce..9fa983a 100644 --- a/Scenes/Maps/World2.tscn +++ b/Scenes/Maps/World2.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=7 format=3 uid="uid://civ6kmtrcb1cu"] +[gd_scene load_steps=11 format=3 uid="uid://civ6kmtrcb1cu"] [ext_resource type="Script" path="res://Scenes/Maps/World2.gd" id="1_aucep"] [ext_resource type="PackedScene" uid="uid://difwuijv2rlx5" path="res://Scenes/Components/MapArea.tscn" id="1_iggh6"] [ext_resource type="PackedScene" uid="uid://cluuq4bwb8ebs" path="res://Scenes/Components/PlayerPosition.tscn" id="2_tjoos"] [ext_resource type="PackedScene" uid="uid://c5ix2njry0181" path="res://Scenes/Components/SceneTransition.tscn" id="3_rtmo8"] +[ext_resource type="AudioStream" uid="uid://dyxryfuxaqjs" path="res://Assets/Magic Escape Room-1G3Phdm2bvw.mp3" id="5_ep67r"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ps5ac"] size = Vector2(240, 160) @@ -11,6 +12,15 @@ size = Vector2(240, 160) [sub_resource type="RectangleShape2D" id="RectangleShape2D_e0tjv"] size = Vector2(240, 160) +[sub_resource type="RectangleShape2D" id="RectangleShape2D_kejxa"] +size = Vector2(352, 160) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_akm4n"] +size = Vector2(352, 192) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_34tjn"] +size = Vector2(240, 192) + [node name="World2" type="Node2D"] script = ExtResource("1_aucep") @@ -26,12 +36,39 @@ shape = SubResource("RectangleShape2D_ps5ac") [node name="MapArea2" parent="." instance=ExtResource("1_iggh6")] [node name="TileMap" parent="MapArea2" index="1"] -layer_0/tile_data = PackedInt32Array(15, 655361, 18, 65551, 655361, 17, 131087, 1, 13, 196623, 655361, 18, 262159, 655361, 18, 327695, 655361, 18, 393231, 655361, 18, 458767, 655361, 18, 524303, 655361, 18, 589839, 655361, 17, 16, 655361, 17, 65552, 1, 13, 131088, 1, 13, 196624, 1, 13, 262160, 1, 13, 327696, 1, 13, 393232, 1, 13, 458768, 1, 13, 524304, 1, 13, 589840, 655361, 17, 65553, 1, 13, 131089, 1, 13, 196625, 1, 13, 262161, 1, 13, 327697, 1, 13, 393233, 1, 13, 458769, 1, 13, 524305, 1, 13, 589841, 655361, 17, 18, 655361, 17, 65554, 1, 13, 131090, 1, 13, 196626, 1, 13, 262162, 1, 13, 327698, 1, 13, 393234, 1, 13, 458770, 1, 13, 524306, 1, 13, 589842, 655361, 17, 19, 655361, 17, 65555, 1, 13, 131091, 1, 13, 196627, 1, 13, 262163, 1, 13, 327699, 1, 13, 393235, 1, 13, 458771, 1, 13, 524307, 1, 13, 589843, 655361, 17, 20, 655361, 17, 65556, 1, 13, 131092, 1, 13, 196628, 1, 13, 262164, 1, 13, 327700, 1, 13, 393236, 1, 13, 458772, 1, 13, 524308, 1, 13, 589844, 655361, 17, 21, 655361, 17, 65557, 1, 13, 131093, 1, 13, 196629, 1, 13, 262165, 1, 13, 327701, 1, 13, 393237, 1, 13, 458773, 1, 13, 524309, 1, 13, 589845, 655361, 17, 22, 655361, 17, 65558, 1, 13, 131094, 1, 13, 196630, 1, 13, 262166, 1, 13, 327702, 1, 13, 393238, 1, 13, 458774, 1, 13, 524310, 1, 13, 23, 655361, 17, 65559, 1, 13, 131095, 1, 13, 196631, 1, 13, 262167, 1, 13, 327703, 1, 13, 393239, 1, 13, 458775, 1, 13, 524311, 1, 13, 589847, 655361, 17, 24, 655361, 17, 65560, 1, 13, 131096, 1, 13, 196632, 1, 13, 262168, 1, 13, 327704, 1, 13, 393240, 1, 13, 458776, 1, 13, 524312, 1, 13, 589848, 655361, 17, 25, 655361, 17, 65561, 1, 13, 131097, 1, 13, 196633, 1, 13, 262169, 1, 13, 327705, 1, 13, 393241, 1, 13, 458777, 1, 13, 524313, 1, 13, 589849, 655361, 17, 26, 655361, 17, 65562, 1, 13, 131098, 1, 13, 196634, 1, 13, 262170, 1, 13, 327706, 1, 13, 393242, 1, 13, 458778, 1, 13, 524314, 1, 13, 589850, 655361, 17, 27, 655361, 17, 65563, 1, 13, 131099, 1, 13, 196635, 1, 13, 262171, 1, 13, 327707, 1, 13, 393243, 1, 13, 458779, 1, 13, 524315, 1, 13, 589851, 655361, 17, 28, 655361, 17, 65564, 1, 13, 131100, 1, 13, 196636, 1, 13, 262172, 1, 13, 327708, 1, 13, 393244, 1, 13, 458780, 1, 13, 524316, 1, 13, 589852, 655361, 17, 29, 655361, 18, 65565, 655361, 18, 131101, 655361, 18, 196637, 655361, 18, 262173, 655361, 18, 327709, 655361, 18, 393245, 655361, 18, 458781, 655361, 18, 524317, 655361, 18, 589853, 655361, 17, 589846, 655361, 17, 17, 1, 13) +layer_0/tile_data = PackedInt32Array(15, 655361, 18, 65551, 655361, 17, 131087, 1, 13, 196623, 655361, 18, 262159, 655361, 18, 327695, 655361, 18, 393231, 655361, 18, 458767, 655361, 18, 524303, 655361, 18, 589839, 655361, 18, 16, 655361, 17, 65552, 1, 13, 131088, 1, 13, 196624, 1, 13, 262160, 1, 13, 327696, 1, 13, 393232, 1, 13, 458768, 1, 13, 524304, 1, 13, 589840, 655361, 18, 65553, 1, 13, 131089, 1, 13, 196625, 1, 13, 262161, 1, 13, 327697, 1, 13, 393233, 1, 13, 458769, 1, 13, 524305, 1, 13, 589841, 655361, 18, 18, 655361, 17, 65554, 1, 13, 131090, 1, 13, 196626, 1, 13, 262162, 1, 13, 327698, 1, 13, 393234, 1, 13, 458770, 1, 13, 524306, 1, 13, 589842, 655361, 18, 19, 655361, 17, 65555, 1, 13, 131091, 1, 13, 196627, 1, 13, 262163, 1, 13, 327699, 1, 13, 393235, 1, 13, 458771, 1, 13, 524307, 1, 13, 589843, 655361, 18, 20, 655361, 17, 65556, 1, 13, 131092, 1, 13, 196628, 1, 13, 262164, 1, 13, 327700, 1, 13, 393236, 1, 13, 458772, 1, 13, 524308, 1, 13, 589844, 655361, 18, 21, 655361, 17, 65557, 1, 13, 131093, 1, 13, 196629, 1, 13, 262165, 1, 13, 327701, 1, 13, 393237, 1, 13, 458773, 1, 13, 524309, 1, 13, 589845, 655361, 18, 22, 655361, 17, 65558, 1, 13, 131094, 1, 13, 196630, 1, 13, 262166, 1, 13, 327702, 1, 13, 393238, 1, 13, 458774, 1, 13, 524310, 1, 13, 23, 655361, 17, 65559, 1, 13, 131095, 1, 13, 196631, 1, 13, 262167, 1, 13, 327703, 1, 13, 393239, 1, 13, 458775, 1, 13, 524311, 1, 13, 589847, 655361, 18, 24, 655361, 17, 65560, 1, 13, 131096, 1, 13, 196632, 1, 13, 262168, 1, 13, 327704, 1, 13, 393240, 1, 13, 458776, 1, 13, 524312, 1, 13, 589848, 655361, 18, 25, 655361, 17, 65561, 1, 13, 131097, 1, 13, 196633, 1, 13, 262169, 1, 13, 327705, 1, 13, 393241, 1, 13, 458777, 1, 13, 524313, 1, 13, 589849, 655361, 18, 26, 655361, 17, 65562, 1, 13, 131098, 1, 13, 196634, 1, 13, 262170, 1, 13, 327706, 1, 13, 393242, 1, 13, 458778, 1, 13, 524314, 1, 13, 589850, 655361, 18, 27, 655361, 17, 65563, 1, 13, 131099, 1, 13, 196635, 1, 13, 262171, 1, 13, 327707, 1, 13, 393243, 1, 13, 458779, 1, 13, 524315, 1, 13, 28, 655361, 17, 65564, 1, 13, 131100, 1, 13, 196636, 1, 13, 262172, 1, 13, 327708, 1, 13, 393244, 1, 13, 458780, 1, 13, 524316, 1, 13, 29, 655361, 18, 65565, 655361, 18, 131101, 655361, 18, 196637, 655361, 18, 262173, 655361, 18, 327709, 655361, 18, 393245, 655361, 18, 589853, 655361, 18, 589846, 655361, 18, 17, 1, 13, 589851, 655361, 18, 458781, 655361, 17, 589852, 1, 13, 524317, 1, 13) [node name="CollisionShape2D" type="CollisionShape2D" parent="MapArea2"] position = Vector2(360, 80) shape = SubResource("RectangleShape2D_e0tjv") +[node name="MapArea3" parent="." instance=ExtResource("1_iggh6")] + +[node name="TileMap" parent="MapArea3" index="1"] +layer_0/tile_data = PackedInt32Array(30, 655361, 18, 65566, 655361, 18, 131102, 655361, 18, 196638, 655361, 18, 262174, 655361, 18, 327710, 655361, 18, 393246, 655361, 18, 458782, 655361, 17, 589854, 655361, 18, 31, 655361, 17, 65567, 1, 13, 131103, 1, 13, 196639, 1, 13, 262175, 1, 13, 327711, 1, 13, 393247, 1, 13, 458783, 1, 13, 524319, 1, 13, 32, 655361, 17, 65568, 1, 13, 131104, 1, 13, 196640, 1, 13, 262176, 1, 13, 327712, 1, 13, 393248, 1, 13, 458784, 1, 13, 524320, 1, 13, 589856, 655361, 18, 33, 655361, 17, 65569, 1, 13, 131105, 1, 13, 196641, 1, 13, 262177, 1, 13, 327713, 1, 13, 393249, 1, 13, 458785, 1, 13, 524321, 1, 13, 589857, 655361, 18, 34, 655361, 17, 65570, 1, 13, 131106, 1, 13, 196642, 1, 13, 262178, 1, 13, 327714, 1, 13, 393250, 1, 13, 458786, 1, 13, 524322, 1, 13, 589858, 655361, 18, 35, 655361, 17, 65571, 1, 13, 131107, 1, 13, 196643, 1, 13, 262179, 1, 13, 327715, 1, 13, 393251, 1, 13, 458787, 1, 13, 524323, 1, 13, 589859, 655361, 18, 36, 655361, 17, 65572, 1, 13, 131108, 1, 13, 196644, 1, 13, 262180, 1, 13, 327716, 1, 13, 393252, 1, 13, 458788, 1, 13, 524324, 1, 13, 589860, 655361, 18, 37, 655361, 17, 65573, 1, 13, 131109, 1, 13, 196645, 1, 13, 262181, 1, 13, 327717, 1, 13, 393253, 1, 13, 458789, 1, 13, 524325, 1, 13, 589861, 655361, 18, 38, 655361, 17, 65574, 1, 13, 131110, 1, 13, 196646, 1, 13, 262182, 1, 13, 327718, 1, 13, 393254, 1, 13, 458790, 1, 13, 524326, 1, 13, 589862, 655361, 18, 39, 655361, 17, 65575, 1, 13, 131111, 1, 13, 196647, 1, 13, 262183, 1, 13, 327719, 1, 13, 393255, 1, 13, 458791, 1, 13, 524327, 1, 13, 589863, 655361, 18, 40, 655361, 17, 65576, 1, 13, 131112, 1, 13, 196648, 1, 13, 262184, 1, 13, 327720, 1, 13, 393256, 1, 13, 458792, 1, 13, 524328, 1, 13, 589864, 655361, 18, 41, 655361, 17, 65577, 1, 13, 131113, 1, 13, 196649, 1, 13, 262185, 1, 13, 327721, 1, 13, 393257, 1, 13, 458793, 1, 13, 524329, 1, 13, 589865, 655361, 18, 42, 655361, 17, 65578, 1, 13, 131114, 1, 13, 196650, 1, 13, 262186, 1, 13, 327722, 1, 13, 393258, 1, 13, 458794, 1, 13, 524330, 1, 13, 589866, 655361, 18, 43, 655361, 17, 65579, 1, 13, 131115, 1, 13, 196651, 1, 13, 262187, 1, 13, 327723, 1, 13, 393259, 1, 13, 458795, 1, 13, 524331, 1, 13, 589867, 655361, 18, 44, 655361, 17, 65580, 1, 13, 131116, 1, 13, 196652, 1, 13, 262188, 1, 13, 327724, 1, 13, 393260, 1, 13, 458796, 1, 13, 524332, 1, 13, 589868, 655361, 18, 45, 655361, 17, 65581, 1, 13, 131117, 1, 13, 196653, 1, 13, 262189, 1, 13, 327725, 1, 13, 393261, 1, 13, 458797, 1, 13, 524333, 1, 13, 589869, 655361, 18, 46, 655361, 17, 65582, 1, 13, 131118, 1, 13, 196654, 1, 13, 262190, 1, 13, 327726, 1, 13, 393262, 1, 13, 458798, 1, 13, 524334, 1, 13, 589870, 655361, 18, 47, 655361, 17, 65583, 1, 13, 131119, 1, 13, 196655, 1, 13, 262191, 1, 13, 327727, 1, 13, 393263, 1, 13, 458799, 1, 13, 524335, 1, 13, 589871, 655361, 18, 48, 655361, 17, 65584, 1, 13, 131120, 1, 13, 196656, 1, 13, 262192, 1, 13, 327728, 1, 13, 393264, 1, 13, 458800, 1, 13, 524336, 1, 13, 589872, 655361, 18, 49, 655361, 17, 65585, 1, 13, 131121, 1, 13, 196657, 1, 13, 262193, 1, 13, 327729, 1, 13, 393265, 1, 13, 458801, 1, 13, 524337, 1, 13, 50, 655361, 17, 65586, 1, 13, 131122, 1, 13, 196658, 1, 13, 262194, 1, 13, 327730, 1, 13, 393266, 1, 13, 458802, 1, 13, 524338, 1, 13, 589874, 655361, 18, 51, 655361, 18, 65587, 655361, 18, 131123, 655361, 18, 196659, 655361, 18, 262195, 655361, 18, 327731, 655361, 18, 393267, 655361, 18, 458803, 655361, 18, 524339, 655361, 18, 589875, 655361, 18, 589855, 1, 13, 524318, 1, 13, 589873, 1, 13) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="MapArea3"] +position = Vector2(656, 80) +shape = SubResource("RectangleShape2D_kejxa") + +[node name="MapArea4" parent="." instance=ExtResource("1_iggh6")] + +[node name="TileMap" parent="MapArea4" index="1"] +layer_0/tile_data = PackedInt32Array(655390, 655361, 17, 720926, 1, 13, 786462, 655361, 18, 851998, 655361, 18, 917534, 655361, 18, 983070, 655361, 18, 1048606, 655361, 18, 1114142, 655361, 18, 1179678, 655361, 18, 1245214, 655361, 18, 1310750, 655361, 18, 1376286, 655361, 17, 655391, 1, 13, 720927, 1, 13, 786463, 1, 13, 851999, 1, 13, 917535, 1, 13, 983071, 1, 13, 1048607, 1, 13, 1114143, 1, 13, 1179679, 1, 13, 1245215, 1, 13, 1310751, 1, 13, 1376287, 655361, 17, 655392, 655361, 17, 720928, 1, 13, 786464, 1, 13, 852000, 1, 13, 917536, 1, 13, 983072, 1, 13, 1048608, 1, 13, 1114144, 1, 13, 1179680, 1, 13, 1245216, 1, 13, 1310752, 1, 13, 1376288, 655361, 17, 655393, 655361, 17, 720929, 1, 13, 786465, 1, 13, 852001, 1, 13, 917537, 1, 13, 983073, 1, 13, 1048609, 1, 13, 1114145, 1, 13, 1179681, 1, 13, 1245217, 1, 13, 1310753, 1, 13, 1376289, 655361, 17, 655394, 655361, 17, 720930, 1, 13, 786466, 1, 13, 852002, 1, 13, 917538, 1, 13, 983074, 1, 13, 1048610, 1, 13, 1114146, 1, 13, 1179682, 1, 13, 1245218, 1, 13, 1310754, 1, 13, 1376290, 655361, 17, 655395, 655361, 17, 720931, 1, 13, 786467, 1, 13, 852003, 1, 13, 917539, 1, 13, 983075, 1, 13, 1048611, 1, 13, 1114147, 1, 13, 1179683, 1, 13, 1245219, 1, 13, 1310755, 1, 13, 1376291, 655361, 17, 655396, 655361, 17, 720932, 1, 13, 786468, 1, 13, 852004, 1, 13, 917540, 1, 13, 983076, 1, 13, 1048612, 1, 13, 1114148, 1, 13, 1179684, 1, 13, 1245220, 1, 13, 1310756, 1, 13, 1376292, 655361, 17, 655397, 655361, 17, 720933, 1, 13, 786469, 1, 13, 852005, 1, 13, 917541, 1, 13, 983077, 1, 13, 1048613, 1, 13, 1114149, 1, 13, 1179685, 1, 13, 1245221, 1, 13, 1310757, 1, 13, 1376293, 655361, 17, 655398, 655361, 17, 720934, 1, 13, 786470, 1, 13, 852006, 1, 13, 917542, 1, 13, 983078, 1, 13, 1048614, 1, 13, 1114150, 1, 13, 1179686, 1, 13, 1245222, 1, 13, 1310758, 1, 13, 1376294, 655361, 17, 655399, 655361, 17, 720935, 1, 13, 786471, 1, 13, 852007, 1, 13, 917543, 1, 13, 983079, 1, 13, 1048615, 1, 13, 1114151, 1, 13, 1179687, 1, 13, 1245223, 1, 13, 1310759, 1, 13, 1376295, 655361, 17, 655400, 655361, 17, 720936, 1, 13, 786472, 1, 13, 852008, 1, 13, 917544, 1, 13, 983080, 1, 13, 1048616, 1, 13, 1114152, 1, 13, 1179688, 1, 13, 1245224, 1, 13, 1310760, 1, 13, 1376296, 655361, 17, 655401, 655361, 17, 720937, 1, 13, 786473, 1, 13, 852009, 1, 13, 917545, 1, 13, 983081, 1, 13, 1048617, 1, 13, 1114153, 1, 13, 1179689, 1, 13, 1245225, 1, 13, 1310761, 1, 13, 1376297, 655361, 17, 655402, 655361, 17, 720938, 1, 13, 786474, 1, 13, 852010, 1, 13, 917546, 1, 13, 983082, 1, 13, 1048618, 1, 13, 1114154, 1, 13, 1179690, 1, 13, 1245226, 1, 13, 1310762, 1, 13, 1376298, 655361, 17, 655403, 655361, 17, 720939, 1, 13, 786475, 1, 13, 852011, 1, 13, 917547, 1, 13, 983083, 1, 13, 1048619, 1, 13, 1114155, 1, 13, 1179691, 1, 13, 1245227, 1, 13, 1310763, 1, 13, 1376299, 655361, 17, 655404, 655361, 17, 720940, 1, 13, 786476, 1, 13, 852012, 1, 13, 917548, 1, 13, 983084, 1, 13, 1048620, 1, 13, 1114156, 1, 13, 1179692, 1, 13, 1245228, 1, 13, 1310764, 1, 13, 1376300, 655361, 17, 655405, 655361, 17, 720941, 1, 13, 786477, 1, 13, 852013, 1, 13, 917549, 1, 13, 983085, 1, 13, 1048621, 1, 13, 1114157, 1, 13, 1179693, 1, 13, 1245229, 1, 13, 1310765, 1, 13, 1376301, 655361, 17, 655406, 655361, 17, 720942, 1, 13, 786478, 1, 13, 852014, 1, 13, 917550, 1, 13, 983086, 1, 13, 1048622, 1, 13, 1114158, 1, 13, 1179694, 1, 13, 1245230, 1, 13, 1310766, 1, 13, 1376302, 655361, 17, 655407, 655361, 17, 720943, 1, 13, 786479, 1, 13, 852015, 1, 13, 917551, 1, 13, 983087, 1, 13, 1048623, 1, 13, 1114159, 1, 13, 1179695, 1, 13, 1245231, 1, 13, 1310767, 1, 13, 1376303, 655361, 17, 655408, 655361, 17, 720944, 1, 13, 786480, 1, 13, 852016, 1, 13, 917552, 1, 13, 983088, 1, 13, 1048624, 1, 13, 1114160, 1, 13, 1179696, 1, 13, 1245232, 1, 13, 1310768, 1, 13, 1376304, 655361, 17, 720945, 1, 13, 786481, 1, 13, 852017, 1, 13, 917553, 1, 13, 983089, 1, 13, 1048625, 1, 13, 1114161, 1, 13, 1179697, 1, 13, 1245233, 1, 13, 1310769, 1, 13, 1376305, 655361, 17, 655410, 655361, 17, 720946, 1, 13, 786482, 1, 13, 852018, 1, 13, 917554, 1, 13, 983090, 1, 13, 1048626, 1, 13, 1114162, 1, 13, 1179698, 1, 13, 1245234, 1, 13, 1310770, 1, 13, 1376306, 655361, 17, 655411, 655361, 18, 720947, 655361, 18, 786483, 655361, 18, 852019, 655361, 18, 917555, 655361, 18, 983091, 655361, 18, 1048627, 655361, 18, 1114163, 655361, 18, 1179699, 655361, 18, 1245235, 655361, 18, 1310771, 655361, 18, 1376307, 655361, 17, 655409, 1, 13) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="MapArea4"] +position = Vector2(656, 256) +shape = SubResource("RectangleShape2D_akm4n") + +[node name="MapArea5" parent="." instance=ExtResource("1_iggh6")] + +[node name="TileMap" parent="MapArea5" index="1"] +layer_0/tile_data = PackedInt32Array(655375, 655361, 18, 720911, 655361, 18, 786447, 655361, 18, 851983, 655361, 18, 917519, 655361, 18, 983055, 655361, 18, 1048591, 655361, 18, 1114127, 655361, 18, 1179663, 655361, 18, 1245199, 655361, 18, 1310735, 655361, 18, 1376271, 655361, 17, 655376, 655361, 17, 720912, 1, 13, 786448, 1, 13, 851984, 1, 13, 917520, 1, 13, 983056, 1, 13, 1048592, 1, 13, 1114128, 1, 13, 1179664, 1, 13, 1245200, 1, 13, 1310736, 1, 13, 1376272, 655361, 17, 655377, 655361, 17, 720913, 1, 13, 786449, 1, 13, 851985, 1, 13, 917521, 1, 13, 983057, 1, 13, 1048593, 1, 13, 1114129, 1, 13, 1179665, 1, 13, 1245201, 1, 13, 1310737, 1, 13, 1376273, 655361, 17, 655378, 655361, 17, 720914, 1, 13, 786450, 1, 13, 851986, 1, 13, 917522, 1, 13, 983058, 1, 13, 1048594, 1, 13, 1114130, 1, 13, 1179666, 1, 13, 1245202, 1, 13, 1310738, 1, 13, 1376274, 655361, 17, 655379, 655361, 17, 720915, 1, 13, 786451, 1, 13, 851987, 1, 13, 917523, 1, 13, 983059, 1, 13, 1048595, 1, 13, 1114131, 1, 13, 1179667, 1, 13, 1245203, 1, 13, 1310739, 1, 13, 1376275, 655361, 17, 655380, 655361, 17, 720916, 1, 13, 786452, 1, 13, 851988, 1, 13, 917524, 1, 13, 983060, 1, 13, 1048596, 1, 13, 1114132, 1, 13, 1179668, 1, 13, 1245204, 1, 13, 1310740, 1, 13, 1376276, 655361, 17, 655381, 655361, 17, 720917, 1, 13, 786453, 1, 13, 851989, 1, 13, 917525, 1, 13, 983061, 1, 13, 1048597, 1, 13, 1114133, 1, 13, 1179669, 1, 13, 1245205, 1, 13, 1310741, 1, 13, 1376277, 655361, 17, 655382, 655361, 17, 720918, 1, 13, 786454, 1, 13, 851990, 1, 13, 917526, 1, 13, 983062, 1, 13, 1048598, 1, 13, 1114134, 1, 13, 1179670, 1, 13, 1245206, 1, 13, 1310742, 1, 13, 1376278, 655361, 17, 655383, 655361, 17, 720919, 1, 13, 786455, 1, 13, 851991, 1, 13, 917527, 1, 13, 983063, 1, 13, 1048599, 1, 13, 1114135, 1, 13, 1179671, 1, 13, 1245207, 1, 13, 1310743, 1, 13, 1376279, 655361, 17, 655384, 655361, 17, 720920, 1, 13, 786456, 1, 13, 851992, 1, 13, 917528, 1, 13, 983064, 1, 13, 1048600, 1, 13, 1114136, 1, 13, 1179672, 1, 13, 1245208, 1, 13, 1310744, 1, 13, 1376280, 655361, 17, 655385, 655361, 17, 720921, 1, 13, 786457, 1, 13, 851993, 1, 13, 917529, 1, 13, 983065, 1, 13, 1048601, 1, 13, 1114137, 1, 13, 1179673, 1, 13, 1245209, 1, 13, 1310745, 1, 13, 1376281, 655361, 17, 655386, 655361, 17, 720922, 1, 13, 786458, 1, 13, 851994, 1, 13, 917530, 1, 13, 983066, 1, 13, 1048602, 1, 13, 1114138, 1, 13, 1179674, 1, 13, 1245210, 1, 13, 1310746, 1, 13, 1376282, 655361, 17, 655387, 655361, 17, 720923, 1, 13, 786459, 1, 13, 851995, 1, 13, 917531, 1, 13, 983067, 1, 13, 1048603, 1, 13, 1114139, 1, 13, 1179675, 1, 13, 1245211, 1, 13, 1310747, 1, 13, 1376283, 655361, 17, 720924, 1, 13, 786460, 1, 13, 851996, 1, 13, 917532, 1, 13, 983068, 1, 13, 1048604, 1, 13, 1114140, 1, 13, 1179676, 1, 13, 1245212, 1, 13, 1310748, 1, 13, 1376284, 655361, 17, 655389, 655361, 17, 786461, 655361, 18, 851997, 655361, 18, 917533, 655361, 18, 983069, 655361, 18, 1048605, 655361, 18, 1114141, 655361, 18, 1179677, 655361, 18, 1245213, 655361, 18, 1310749, 655361, 18, 1376285, 655361, 17, 720925, 1, 13, 655388, 1, 13) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="MapArea5"] +position = Vector2(360, 256) +shape = SubResource("RectangleShape2D_34tjn") + [node name="PlayerPositionWorld1-1" parent="." instance=ExtResource("2_tjoos")] position = Vector2(40, 144) @@ -48,5 +85,13 @@ position = Vector2(280, 0) sceneFilePath = "res://Scenes/Maps/World.tscn" targetPlayerPositionNodePath = "PlayerPositionWorld2-2" +[node name="MusicBackground" type="AudioStreamPlayer" parent="."] +process_mode = 3 +stream = ExtResource("5_ep67r") +autoplay = true + [editable path="MapArea"] [editable path="MapArea2"] +[editable path="MapArea3"] +[editable path="MapArea4"] +[editable path="MapArea5"] diff --git a/Scenes/UI/HealthBar.gd b/Scenes/UI/HealthBar.gd index 8c4c90d..ba51007 100644 --- a/Scenes/UI/HealthBar.gd +++ b/Scenes/UI/HealthBar.gd @@ -9,7 +9,7 @@ func connect_to_player(player_to_connect: Player): self.player = player_to_connect self.draw_health() - self.player.connect("damaged", func (_health): self.draw_health()) + self.player.connect("health_changed", func (_health): self.draw_health()) func draw_health(): diff --git a/Scenes/UI/Menu.gd b/Scenes/UI/Menu.gd index b482342..ec6ca49 100644 --- a/Scenes/UI/Menu.gd +++ b/Scenes/UI/Menu.gd @@ -1,8 +1,14 @@ extends TabContainer +@onready var audio_bus = AudioServer.get_bus_index("Master") + + func _ready(): hide() + + self._ready_bombs() + self._ready_system() func _input(_event: InputEvent): @@ -37,6 +43,12 @@ func get_player(): ### Bombs ### +func _ready_bombs(): + for component in Bomb.COMPONENT_TYPE: + var idx = Bomb.COMPONENT_TYPE[component] + $Bombs/Panel/HBoxContainer/VBoxContainer3/BombComponents.set_item_text(idx, component.capitalize()) + + func _on_button_bomb_normal_pressed(): self.get_player().Bomb = preload("res://Scenes/Entities/Bombs/Bomb__Normal.tscn") @@ -50,9 +62,24 @@ func _on_bomb_power_item_selected(index): self.get_player().bomb_power = power +func _on_bomb_components_multi_selected(_index, _selected): + Global.player.bomb_components = [] + for idx in $Bombs/Panel/HBoxContainer/VBoxContainer3/BombComponents.get_selected_items(): + Global.player.bomb_components.append(idx) # same as enum idx + + ### System ### +func _ready_system(): + AudioServer.set_bus_volume_db(self.audio_bus, linear_to_db(0)) + $System/Panel/VBoxContainer2/SliderVolume.value = db_to_linear(AudioServer.get_bus_volume_db(self.audio_bus)) + + +func _on_slider_volume_value_changed(value): + AudioServer.set_bus_volume_db(self.audio_bus, linear_to_db(value)) + + func quit_game(): get_tree().quit() diff --git a/Scenes/UI/Menu.tscn b/Scenes/UI/Menu.tscn index 4a8f26e..38c3ee4 100644 --- a/Scenes/UI/Menu.tscn +++ b/Scenes/UI/Menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://d3xrwsv32hs6k"] +[gd_scene load_steps=9 format=3 uid="uid://d3xrwsv32hs6k"] [ext_resource type="Script" path="res://Scenes/UI/Menu.gd" id="1_vwah3"] @@ -11,10 +11,13 @@ bg_color = Color(0, 0, 0, 0.784314) [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_p483f"] [sub_resource type="LabelSettings" id="LabelSettings_3ht7i"] -font_size = 10 +font_size = 5 [sub_resource type="LabelSettings" id="LabelSettings_s4847"] -font_size = 10 +font_size = 5 + +[sub_resource type="LabelSettings" id="LabelSettings_qokw0"] +font_size = 5 [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7at3v"] @@ -25,7 +28,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 -theme_override_font_sizes/font_size = 10 +theme_override_font_sizes/font_size = 5 theme_override_styles/panel = SubResource("StyleBoxFlat_flq5r") theme_override_styles/tabbar_background = SubResource("StyleBoxFlat_u0ugs") clip_tabs = false @@ -33,10 +36,10 @@ script = ExtResource("1_vwah3") [node name="Bombs" type="MarginContainer" parent="."] layout_mode = 2 -theme_override_constants/margin_left = 8 -theme_override_constants/margin_top = 8 -theme_override_constants/margin_right = 8 -theme_override_constants/margin_bottom = 8 +theme_override_constants/margin_left = 4 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 4 +theme_override_constants/margin_bottom = 4 [node name="Panel" type="Panel" parent="Bombs"] layout_mode = 2 @@ -44,8 +47,8 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_p483f") [node name="HBoxContainer" type="HBoxContainer" parent="Bombs/Panel"] layout_mode = 1 -offset_right = 177.0 -offset_bottom = 101.0 +offset_right = 89.0 +offset_bottom = 78.0 [node name="VBoxContainer" type="VBoxContainer" parent="Bombs/Panel/HBoxContainer"] layout_mode = 2 @@ -58,12 +61,12 @@ horizontal_alignment = 1 [node name="ButtonBombNormal" type="Button" parent="Bombs/Panel/HBoxContainer/VBoxContainer"] layout_mode = 2 -theme_override_font_sizes/font_size = 10 +theme_override_font_sizes/font_size = 4 text = "Normal" [node name="ButtonBombBreakables" type="Button" parent="Bombs/Panel/HBoxContainer/VBoxContainer"] layout_mode = 2 -theme_override_font_sizes/font_size = 10 +theme_override_font_sizes/font_size = 4 text = "Breakables" [node name="Space" type="Control" parent="Bombs/Panel/HBoxContainer"] @@ -81,7 +84,7 @@ horizontal_alignment = 1 [node name="BombPower" type="ItemList" parent="Bombs/Panel/HBoxContainer/VBoxContainer2"] layout_mode = 2 -theme_override_font_sizes/font_size = 10 +theme_override_font_sizes/font_size = 4 auto_height = true item_count = 4 item_0/text = "2" @@ -89,13 +92,35 @@ item_1/text = "3" item_2/text = "4" item_3/text = "5" +[node name="VBoxContainer3" type="VBoxContainer" parent="Bombs/Panel/HBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="Bombs/Panel/HBoxContainer/VBoxContainer3"] +layout_mode = 2 +text = "Components" +label_settings = SubResource("LabelSettings_qokw0") + +[node name="BombComponents" type="ItemList" parent="Bombs/Panel/HBoxContainer/VBoxContainer3"] +layout_mode = 2 +theme_override_font_sizes/font_size = 4 +select_mode = 1 +auto_height = true +text_overrun_behavior = 0 +item_count = 5 +fixed_column_width = 500 +item_0/text = "Breakable" +item_1/text = "RemoteControl" +item_2/text = "RemoteDetonate" +item_3/text = "Water" +item_4/text = "Salt" + [node name="System" type="MarginContainer" parent="."] visible = false layout_mode = 2 -theme_override_constants/margin_left = 16 -theme_override_constants/margin_top = 16 -theme_override_constants/margin_right = 16 -theme_override_constants/margin_bottom = 16 +theme_override_constants/margin_left = 4 +theme_override_constants/margin_top = 4 +theme_override_constants/margin_right = 4 +theme_override_constants/margin_bottom = 4 [node name="Panel" type="Panel" parent="System"] layout_mode = 2 @@ -108,23 +133,40 @@ anchor_left = 1.0 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 -offset_left = -92.0 -offset_top = -48.0 +offset_left = -36.0 +offset_top = -34.0 grow_horizontal = 0 grow_vertical = 0 [node name="ButtonResume" type="Button" parent="System/Panel/VBoxContainer"] layout_mode = 2 -theme_override_font_sizes/font_size = 10 +theme_override_font_sizes/font_size = 4 text = "Resume Game" [node name="ButtonQuit" type="Button" parent="System/Panel/VBoxContainer"] layout_mode = 2 -theme_override_font_sizes/font_size = 10 +theme_override_font_sizes/font_size = 4 text = "Quit Game" +[node name="VBoxContainer2" type="VBoxContainer" parent="System/Panel"] +layout_mode = 0 +offset_right = 80.0 +offset_bottom = 40.0 + +[node name="Label" type="Label" parent="System/Panel/VBoxContainer2"] +layout_mode = 2 +theme_override_font_sizes/font_size = 6 +text = "Audio" + +[node name="SliderVolume" type="HSlider" parent="System/Panel/VBoxContainer2"] +layout_mode = 2 +max_value = 1.0 +step = 0.05 + [connection signal="pressed" from="Bombs/Panel/HBoxContainer/VBoxContainer/ButtonBombNormal" to="." method="_on_button_bomb_normal_pressed"] [connection signal="pressed" from="Bombs/Panel/HBoxContainer/VBoxContainer/ButtonBombBreakables" to="." method="_on_button_bomb_breakables_pressed"] [connection signal="item_selected" from="Bombs/Panel/HBoxContainer/VBoxContainer2/BombPower" to="." method="_on_bomb_power_item_selected"] +[connection signal="multi_selected" from="Bombs/Panel/HBoxContainer/VBoxContainer3/BombComponents" to="." method="_on_bomb_components_multi_selected"] [connection signal="pressed" from="System/Panel/VBoxContainer/ButtonResume" to="." method="_on_button_resume_pressed"] [connection signal="pressed" from="System/Panel/VBoxContainer/ButtonQuit" to="." method="_on_button_quit_pressed"] +[connection signal="value_changed" from="System/Panel/VBoxContainer2/SliderVolume" to="." method="_on_slider_volume_value_changed"] diff --git a/Scenes/Utilities.gd b/Scenes/Utilities.gd index f9485ff..f7a5d5d 100644 --- a/Scenes/Utilities.gd +++ b/Scenes/Utilities.gd @@ -69,6 +69,18 @@ func fade_screen(from: Color, to: Color, duration: float = SCREEN_FADE_DURATION) return tween +func fade_bg_music(duration: float = SCREEN_FADE_DURATION): + if get_tree().current_scene.has_node("MusicBackground"): + var music = get_tree().current_scene.get_node("MusicBackground") + var tween = get_tree().create_tween() + tween.tween_property( + music, + "volume_db", + ProjectSettings.get_setting("audio/buses/channel_disable_threshold_db"), + duration + ) + + func get_collision_shape_bounds(collision_shape: CollisionShape2D): var shape: Shape2D = collision_shape.shape var bounds @@ -97,7 +109,7 @@ class Collision: func _init(node: Node2D, original_collision_shape: Node2D, expand: bool = true): self.name = "CollisionArea" - super() + #super() # setup area self.collision_layer = node.collision_layer |