diff --git a/.DS_Store b/.DS_Store index dc64799..4a5702b 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/assets/Cauldron's Brew/Cauldron and Powder.png b/assets/Cauldron's Brew/Cauldron and Powder.png index e4ea480..28e5f50 100644 Binary files a/assets/Cauldron's Brew/Cauldron and Powder.png and b/assets/Cauldron's Brew/Cauldron and Powder.png differ diff --git a/cauldron_bar.gd b/cauldron_bar.gd new file mode 100644 index 0000000..a4e88ab --- /dev/null +++ b/cauldron_bar.gd @@ -0,0 +1,53 @@ +extends HBoxContainer + +var base = AtlasTexture.new() +var yellow = AtlasTexture.new() +var orange = AtlasTexture.new() +var red = AtlasTexture.new() +var slots: Array[TextureRect] = [] +var colors: Array[AtlasTexture] = [] +var burning_colors: Array[AtlasTexture] = [] +var slot_states = [0, 0, 0] + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + base.atlas = preload("res://assets/Cauldron's Brew/Equiptment.png") + base.region = Rect2(96, 96, 96, 96) + yellow.atlas = preload("res://assets/Cauldron's Brew/Cauldron and Powder.png") + yellow.region = Rect2(96, 96, 96, 96) + orange.atlas = preload("res://assets/Cauldron's Brew/Cauldron and Powder.png") + orange.region = Rect2(192, 96, 96, 96) + red.atlas = preload("res://assets/Cauldron's Brew/Cauldron and Powder.png") + red.region = Rect2(288, 96, 96, 96) + slots = [$Empty1, $Empty2, $Empty3] + colors = [base, yellow, red, orange] + enrich_burning_colors() + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + pass + +func change_texture(slot_index: int, color_index: int): + slots[slot_index].texture = colors[color_index] + slot_states[slot_index] = color_index + pass + +func reset_texture(): + for slot in slots: + slot.texture = colors[0] + slot_states = [0,0,0] + +func ignite_cauldrons(): + for i in slots.size(): + slots[i].texture = burning_colors[slot_states[i]] + await get_tree().create_timer(0.4).timeout + pass + +func enrich_burning_colors(): + for color in colors: + var burning = AtlasTexture.new() + burning.atlas = color.atlas + burning.region = Rect2(color.region.position.x, color.region.position.y + 96, 96, 96) + burning_colors.append(burning) diff --git a/cauldron_bar.gd.uid b/cauldron_bar.gd.uid new file mode 100644 index 0000000..7ed5068 --- /dev/null +++ b/cauldron_bar.gd.uid @@ -0,0 +1 @@ +uid://cmsa82hi6q552 diff --git a/scenes/apple.tscn b/scenes/apple.tscn index 6c73f68..e32cd1e 100644 --- a/scenes/apple.tscn +++ b/scenes/apple.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://dm6d2jg52vi41"] -[ext_resource type="Script" uid="uid://bewhtchahb2sy" path="res://scenes/apple.gd" id="1_7vr8k"] +[ext_resource type="Script" uid="uid://bewhtchahb2sy" path="res://scripts/apple.gd" id="1_7vr8k"] [ext_resource type="Texture2D" uid="uid://d2pinnrigixnp" path="res://assets/16x16 Pixelart Food Icons/Pixel_Foods(ARTLİNE).png" id="1_h071m"] [sub_resource type="AtlasTexture" id="AtlasTexture_7vr8k"] diff --git a/scenes/camera_2d.gd b/scenes/camera_2d.gd deleted file mode 100644 index 494d5cc..0000000 --- a/scenes/camera_2d.gd +++ /dev/null @@ -1,14 +0,0 @@ -var shake_duration = 0.0 -var shake_intensity = 5.0 - -func shake(duration: float, intensity: float) -> void: - shake_duration = duration - shake_intensity = intensity - -func _process(delta: float) -> void: - if shake_duration > 0: - shake_duration -= delta - offset = Vector2(randf_range(-shake_intensity, shake_intensity), - randf_range(-shake_intensity, shake_intensity)) - else: - offset = Vector2.ZERO diff --git a/scenes/camera_2d.gd.uid b/scenes/camera_2d.gd.uid deleted file mode 100644 index 9229c6d..0000000 --- a/scenes/camera_2d.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://c3l43auluybdg diff --git a/scenes/witch.tscn b/scenes/witch.tscn index 546204e..0bae16d 100644 --- a/scenes/witch.tscn +++ b/scenes/witch.tscn @@ -2,6 +2,9 @@ [ext_resource type="Script" uid="uid://lrvml2008cwk" path="res://scripts/witch.gd" id="1_b1vsk"] [ext_resource type="Texture2D" uid="uid://dw8pn36yok5jq" path="res://assets/Witch/PNG/24x32/witch-002-SWEN.png" id="1_hgjeu"] +[ext_resource type="Script" uid="uid://cmsa82hi6q552" path="res://cauldron_bar.gd" id="3_53435"] +[ext_resource type="Texture2D" uid="uid://484stlylp2nk" path="res://assets/Cauldron's Brew/Equiptment.png" id="4_qrkn2"] +[ext_resource type="Texture2D" uid="uid://c2sji04ufhh60" path="res://assets/Cauldron's Brew/Cauldron and Powder.png" id="5_vid1f"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_gyfn7"] radius = 6.0 @@ -246,6 +249,14 @@ animations = [{ "speed": 5.0 }] +[sub_resource type="AtlasTexture" id="AtlasTexture_f4ghg"] +atlas = ExtResource("4_qrkn2") +region = Rect2(96, 96, 96, 96) + +[sub_resource type="AtlasTexture" id="AtlasTexture_gyfn7"] +atlas = ExtResource("5_vid1f") +region = Rect2(288, 192, 96, 96) + [node name="Witch" type="CharacterBody2D" unique_id=1188927311] script = ExtResource("1_b1vsk") @@ -259,3 +270,38 @@ sprite_frames = SubResource("SpriteFrames_f4ghg") animation = &"south" autoplay = "south" frame_progress = 0.9113742 + +[node name="CauldronBar" type="HBoxContainer" parent="." unique_id=1541519739] +modulate = Color(1, 1, 1, 0.8627451) +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -148.0 +offset_top = -25.0 +offset_right = 152.0 +offset_bottom = 71.0 +grow_horizontal = 2 +scale = Vector2(0.15, 0.15) +pivot_offset = Vector2(148, 0) +theme_override_constants/separation = 3 +script = ExtResource("3_53435") + +[node name="Empty1" type="TextureRect" parent="CauldronBar" unique_id=558816321] +texture_filter = 1 +layout_mode = 2 +texture = SubResource("AtlasTexture_f4ghg") + +[node name="Empty2" type="TextureRect" parent="CauldronBar" unique_id=725646191] +texture_filter = 1 +layout_mode = 2 +texture = SubResource("AtlasTexture_f4ghg") + +[node name="Empty3" type="TextureRect" parent="CauldronBar" unique_id=915596891] +texture_filter = 1 +layout_mode = 2 +texture = SubResource("AtlasTexture_f4ghg") + +[node name="Yellow" type="TextureRect" parent="CauldronBar" unique_id=303814367] +visible = false +layout_mode = 2 +texture = SubResource("AtlasTexture_gyfn7") diff --git a/scenes/apple.gd b/scripts/apple.gd similarity index 100% rename from scenes/apple.gd rename to scripts/apple.gd diff --git a/scenes/apple.gd.uid b/scripts/apple.gd.uid similarity index 100% rename from scenes/apple.gd.uid rename to scripts/apple.gd.uid diff --git a/scripts/witch.gd b/scripts/witch.gd index 3622e96..379bfb8 100644 --- a/scripts/witch.gd +++ b/scripts/witch.gd @@ -1,7 +1,7 @@ extends CharacterBody2D var camera -var test_apocalypse = 0 +var bar_progress = 0 func _ready() -> void: camera = get_node("/root/Game/Camera2D") @@ -10,9 +10,12 @@ func _physics_process(delta: float) -> void: pass func _on_collect(DropsBase): - test_apocalypse += 1 - if test_apocalypse == 3: + + $CauldronBar.change_texture(bar_progress,3) + bar_progress += 1 + if bar_progress == 3: + await $CauldronBar.ignite_cauldrons() get_tree().call_group("enemies", "_die") - test_apocalypse = 0 camera.shake(0.3,0.8) - pass + bar_progress = 0 + $CauldronBar.reset_texture()