cauldron change color based on collected fruits

pull/1/head
Artur David 2026-04-14 16:35:50 +02:00
parent 574640e2da
commit e89b80a825
5 changed files with 17 additions and 6 deletions

View File

@ -255,7 +255,7 @@ region = Rect2(96, 96, 96, 96)
[sub_resource type="AtlasTexture" id="AtlasTexture_gyfn7"]
atlas = ExtResource("5_vid1f")
region = Rect2(288, 192, 96, 96)
region = Rect2(480, 96, 96, 96)
[node name="Witch" type="CharacterBody2D" unique_id=1188927311]
script = ExtResource("1_b1vsk")

View File

@ -1,5 +1,5 @@
extends DropsBase
class_name Apple
# Called when the node enters the scene tree for the first time.

View File

@ -4,6 +4,7 @@ var base = AtlasTexture.new()
var yellow = AtlasTexture.new()
var orange = AtlasTexture.new()
var red = AtlasTexture.new()
var purple = AtlasTexture.new()
var slots: Array[TextureRect] = []
var colors: Array[AtlasTexture] = []
var burning_colors: Array[AtlasTexture] = []
@ -19,8 +20,10 @@ func _ready() -> void:
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)
purple.atlas = preload("res://assets/Cauldron's Brew/Cauldron and Powder.png")
purple.region = Rect2(480, 96, 96, 96)
slots = [$Empty1, $Empty2, $Empty3]
colors = [base, yellow, red, orange]
colors = [base, yellow, red, orange, purple]
enrich_burning_colors()
pass # Replace with function body.
@ -51,3 +54,11 @@ func enrich_burning_colors():
burning.atlas = color.atlas
burning.region = Rect2(color.region.position.x, color.region.position.y + 96, 96, 96)
burning_colors.append(burning)
func progres_bar(fruit, progress):
if fruit is Apple:
change_texture(progress,3)
if fruit is Grape:
change_texture(progress, 4)
pass

View File

@ -1,4 +1,4 @@
extends DropsBase
class_name Grape
# Called when the node enters the scene tree for the first time.

View File

@ -16,7 +16,7 @@ func _physics_process(delta: float) -> void:
func _on_collect(DropsBase):
if is_casting:
return
$CauldronBar.change_texture(bar_progress,3)
$CauldronBar.progres_bar(DropsBase, bar_progress)
bar_progress += 1
if bar_progress == 3:
bar_progress = 0