All
This commit is contained in:
parent
7a8ee29dcb
commit
0fe23420ab
800 changed files with 16547 additions and 0 deletions
34
scenes/button.tscn
Normal file
34
scenes/button.tscn
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://b0bmsqlrg77le"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dx134esqj3kg3" path="res://assets/ui/buttonLong_brown.png" id="1_1bdt2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bmdc4875jf16r" path="res://assets/ui/buttonLong_brown_pressed.png" id="2_8m7bo"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddghl4cooepr1" path="res://assets/ui/buttonLong_blue.png" id="3_t81cg"]
|
||||
[ext_resource type="Texture2D" uid="uid://f0tde4s55m2o" path="res://assets/ui/buttonLong_grey.png" id="4_is61r"]
|
||||
[ext_resource type="Script" uid="uid://dj7uoaxxat5n4" path="res://scenes/scripts/button.gd" id="5_8m7bo"]
|
||||
[ext_resource type="Theme" uid="uid://bnbtwoxxd6cg5" path="res://assets/theme/clicker.theme" id="5_iw4ej"]
|
||||
|
||||
[node name="TextureButton" type="TextureButton"]
|
||||
custom_minimum_size = Vector2(100, 25)
|
||||
offset_right = 100.0
|
||||
offset_bottom = 25.0
|
||||
tooltip_text = "I need a tooltip bro"
|
||||
texture_normal = ExtResource("1_1bdt2")
|
||||
texture_pressed = ExtResource("2_8m7bo")
|
||||
texture_hover = ExtResource("3_t81cg")
|
||||
texture_disabled = ExtResource("4_is61r")
|
||||
ignore_texture_size = true
|
||||
stretch_mode = 0
|
||||
script = ExtResource("5_8m7bo")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(100, 25)
|
||||
layout_mode = 0
|
||||
offset_right = 100.0
|
||||
offset_bottom = 25.0
|
||||
|
||||
[node name="Label" type="Label" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("5_iw4ej")
|
||||
text = "-"
|
||||
horizontal_alignment = 1
|
||||
139
scenes/character.tscn
Normal file
139
scenes/character.tscn
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
[gd_scene load_steps=19 format=3 uid="uid://cbrkq6jd5a4ho"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://blw846ag1hiak" path="res://assets/characters/warrior.png" id="1_agfs1"]
|
||||
[ext_resource type="Texture2D" uid="uid://ckvge3k08px5c" path="res://assets/tiles/sun.png" id="2_rkhd4"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_rkhd4"]
|
||||
atlas = ExtResource("1_agfs1")
|
||||
region = Rect2(0, 0, 80, 68)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_lrhn5"]
|
||||
atlas = ExtResource("1_agfs1")
|
||||
region = Rect2(80, 0, 80, 68)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_my7n2"]
|
||||
atlas = ExtResource("1_agfs1")
|
||||
region = Rect2(160, 0, 80, 68)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_dp8ca"]
|
||||
atlas = ExtResource("1_agfs1")
|
||||
region = Rect2(240, 0, 80, 68)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_0lw5n"]
|
||||
atlas = ExtResource("1_agfs1")
|
||||
region = Rect2(320, 0, 80, 68)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_dkjbp"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 0.2,
|
||||
"texture": SubResource("AtlasTexture_rkhd4")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_lrhn5")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_my7n2")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_dp8ca")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_0lw5n")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"idle",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [],
|
||||
"loop": true,
|
||||
"name": &"new_animation",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="Curve" id="Curve_lrhn5"]
|
||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_okhi1"]
|
||||
curve = SubResource("Curve_lrhn5")
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_my7n2"]
|
||||
colors = PackedColorArray(0.6267965, 0.35946804, 0.115510084, 0.3764706, 0.5640522, 0.46861154, 0.16076079, 0.627451)
|
||||
|
||||
[sub_resource type="GradientTexture1D" id="GradientTexture1D_rkhd4"]
|
||||
gradient = SubResource("Gradient_my7n2")
|
||||
|
||||
[sub_resource type="Curve" id="Curve_dp8ca"]
|
||||
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_deeqb"]
|
||||
curve = SubResource("Curve_dp8ca")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_0lw5n"]
|
||||
lifetime_randomness = 0.73
|
||||
particle_flag_disable_z = true
|
||||
emission_shape = 1
|
||||
emission_sphere_radius = 1.0
|
||||
angle_min = 1.0728835e-05
|
||||
angle_max = 115.70001
|
||||
inherit_velocity_ratio = 0.154
|
||||
direction = Vector3(0, 0, 0)
|
||||
spread = 98.933
|
||||
initial_velocity_max = 2.0
|
||||
gravity = Vector3(0, 0, 0)
|
||||
linear_accel_min = 0.99999774
|
||||
linear_accel_max = 4.9999976
|
||||
scale_min = 0.19999999
|
||||
scale_max = 0.7
|
||||
scale_curve = SubResource("CurveTexture_deeqb")
|
||||
color_ramp = SubResource("GradientTexture1D_rkhd4")
|
||||
alpha_curve = SubResource("CurveTexture_okhi1")
|
||||
hue_variation_min = -0.11000002
|
||||
hue_variation_max = 0.089999974
|
||||
turbulence_enabled = true
|
||||
turbulence_noise_strength = 0.56
|
||||
turbulence_noise_scale = 4.861
|
||||
|
||||
[sub_resource type="Curve" id="Curve_rkhd4"]
|
||||
_data = [Vector2(0, 0.007272601), 0.0, 0.0, 0, 0, Vector2(0.46874994, 0.758909), 0.0, 0.0, 0, 0, Vector2(0.73632807, 0.8865454), 0.0, 0.0, 0, 0]
|
||||
point_count = 3
|
||||
|
||||
[sub_resource type="CurveTexture" id="CurveTexture_lrhn5"]
|
||||
curve = SubResource("Curve_rkhd4")
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_agfs1"]
|
||||
particle_flag_disable_z = true
|
||||
gravity = Vector3(0, 0, 0)
|
||||
linear_accel_min = -2.2351742e-06
|
||||
linear_accel_max = 6.4299974
|
||||
radial_accel_min = -2.2351742e-06
|
||||
radial_accel_max = 23.289997
|
||||
tangential_accel_min = -24.100002
|
||||
tangential_accel_max = 10.439998
|
||||
color = Color(0.84313726, 0.56078434, 0, 0.7921569)
|
||||
alpha_curve = SubResource("CurveTexture_lrhn5")
|
||||
|
||||
[node name="Character" type="Node2D"]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_dkjbp")
|
||||
animation = &"idle"
|
||||
autoplay = "idle"
|
||||
frame_progress = 0.55149776
|
||||
|
||||
[node name="Dust" type="GPUParticles2D" parent="."]
|
||||
position = Vector2(0, 11)
|
||||
amount = 100
|
||||
texture = ExtResource("2_rkhd4")
|
||||
lifetime = 10.0
|
||||
preprocess = 2.0
|
||||
explosiveness = 0.06
|
||||
randomness = 0.39
|
||||
process_material = SubResource("ParticleProcessMaterial_0lw5n")
|
||||
|
||||
[node name="Shavings" type="GPUParticles2D" parent="."]
|
||||
position = Vector2(0, 8)
|
||||
preprocess = 2.0
|
||||
process_material = SubResource("ParticleProcessMaterial_agfs1")
|
||||
3
scenes/game.tscn
Normal file
3
scenes/game.tscn
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[gd_scene format=3 uid="uid://duhwm7m5hc506"]
|
||||
|
||||
[node name="Game" type="Node3D"]
|
||||
2118
scenes/game2.tscn
Normal file
2118
scenes/game2.tscn
Normal file
File diff suppressed because it is too large
Load diff
21
scenes/scripts/arrow.gd
Normal file
21
scenes/scripts/arrow.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
extends Sprite2D
|
||||
|
||||
@export var bounce_height: float = 10.0 # How high it bounces in pixels
|
||||
@export var bounce_duration: float = 0.5 # Time for one bounce cycle
|
||||
var tween: Tween
|
||||
var start_position: Vector2
|
||||
|
||||
func _ready():
|
||||
start_position = position
|
||||
start_continuous_bounce()
|
||||
|
||||
func start_continuous_bounce():
|
||||
tween = create_tween()
|
||||
tween.set_loops() # Makes it loop infinitely
|
||||
tween.tween_property(self, "position:y", start_position.y - bounce_height, bounce_duration / 2)
|
||||
tween.tween_property(self, "position:y", start_position.y, bounce_duration / 2)
|
||||
|
||||
func stop_bounce():
|
||||
if tween:
|
||||
tween.kill()
|
||||
position = start_position
|
||||
1
scenes/scripts/arrow.gd.uid
Normal file
1
scenes/scripts/arrow.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://i6lg61o0jnkp
|
||||
58
scenes/scripts/button.gd
Normal file
58
scenes/scripts/button.gd
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
extends TextureButton
|
||||
@onready var label: Label = $CenterContainer/Label # Adjust path to your Label node
|
||||
|
||||
var unlock_id = "" # Store the unlock ID
|
||||
|
||||
func _ready():
|
||||
label.visible = false # Hide label initially
|
||||
adjust_label_font_size()
|
||||
# Connect the pressed signal
|
||||
pressed.connect(_on_button_pressed)
|
||||
|
||||
func setup(unlock_data):
|
||||
Log.pr("Setting up button for unlock:", unlock_data.unlock_name)
|
||||
unlock_id = unlock_data.unlock_id # Store the ID
|
||||
if label:
|
||||
label.visible = false
|
||||
label.text = unlock_data.unlock_name + " " + str(unlock_data.get_next_rank())
|
||||
label.text = label.text + " - " + Global.currency_symbol + str(unlock_data.get_next_cost())
|
||||
label.text = label.text + "\n" + unlock_data.get_next_modifiers_string()
|
||||
#self.disabled = unlock_data.is_unlocked
|
||||
adjust_label_font_size()
|
||||
else:
|
||||
Log.pr("Warning: Label node not found in button.")
|
||||
|
||||
func _on_button_pressed():
|
||||
Log.pr("Button pressed, unlocking item:", unlock_id)
|
||||
Unlocks.unlock_item(unlock_id)
|
||||
|
||||
func adjust_label_font_size():
|
||||
if not label:
|
||||
return
|
||||
var available_width = size.x - 10
|
||||
var available_height = size.y - 10
|
||||
# Start with a reasonable font size
|
||||
var font_size = 32
|
||||
var min_font_size = 8
|
||||
# Get or create a font
|
||||
var font = label.get_theme_font("font")
|
||||
# Binary search for the optimal font size
|
||||
while font_size > min_font_size:
|
||||
label.add_theme_font_size_override("font_size", font_size)
|
||||
# Force update and get the actual text size
|
||||
await get_tree().process_frame
|
||||
var text_size = font.get_string_size(label.text, HORIZONTAL_ALIGNMENT_LEFT, -1, font_size)
|
||||
# Check if it fits
|
||||
if text_size.x <= available_width and text_size.y <= available_height:
|
||||
break
|
||||
# Reduce font size and try again
|
||||
font_size -= 1
|
||||
label.add_theme_font_size_override("font_size", font_size)
|
||||
label.visible = true # Show label after resizing is complete
|
||||
|
||||
# Call this function whenever you change the label text
|
||||
func set_label_text(new_text: String):
|
||||
if label:
|
||||
label.visible = false # Hide while resizing
|
||||
label.text = new_text
|
||||
adjust_label_font_size()
|
||||
1
scenes/scripts/button.gd.uid
Normal file
1
scenes/scripts/button.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dj7uoaxxat5n4
|
||||
25
scenes/scripts/fire_light.gd
Normal file
25
scenes/scripts/fire_light.gd
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
extends PointLight2D
|
||||
|
||||
# Flicker parameters
|
||||
@export var flicker_speed: float = 10.0 # How fast the flicker changes
|
||||
@export var flicker_intensity: float = 0.3 # How much it flickers (0-1)
|
||||
@export var base_energy: float = 1.0 # Base brightness
|
||||
|
||||
# For smooth variation
|
||||
var time_passed: float = 0.0
|
||||
|
||||
func _ready():
|
||||
# Store the initial energy value
|
||||
energy = base_energy
|
||||
|
||||
func _process(delta):
|
||||
time_passed += delta * flicker_speed
|
||||
|
||||
# Use Perlin-like noise for natural flickering
|
||||
var flicker = sin(time_passed) * 0.5 + 0.5 # 0 to 1
|
||||
flicker += sin(time_passed * 2.3) * 0.3 # Add secondary variation
|
||||
flicker += sin(time_passed * 4.7) * 0.2 # Add tertiary variation
|
||||
flicker /= 2.0 # Normalize
|
||||
|
||||
# Apply flicker to energy
|
||||
energy = base_energy + (flicker - 0.5) * flicker_intensity * 2.0
|
||||
1
scenes/scripts/fire_light.gd.uid
Normal file
1
scenes/scripts/fire_light.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cpimo8q5dcjxf
|
||||
101
scenes/scripts/ui_control.gd
Normal file
101
scenes/scripts/ui_control.gd
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
extends Control
|
||||
|
||||
@onready var currency_label: Label = %CurrencyLabel
|
||||
@onready var wood_label: Label = %WoodLabel
|
||||
@onready var stock_label: Label = %StockLabel
|
||||
|
||||
@onready var modifiers_label: Label = %ModifiersLabel
|
||||
|
||||
func _ready():
|
||||
populate_modifiers_display()
|
||||
populate_unlock_buttons()
|
||||
update_currency_label()
|
||||
update_wood_label()
|
||||
update_stock_label()
|
||||
|
||||
currency_label.add_theme_color_override("font_color", Global.money_color)
|
||||
wood_label.add_theme_color_override("font_color", Global.wood_color)
|
||||
stock_label.add_theme_color_override("font_color", Global.stock_color)
|
||||
|
||||
Inventory.currency_changed.connect(_on_currency_changed)
|
||||
Inventory.currency_added.connect(spawn_currency_increase)
|
||||
Inventory.wood_changed.connect(_on_currency_changed)
|
||||
Inventory.wood_added.connect(spawn_wood_increase)
|
||||
Inventory.stock_added.connect(spawn_stock_increase)
|
||||
Inventory.stock_changed.connect(_on_currency_changed)
|
||||
Unlocks.item_unlocked.connect(populate_unlock_buttons)
|
||||
|
||||
func update_currency_label():
|
||||
currency_label.text = Global.currency_symbol + " " + str(int(Inventory.get_currency()))
|
||||
|
||||
func update_wood_label():
|
||||
wood_label.text = "W: " + str(int(Inventory.get_wood()))
|
||||
|
||||
func update_stock_label():
|
||||
stock_label.text = "S: " + str(int(Inventory.get_stock()))
|
||||
|
||||
func spawn_currency_increase(value, _total):
|
||||
spawn_inventory_change_value(value, _total, "+", Global.currency_symbol, Global.money_color)
|
||||
|
||||
func spawn_wood_increase(value, _total):
|
||||
spawn_inventory_change_value(value, _total, "+", "", Global.wood_color)
|
||||
|
||||
func spawn_stock_increase(value, _total):
|
||||
spawn_inventory_change_value(value, _total, "+", "", Global.stock_color)
|
||||
|
||||
func spawn_inventory_change_value(value, _total, display_sign: String = "+", symbol: String = "", label_color: Color = Color.WHITE):
|
||||
var float_label = Label.new()
|
||||
float_label.text = display_sign + symbol + str(int(abs(value)))
|
||||
float_label.add_theme_font_size_override("font_size", 16)
|
||||
float_label.modulate = label_color
|
||||
|
||||
# Add random offset around center
|
||||
var random_x = randf_range(-60, 30)
|
||||
var random_y = randf_range(-40, 20)
|
||||
float_label.position = Vector2(random_x, random_y)
|
||||
add_child(float_label)
|
||||
|
||||
# Animate the label
|
||||
var tween = create_tween()
|
||||
tween.set_parallel(true) # Run both animations simultaneously
|
||||
# Move up
|
||||
tween.tween_property(float_label, "position:y", float_label.position.y - 50, 1.0)
|
||||
# Fade out
|
||||
tween.tween_property(float_label, "modulate:a", 0.0, 1.0)
|
||||
# Remove from scene when done
|
||||
tween.chain().tween_callback(float_label.queue_free)
|
||||
|
||||
|
||||
func populate_unlock_buttons():
|
||||
var unlocks_container = $UnlockContainer
|
||||
for child in unlocks_container.get_children():
|
||||
child.free()
|
||||
|
||||
for unlock_data in Unlocks.unlocks.unlocks:
|
||||
var unlock_button_scene = load("res://scenes/button.tscn")
|
||||
var unlock_button = unlock_button_scene.instantiate()
|
||||
unlocks_container.add_child(unlock_button)
|
||||
unlock_button.setup(unlock_data)
|
||||
|
||||
func populate_modifiers_display():
|
||||
var modifiers_text = ""
|
||||
|
||||
modifiers_text = modifiers_text + "Sale Price: " + Global.currency_symbol + str(Unlocks.get_sale_price_per_item()) + "\n"
|
||||
modifiers_text = modifiers_text + "Items Produced Per Tick: " + str(Unlocks.get_items_produced_per_tick()) + "\n"
|
||||
modifiers_text = modifiers_text + "Wood per Click: " + str(Unlocks.get_wood_per_click()) + "\n\n"
|
||||
modifiers_text = modifiers_text + "Demand: " + str(int(Unlocks.get_sale_demand())) + "\n\n"
|
||||
|
||||
modifiers_text = modifiers_text + "Current Modifiers:\n"
|
||||
for key in Unlocks.current_modifiers.keys():
|
||||
var display_name = key.replace("_modifier", "").replace("_", " ").capitalize()
|
||||
var percentage = int((Unlocks.current_modifiers[key] - 1.0) * 100)
|
||||
modifiers_text += "%s: %s%%\n" % [display_name, str(percentage)]
|
||||
|
||||
modifiers_label.text = modifiers_text
|
||||
|
||||
|
||||
func _on_currency_changed(_value):
|
||||
populate_modifiers_display()
|
||||
update_currency_label()
|
||||
update_wood_label()
|
||||
update_stock_label()
|
||||
1
scenes/scripts/ui_control.gd.uid
Normal file
1
scenes/scripts/ui_control.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cm84m3olmcc8o
|
||||
22
scenes/scripts/wood_pile.gd
Normal file
22
scenes/scripts/wood_pile.gd
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
extends Sprite2D
|
||||
|
||||
@export var fade_duration: float = 0.5
|
||||
var tween: Tween
|
||||
|
||||
func _ready():
|
||||
# Start with outline invisible
|
||||
material.set_shader_parameter("outline_alpha", 0.0)
|
||||
start_continuous_fade()
|
||||
|
||||
func start_continuous_fade():
|
||||
tween = create_tween()
|
||||
tween.set_loops() # Makes it loop infinitely
|
||||
tween.tween_method(set_outline_alpha, 0.0, 1.0, fade_duration)
|
||||
tween.tween_method(set_outline_alpha, 1.0, 0.0, fade_duration)
|
||||
|
||||
func set_outline_alpha(value: float):
|
||||
material.set_shader_parameter("outline_alpha", value)
|
||||
|
||||
func stop_fade():
|
||||
if tween:
|
||||
tween.kill()
|
||||
1
scenes/scripts/wood_pile.gd.uid
Normal file
1
scenes/scripts/wood_pile.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://nntb8jg35j6j
|
||||
93
scenes/scripts/wood_pile_interaction.gd
Normal file
93
scenes/scripts/wood_pile_interaction.gd
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
extends Node2D
|
||||
|
||||
@onready var area = $ClickArea
|
||||
@onready var arrow = $Arrow
|
||||
|
||||
var respawn_timer: Timer
|
||||
var original_y: float = 0.0
|
||||
|
||||
func _ready():
|
||||
area.input_event.connect(_on_area_input_event)
|
||||
area.mouse_entered.connect(_on_mouse_entered)
|
||||
area.mouse_exited.connect(_on_mouse_exited)
|
||||
|
||||
# Create the respawn timer
|
||||
respawn_timer = Timer.new()
|
||||
respawn_timer.one_shot = true
|
||||
respawn_timer.timeout.connect(_on_respawn_timer_timeout)
|
||||
add_child(respawn_timer)
|
||||
|
||||
func _on_area_input_event(_viewport, event, _shape_idx):
|
||||
if event is InputEventMouseButton:
|
||||
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||
on_clicked()
|
||||
|
||||
func _on_mouse_entered():
|
||||
Input.set_default_cursor_shape(Input.CURSOR_POINTING_HAND)
|
||||
|
||||
func _on_mouse_exited():
|
||||
Input.set_default_cursor_shape(Input.CURSOR_ARROW)
|
||||
|
||||
func on_clicked():
|
||||
Audio.play_chop_sound()
|
||||
Inventory.add_wood(Unlocks.get_wood_per_click())
|
||||
play_pop_animation()
|
||||
|
||||
func play_pop_animation():
|
||||
arrow.visible = false
|
||||
|
||||
# Store original position for reset
|
||||
original_y = position.y
|
||||
|
||||
# Create a tween for smooth animation
|
||||
var tween = create_tween()
|
||||
tween.set_parallel(true) # Run animations simultaneously
|
||||
|
||||
# Scale up quickly (pop effect)
|
||||
tween.tween_property(self, "scale", scale * 1.3, 0.1).set_ease(Tween.EASE_OUT)
|
||||
|
||||
# Fade out
|
||||
tween.tween_property(self, "modulate:a", 0.0, 0.2)
|
||||
|
||||
# Optional: slight upward movement for extra effect
|
||||
tween.tween_property(self, "position:y", position.y - 3, 0.2)
|
||||
|
||||
# Hide and disable, then start respawn timer
|
||||
tween.finished.connect(func():
|
||||
visible = false
|
||||
area.monitoring = false
|
||||
area.monitorable = false
|
||||
|
||||
# Start the respawn timer with the value from Unlocks
|
||||
var respawn_time = Unlocks.get_wood_respawn_time()
|
||||
respawn_timer.start(respawn_time)
|
||||
)
|
||||
|
||||
func _on_respawn_timer_timeout():
|
||||
pop_back_in()
|
||||
|
||||
func pop_back_in():
|
||||
if visible:
|
||||
return # Already visible
|
||||
|
||||
position.y = original_y
|
||||
|
||||
# Reset properties
|
||||
visible = true
|
||||
arrow.visible = true
|
||||
area.monitoring = true
|
||||
area.monitorable = true
|
||||
|
||||
# Create a tween for the pop-in animation
|
||||
var tween = create_tween()
|
||||
tween.set_parallel(true)
|
||||
|
||||
# Start from scaled down and transparent
|
||||
scale = Vector2.ONE * 0.7
|
||||
modulate.a = 0.0
|
||||
|
||||
# Scale up to normal
|
||||
tween.tween_property(self, "scale", Vector2.ONE, 0.2).set_ease(Tween.EASE_OUT)
|
||||
|
||||
# Fade in
|
||||
tween.tween_property(self, "modulate:a", 1.0, 0.2)
|
||||
1
scenes/scripts/wood_pile_interaction.gd.uid
Normal file
1
scenes/scripts/wood_pile_interaction.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dw8q7mx6co84v
|
||||
25
scenes/stock_pile.tscn
Normal file
25
scenes/stock_pile.tscn
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cnyxwsj6i27ja"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cu6cgp6q0hl2o" path="res://assets/tiles/Decor.png" id="1_8wwdp"]
|
||||
|
||||
[node name="StockPile" type="Node2D"]
|
||||
|
||||
[node name="BoxSprite2" type="Sprite2D" parent="."]
|
||||
position = Vector2(22, -8)
|
||||
texture = ExtResource("1_8wwdp")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(33.91002, 0.009158134, 27.459976, 32.36215)
|
||||
|
||||
[node name="BoxSprite1" type="Sprite2D" parent="."]
|
||||
position = Vector2(703, 338)
|
||||
texture = ExtResource("1_8wwdp")
|
||||
offset = Vector2(-703, -338)
|
||||
region_enabled = true
|
||||
region_rect = Rect2(2.1627102, 15.374939, 26.802752, 17.392681)
|
||||
|
||||
[node name="BoxSprite3" type="Sprite2D" parent="."]
|
||||
position = Vector2(753, 338)
|
||||
texture = ExtResource("1_8wwdp")
|
||||
offset = Vector2(-703, -338)
|
||||
region_enabled = true
|
||||
region_rect = Rect2(2.1627102, 15.374939, 26.802752, 17.392681)
|
||||
44
scenes/wood_pile.tscn
Normal file
44
scenes/wood_pile.tscn
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://bubjxrs8qmr4y"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dw8q7mx6co84v" path="res://scenes/scripts/wood_pile_interaction.gd" id="1_akglv"]
|
||||
[ext_resource type="Shader" uid="uid://dadchcj2lrp2l" path="res://shaders/glow.gdshader" id="1_djslm"]
|
||||
[ext_resource type="Texture2D" uid="uid://cu6cgp6q0hl2o" path="res://assets/tiles/Decor.png" id="2_akglv"]
|
||||
[ext_resource type="Script" uid="uid://nntb8jg35j6j" path="res://scenes/scripts/wood_pile.gd" id="3_ayqi8"]
|
||||
[ext_resource type="Texture2D" uid="uid://w4ohc0xysdl7" path="res://assets/ui/arrowBlue_right.png" id="4_ynj3s"]
|
||||
[ext_resource type="Script" uid="uid://i6lg61o0jnkp" path="res://scenes/scripts/arrow.gd" id="5_87nld"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_q7h7c"]
|
||||
shader = ExtResource("1_djslm")
|
||||
shader_parameter/outline_color = Color(0.94509804, 0.92156863, 0.42352942, 1)
|
||||
shader_parameter/outline_width = 1.0
|
||||
shader_parameter/outline_alpha = 1.0
|
||||
|
||||
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_akglv"]
|
||||
radius = 31.0
|
||||
height = 72.0
|
||||
|
||||
[node name="WoodPile" type="Node2D"]
|
||||
script = ExtResource("1_akglv")
|
||||
|
||||
[node name="WoodSprite" type="Sprite2D" parent="."]
|
||||
material = SubResource("ShaderMaterial_q7h7c")
|
||||
texture = ExtResource("2_akglv")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(200.15366, 74.126976, 48.803345, 22.335625)
|
||||
script = ExtResource("3_ayqi8")
|
||||
fade_duration = 1.0
|
||||
|
||||
[node name="Arrow" type="Sprite2D" parent="."]
|
||||
position = Vector2(-1, -32)
|
||||
rotation = 1.5707964
|
||||
scale = Vector2(0.6, 0.6)
|
||||
texture = ExtResource("4_ynj3s")
|
||||
script = ExtResource("5_87nld")
|
||||
bounce_height = 6.0
|
||||
bounce_duration = 3.0
|
||||
|
||||
[node name="ClickArea" type="Area2D" parent="."]
|
||||
|
||||
[node name="ClickShape" type="CollisionShape2D" parent="ClickArea"]
|
||||
position = Vector2(1, -10)
|
||||
shape = SubResource("CapsuleShape2D_akglv")
|
||||
Loading…
Add table
Add a link
Reference in a new issue