Added Cauldrons and bruning Animation

pull/1/head
Artur David 2026-04-14 09:33:50 +02:00
parent 1b90d6296d
commit abb24b227e
11 changed files with 109 additions and 21 deletions

BIN
.DS_Store vendored

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 9.9 KiB

53
cauldron_bar.gd 100644
View File

@ -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)

View File

@ -0,0 +1 @@
uid://cmsa82hi6q552

View File

@ -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"]

View File

@ -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

View File

@ -1 +0,0 @@
uid://c3l43auluybdg

View File

@ -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")

View File

@ -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()