added cauldron juiciness
parent
56afc148f1
commit
d8acddeaea
|
|
@ -0,0 +1,66 @@
|
|||
[gd_scene format=3 uid="uid://dg8vanuerts1t"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c176y1113cvdw" path="res://scripts/level_up_particles.gd" id="1_lvlup"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_purple"]
|
||||
colors = PackedColorArray(0.75, 0.2, 1, 1, 0.4, 0.05, 0.8, 0.35)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradTex_purple"]
|
||||
gradient = SubResource("Gradient_purple")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="Mat_purple"]
|
||||
emission_shape = 3
|
||||
emission_box_extents = Vector3(3, 5, 0)
|
||||
direction = Vector3(0, -1, 0)
|
||||
spread = 8.0
|
||||
initial_velocity_min = 25.0
|
||||
initial_velocity_max = 40.0
|
||||
gravity = Vector3(0, 12, 0)
|
||||
scale_min = 1.5
|
||||
scale_max = 3.0
|
||||
color_ramp = SubResource("GradTex_purple")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_yellow"]
|
||||
colors = PackedColorArray(1, 0.9, 0.1, 1, 0.9, 0.5, 0, 0.35)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradTex_yellow"]
|
||||
gradient = SubResource("Gradient_yellow")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="Mat_yellow"]
|
||||
emission_shape = 3
|
||||
emission_box_extents = Vector3(3, 5, 0)
|
||||
direction = Vector3(0, -1, 0)
|
||||
spread = 8.0
|
||||
initial_velocity_min = 25.0
|
||||
initial_velocity_max = 40.0
|
||||
gravity = Vector3(0, 12, 0)
|
||||
scale_min = 1.5
|
||||
scale_max = 3.0
|
||||
color_ramp = SubResource("GradTex_yellow")
|
||||
|
||||
[node name="LevelUpParticles" type="Node2D" unique_id=260593337]
|
||||
script = ExtResource("1_lvlup")
|
||||
|
||||
[node name="Burst1" type="GPUParticles2D" parent="." unique_id=1316703941]
|
||||
emitting = false
|
||||
amount = 14
|
||||
lifetime = 0.65
|
||||
one_shot = true
|
||||
explosiveness = 0.9
|
||||
process_material = SubResource("Mat_purple")
|
||||
|
||||
[node name="Burst2" type="GPUParticles2D" parent="." unique_id=684638951]
|
||||
emitting = false
|
||||
amount = 14
|
||||
lifetime = 0.65
|
||||
one_shot = true
|
||||
explosiveness = 0.9
|
||||
process_material = SubResource("Mat_yellow")
|
||||
|
||||
[node name="Burst3" type="GPUParticles2D" parent="." unique_id=373983562]
|
||||
emitting = false
|
||||
amount = 14
|
||||
lifetime = 0.65
|
||||
one_shot = true
|
||||
explosiveness = 0.9
|
||||
process_material = SubResource("Mat_purple")
|
||||
|
|
@ -15,9 +15,9 @@ var brew_explosion = true
|
|||
@onready var witch = get_parent()
|
||||
var explosion_scene = preload("res://scenes/explosion.tscn")
|
||||
var _ignite_sfx = preload("res://assets/music&sfx/sfx/data_pion-sfx9-fwoosh-324525.mp3")
|
||||
var _ignite_player: AudioStreamPlayer# Called when the node enters the scene tree for the first time.
|
||||
var _ignite_player: AudioStreamPlayer
|
||||
var _slot_shake_tweens: Array = []
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
print(witch)
|
||||
base.atlas = preload("res://assets/Cauldron's Brew/Equiptment.png")
|
||||
|
|
@ -49,15 +49,21 @@ func change_texture(slot_index: int, color_index: int):
|
|||
pass
|
||||
|
||||
func reset_texture():
|
||||
for slot in slots:
|
||||
slot.texture = colors[0]
|
||||
slot_states = [0,0,0]
|
||||
for t in _slot_shake_tweens:
|
||||
if t:
|
||||
t.kill()
|
||||
_slot_shake_tweens.clear()
|
||||
for i in slots.size():
|
||||
slots[i].texture = colors[0]
|
||||
slots[i].rotation = 0.0
|
||||
slot_states = [0, 0, 0]
|
||||
|
||||
func ignite_cauldrons():
|
||||
for i in slots.size():
|
||||
slots[i].texture = burning_colors[slot_states[i]]
|
||||
_ignite_player.pitch_scale = randf_range(0.8, 1.2)
|
||||
_ignite_player.play()
|
||||
_slot_shake_tweens.append(_make_slot_shake(slots[i]))
|
||||
await get_tree().create_timer(0.4).timeout
|
||||
if brew_explosion:
|
||||
var boom = explosion_scene.instantiate()
|
||||
|
|
@ -77,16 +83,32 @@ func enrich_burning_colors():
|
|||
func progres_bar(fruit):
|
||||
if is_brewing:
|
||||
return
|
||||
if fruit is Apple:
|
||||
change_texture(progres_index,2)
|
||||
if fruit is Apple:
|
||||
change_texture(progres_index, 2)
|
||||
if fruit is Grape:
|
||||
change_texture(progres_index, 4)
|
||||
_pop_slot(progres_index)
|
||||
progres_index += 1
|
||||
if progres_index == 3:
|
||||
brew(slot_states)
|
||||
progres_index = 0
|
||||
pass
|
||||
|
||||
func _pop_slot(slot_index: int) -> void:
|
||||
var slot = slots[slot_index]
|
||||
slot.pivot_offset = slot.size / 2
|
||||
slot.scale = Vector2(1.35, 1.35)
|
||||
var t = create_tween()
|
||||
t.tween_property(slot, "scale", Vector2(1.0, 1.0), 0.18).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
|
||||
|
||||
func _make_slot_shake(slot: TextureRect) -> Tween:
|
||||
slot.pivot_offset = slot.size / 2
|
||||
var t = create_tween().set_loops()
|
||||
t.tween_property(slot, "rotation", 0.015, 0.05)
|
||||
t.tween_property(slot, "rotation", -0.015, 0.05)
|
||||
t.tween_property(slot, "rotation", 0.0, 0.05)
|
||||
return t
|
||||
|
||||
func brew(fruits):
|
||||
is_brewing = true
|
||||
await ignite_cauldrons()
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ var player = AudioStreamPlayer.new()
|
|||
var select_player = AudioStreamPlayer.new()
|
||||
var shuffle_player = AudioStreamPlayer.new()
|
||||
@onready var perkCard = preload("res://scenes/PerkCard.tscn")
|
||||
var _particles_scene = preload("res://scenes/level_up_particles.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
perks = perk_effects.available_perks
|
||||
|
|
@ -50,8 +51,17 @@ func show_perks():
|
|||
func select_perk(perk):
|
||||
perk.effect.call()
|
||||
get_tree().paused = false
|
||||
_spawn_level_up_particles(get_node("/root/Game/Witch").global_position)
|
||||
_spawn_level_up_particles(get_node("/root/Game/Player").global_position)
|
||||
perks.erase(perk)
|
||||
for child in $HBoxContainer.get_children(): child.queue_free()
|
||||
var tween = create_tween()
|
||||
tween.tween_property($ColorRect, "color:a", 0.0, 0.3)
|
||||
await tween.finished
|
||||
|
||||
func _spawn_level_up_particles(pos: Vector2) -> void:
|
||||
var p = _particles_scene.instantiate()
|
||||
p.global_position = pos
|
||||
p.z_index = 10
|
||||
get_node("/root/Game").add_child(p)
|
||||
get_tree().create_timer(1.2).timeout.connect(p.queue_free)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
extends Node2D
|
||||
|
||||
func _ready() -> void:
|
||||
$Burst1.emitting = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
$Burst2.emitting = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
$Burst3.emitting = true
|
||||
|
|
@ -0,0 +1 @@
|
|||
uid://c176y1113cvdw
|
||||
Loading…
Reference in New Issue