mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-21 15:24:18 +00:00
Panelino
This commit is contained in:
parent
31d2af50cb
commit
af63dff132
14 changed files with 295 additions and 33 deletions
|
@ -16,3 +16,7 @@ signal collected
|
|||
## You'll probably want to connect this to an AudioSource2D, which will disable the node and play a sound, and when the sound is over a new signal will queue_free it.
|
||||
func collect():
|
||||
emit_signal("collected")
|
||||
|
||||
|
||||
func _on_done():
|
||||
get_parent().queue_free()
|
||||
|
|
|
@ -9,9 +9,6 @@ var coda : int = 0
|
|||
@export var sound_complete: AudioStreamPlayer
|
||||
@export var spawner: Spawner
|
||||
|
||||
func _on_collector_collected(body):
|
||||
body.queue_free()
|
||||
|
||||
func _on_collector_goal():
|
||||
coda+=1
|
||||
|
||||
|
|
|
@ -36,3 +36,5 @@ type = &"Copper"
|
|||
|
||||
[node name="Valuable" parent="." instance=ExtResource("5_fd0r7")]
|
||||
value = 1
|
||||
|
||||
[connection signal="collected" from="Collectible" to="Collectible" method="_on_done"]
|
||||
|
|
|
@ -37,3 +37,5 @@ type = &"Gold"
|
|||
|
||||
[node name="Valuable" parent="." instance=ExtResource("5_palpv")]
|
||||
value = 100
|
||||
|
||||
[connection signal="collected" from="Collectible" to="Collectible" method="_on_done"]
|
||||
|
|
|
@ -37,3 +37,5 @@ type = &"Silver"
|
|||
|
||||
[node name="Valuable" parent="." instance=ExtResource("5_u3bvw")]
|
||||
value = 10
|
||||
|
||||
[connection signal="collected" from="Collectible" to="Collectible" method="_on_done"]
|
||||
|
|
65
game/game.gd
65
game/game.gd
|
@ -2,7 +2,13 @@ extends Node2D
|
|||
class_name Game
|
||||
|
||||
|
||||
@onready var button_spawner = $ButtonSpawner
|
||||
@onready var button_spawner: Spawner = $ButtonSpawner
|
||||
@onready var time_spawner: Spawner = $TimeSpawner
|
||||
@onready var time_spawner_timer: Timer = $TimeSpawner/Timer
|
||||
@onready var store_collector: Collector = $StoreCollector
|
||||
@onready var store_collector_panel: Panel = $StoreCollector/Panel
|
||||
@onready var store_collector_texturerect: TextureRect = $StoreCollector/Panel/TextureRect
|
||||
@onready var store_collector_counter: Label = $StoreCollector/Panel/Label
|
||||
|
||||
|
||||
func trigger_spawn():
|
||||
|
@ -13,3 +19,60 @@ signal score_changed(total: int)
|
|||
|
||||
func _on_score_changed(total: int):
|
||||
score_changed.emit(total)
|
||||
|
||||
|
||||
func _on_upgraded_auto_spawn(scene: PackedScene, period: float):
|
||||
time_spawner.scene = scene
|
||||
time_spawner_timer.wait_time = period
|
||||
time_spawner_timer.start()
|
||||
|
||||
func _on_upgraded_manual_spawn(scene: PackedScene):
|
||||
button_spawner.scene = scene
|
||||
|
||||
|
||||
func _on_purchase_begin(what: PurchasableItem):
|
||||
print("[Game] Beginning purchase of ", what.name, " costing ", what.item_cost_goal, "x ", what.item_cost_type)
|
||||
store_collector.collecting_types = [what.item_cost_type]
|
||||
store_collector.collecting_amount = what.item_cost_goal
|
||||
store_collector.goal.connect(_handle_purchase_success.bind(what))
|
||||
update_counter_icon()
|
||||
update_counter_text()
|
||||
store_collector_panel.show()
|
||||
|
||||
func _handle_purchase_success(what: PurchasableItem):
|
||||
what.complete_purchase()
|
||||
|
||||
func _on_purchase_cancel(what: PurchasableItem):
|
||||
print("[Game] Cancelled purchase of ", what.name, " costing ", what.item_cost_goal, "x ", what.item_cost_type)
|
||||
store_collector.collecting_types = []
|
||||
store_collector.goal.disconnect(_handle_purchase_success)
|
||||
store_collector_panel.hide()
|
||||
|
||||
func _on_purchase_success(what: PurchasableItem):
|
||||
print("[Game] Succedeed purchase of ", what.name, " costing ", what.item_cost_goal, "x ", what.item_cost_type)
|
||||
store_collector.collecting_types = []
|
||||
store_collector.goal.disconnect(_handle_purchase_success)
|
||||
store_collector_panel.hide()
|
||||
|
||||
func _on_store_collector_collected(_body: RigidBody2D):
|
||||
update_counter_text()
|
||||
|
||||
func update_counter_text():
|
||||
store_collector_counter.text = "%d" % (store_collector.collecting_amount - store_collector.collected_count)
|
||||
|
||||
@export var upgrade_copper_texture: Texture2D
|
||||
@export var upgrade_silver_texture: Texture2D
|
||||
@export var upgrade_gold_texture: Texture2D
|
||||
|
||||
func update_counter_icon():
|
||||
if len(store_collector.collecting_types) == 0:
|
||||
store_collector_texturerect.texture = null
|
||||
elif store_collector.collecting_types[0] == &"Copper":
|
||||
store_collector_texturerect.texture = upgrade_copper_texture
|
||||
elif store_collector.collecting_types[0] == &"Silver":
|
||||
store_collector_texturerect.texture = upgrade_silver_texture
|
||||
elif store_collector.collecting_types[0] == &"Gold":
|
||||
store_collector_texturerect.texture = upgrade_gold_texture
|
||||
else:
|
||||
store_collector_texturerect.texture = null
|
||||
|
||||
|
|
107
game/game.tscn
107
game/game.tscn
|
@ -1,14 +1,19 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://c3rxmcwa5nqng"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://c3rxmcwa5nqng"]
|
||||
|
||||
[ext_resource type="Script" path="res://game/game.gd" id="1_i3ly0"]
|
||||
[ext_resource type="PackedScene" uid="uid://bllsprv8orpn4" path="res://bottle/bottle.tscn" id="1_y7o2l"]
|
||||
[ext_resource type="PackedScene" uid="uid://d05b8jy3xmpcb" path="res://bottle/gravity_from_gyro.tscn" id="2_h2pfr"]
|
||||
[ext_resource type="Texture2D" uid="uid://7b12rwclhrq0" path="res://interface/upgrade_silver.png" id="3_8wvr1"]
|
||||
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="3_qwsty"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="4_5oayc"]
|
||||
[ext_resource type="Texture2D" uid="uid://taojrwr7xrp4" path="res://interface/upgrade_gold.png" id="4_i557v"]
|
||||
[ext_resource type="PackedScene" uid="uid://beg758fa6o0cs" path="res://value/evaluator.tscn" id="6_my6nv"]
|
||||
[ext_resource type="PackedScene" uid="uid://ratkps4plkhl" path="res://converters/copper_to_silver/copper_converter.tscn" id="7_ipeok"]
|
||||
[ext_resource type="PackedScene" uid="uid://but1bdslxp5jl" path="res://converters/silver_to_gold/silver_converter.tscn" id="8_0bbpi"]
|
||||
[ext_resource type="PackedScene" uid="uid://c2rlx7egl7xiv" path="res://collector/universal_collector.tscn" id="9_7op48"]
|
||||
[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="9_evdhb"]
|
||||
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="10_sayqn"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"]
|
||||
size = Vector2(80, 80)
|
||||
|
@ -16,12 +21,21 @@ size = Vector2(80, 80)
|
|||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"]
|
||||
size = Vector2(240, 384)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i50bq"]
|
||||
size = Vector2(540, 135)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_auxq0"]
|
||||
size = Vector2(270, 270)
|
||||
size = Vector2(1080, 270)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_jed57"]
|
||||
size = Vector2(270, 810)
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
texture_filter = 1
|
||||
script = ExtResource("1_i3ly0")
|
||||
upgrade_copper_texture = ExtResource("11_lt33g")
|
||||
upgrade_silver_texture = ExtResource("3_8wvr1")
|
||||
upgrade_gold_texture = ExtResource("4_i557v")
|
||||
|
||||
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
|
||||
|
||||
|
@ -39,8 +53,6 @@ shape = SubResource("RectangleShape2D_4uksi")
|
|||
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||
|
||||
[node name="Timer" type="Timer" parent="TimeSpawner"]
|
||||
wait_time = 0.1
|
||||
autostart = true
|
||||
|
||||
[node name="ButtonSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||
position = Vector2(136, 0)
|
||||
|
@ -65,26 +77,101 @@ shape = SubResource("RectangleShape2D_rh35r")
|
|||
debug_color = Color(0, 0.6, 0.701961, 0)
|
||||
|
||||
[node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")]
|
||||
position = Vector2(63, 337)
|
||||
position = Vector2(63, 197)
|
||||
|
||||
[node name="CollectShape" parent="CopperConverter/Collector" index="0"]
|
||||
debug_color = Color(0, 0.701961, 0.188235, 0.419608)
|
||||
|
||||
[node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")]
|
||||
target = NodePath("../..")
|
||||
|
||||
[node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")]
|
||||
position = Vector2(136, 417)
|
||||
rotation = -1.57079
|
||||
position = Vector2(205, 337)
|
||||
rotation = -3.14159
|
||||
|
||||
[node name="Spawner" parent="SilverConverter" index="6" node_paths=PackedStringArray("target")]
|
||||
target = NodePath("../..")
|
||||
|
||||
[node name="UniversalCollector" parent="." instance=ExtResource("9_7op48")]
|
||||
position = Vector2(135, -135)
|
||||
[node name="StoreCollector" parent="." instance=ExtResource("9_evdhb")]
|
||||
position = Vector2(135, 0)
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="UniversalCollector"]
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="StoreCollector"]
|
||||
position = Vector2(0, -67)
|
||||
shape = SubResource("RectangleShape2D_i50bq")
|
||||
debug_color = Color(0, 0.701961, 0.188235, 0.419608)
|
||||
|
||||
[node name="Panel" type="Panel" parent="StoreCollector"]
|
||||
visible = false
|
||||
z_index = -10
|
||||
anchors_preset = 5
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
offset_left = -32.0
|
||||
offset_top = 88.0
|
||||
offset_right = 32.0
|
||||
offset_bottom = 124.0
|
||||
grow_horizontal = 2
|
||||
theme = ExtResource("10_sayqn")
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="StoreCollector/Panel"]
|
||||
modulate = Color(1, 1, 1, 0.521569)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -16.0
|
||||
offset_top = -16.0
|
||||
offset_right = 16.0
|
||||
offset_bottom = 16.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("11_lt33g")
|
||||
|
||||
[node name="Label" type="Label" parent="StoreCollector/Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -32.0
|
||||
offset_top = -9.5
|
||||
offset_right = 32.0
|
||||
offset_bottom = 9.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 0
|
||||
text = "250"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="UniversalCollectorTop" parent="." instance=ExtResource("9_7op48")]
|
||||
position = Vector2(135, -270)
|
||||
|
||||
[node name="ShapeTop" type="CollisionShape2D" parent="UniversalCollectorTop"]
|
||||
shape = SubResource("RectangleShape2D_auxq0")
|
||||
debug_color = Color(0, 0, 0, 0.419608)
|
||||
|
||||
[node name="ShapeBottom" type="CollisionShape2D" parent="UniversalCollectorTop"]
|
||||
position = Vector2(0, 1080)
|
||||
shape = SubResource("RectangleShape2D_auxq0")
|
||||
debug_color = Color(0, 0, 0, 0.419608)
|
||||
|
||||
[node name="ShapeLeft" type="CollisionShape2D" parent="UniversalCollectorTop"]
|
||||
position = Vector2(-405, 540)
|
||||
shape = SubResource("RectangleShape2D_jed57")
|
||||
debug_color = Color(0, 0, 0, 0.419608)
|
||||
|
||||
[node name="ShapeRight" type="CollisionShape2D" parent="UniversalCollectorTop"]
|
||||
position = Vector2(405, 540)
|
||||
shape = SubResource("RectangleShape2D_jed57")
|
||||
debug_color = Color(0, 0, 0, 0.419608)
|
||||
|
||||
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
|
||||
[connection signal="changed" from="Evaluator" to="." method="_on_score_changed"]
|
||||
[connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"]
|
||||
|
||||
[editable path="CopperConverter"]
|
||||
[editable path="SilverConverter"]
|
||||
|
|
|
@ -1,6 +1,19 @@
|
|||
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://ba5utvfhnxa5i"]
|
||||
[gd_resource type="Theme" load_steps=3 format=3 uid="uid://ba5utvfhnxa5i"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://cs8tiwyb76gig" path="res://interface/font/press-start/prstart.ttf" id="1_mtdor"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_knce4"]
|
||||
bg_color = Color(0.0901961, 0.227451, 0.290196, 0.929412)
|
||||
border_width_left = 2
|
||||
border_width_top = 2
|
||||
border_width_right = 2
|
||||
border_width_bottom = 2
|
||||
border_color = Color(0.341176, 0.635294, 0.772549, 1)
|
||||
corner_radius_top_left = 8
|
||||
corner_radius_top_right = 8
|
||||
corner_radius_bottom_right = 8
|
||||
corner_radius_bottom_left = 8
|
||||
|
||||
[resource]
|
||||
default_font = ExtResource("1_mtdor")
|
||||
Panel/styles/panel = SubResource("StyleBoxFlat_knce4")
|
||||
|
|
|
@ -47,7 +47,7 @@ class_name PurchasableItem
|
|||
return can_buy
|
||||
set(value):
|
||||
can_buy = value
|
||||
$Contents/Action/BuyButton.disabled = not (can_buy && has_unlocked)
|
||||
$Contents/Action/BuyButton.disabled = not (has_bought or (can_buy and has_unlocked))
|
||||
|
||||
## Whether the player has unlocked this item for purchase.
|
||||
##
|
||||
|
@ -57,18 +57,34 @@ class_name PurchasableItem
|
|||
return has_unlocked
|
||||
set(value):
|
||||
has_unlocked = value
|
||||
$Contents/Action/BuyButton.disabled = not (can_buy && has_unlocked)
|
||||
$Contents/Action/BuyButton.disabled = not (has_bought or (can_buy and has_unlocked))
|
||||
$Contents/Action/BuyButton.text = "Buy" if value else "Lock"
|
||||
|
||||
## Whether the player is currently buying this item.
|
||||
##
|
||||
## Used to cancel the purchase.
|
||||
var is_buying: bool:
|
||||
var is_buying: bool = false:
|
||||
get:
|
||||
return is_buying
|
||||
set(value):
|
||||
is_buying = value
|
||||
$Contents/Action/BuyButton.text = "Undo" if value else "Buy"
|
||||
|
||||
## Whether this item can be bought one or infinite times.
|
||||
@export var one_shot: bool
|
||||
|
||||
## Whether the player has already bought this item.
|
||||
##
|
||||
## Always false if one_shot is true.
|
||||
var has_bought: bool:
|
||||
get:
|
||||
return has_bought
|
||||
set(value):
|
||||
has_bought = value
|
||||
$Contents/Action/BuyButton.disabled = (has_bought or (can_buy and has_unlocked))
|
||||
$Contents/Action/BuyButton.add_theme_color_override("font_color", Color.GREEN)
|
||||
$Contents/Action/BuyButton.text = "Buy" if value else "Own"
|
||||
|
||||
|
||||
## Emitted when a purchase has started.
|
||||
signal purchase_begin
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extends Panel
|
||||
class_name ShopUI
|
||||
|
||||
@export var score_button: ScoreButton
|
||||
@onready var score_button: ScoreButton = $Rows/UpperButtons/ScoreButton
|
||||
|
||||
## Emitted when the Score button is pressed.
|
||||
signal score_button_pressed
|
||||
|
@ -24,7 +24,7 @@ signal purchase_cancel(what: PurchasableItem)
|
|||
signal purchase_success(what: PurchasableItem)
|
||||
|
||||
## Array of all PurchasableItems that this ShopUI should control.
|
||||
@onready var purchasable_items: Array[Node] = find_children("*", "PurchasableItem") as Array[Node]
|
||||
@onready var purchasable_items: Array[Node] = find_children("*", "PurchasableItem")
|
||||
|
||||
|
||||
func _ready():
|
||||
|
@ -74,3 +74,51 @@ func _on_delete_button_pressed():
|
|||
|
||||
func _on_back_button_pressed():
|
||||
back_button_pressed.emit()
|
||||
|
||||
|
||||
@export var copper_coin_scene: PackedScene
|
||||
@export var silver_coin_scene: PackedScene
|
||||
@export var gold_coin_scene: PackedScene
|
||||
|
||||
|
||||
signal upgraded_auto_spawn(scene: PackedScene, period: float)
|
||||
|
||||
func _on_buy_auto_copper_purchase_success():
|
||||
print("[ShopUI] Upgrading to Auto Copper * 2...")
|
||||
upgraded_auto_spawn.emit(copper_coin_scene, 0.5)
|
||||
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyHeliCopper.has_unlocked = true
|
||||
|
||||
func _on_buy_heli_copper_purchase_success():
|
||||
print("[ShopUI] Upgrading to Auto Copper * 8...")
|
||||
upgraded_auto_spawn.emit(copper_coin_scene, 0.125)
|
||||
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoSilver.has_unlocked = true
|
||||
|
||||
func _on_buy_auto_silver_purchase_success():
|
||||
print("[ShopUI] Upgrading to Auto Silver * 2...")
|
||||
upgraded_auto_spawn.emit(silver_coin_scene, 0.5)
|
||||
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuySuperSilver.has_unlocked = true
|
||||
|
||||
func _on_buy_super_silver_purchase_success():
|
||||
print("[ShopUI] Upgrading to Auto Silver * 8...")
|
||||
upgraded_auto_spawn.emit(silver_coin_scene, 0.125)
|
||||
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoGold.has_unlocked = true
|
||||
|
||||
func _on_buy_auto_gold_purchase_success():
|
||||
print("[ShopUI] Upgrading to Auto Gold * 2...")
|
||||
upgraded_auto_spawn.emit(gold_coin_scene, 0.5)
|
||||
$Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyMidasTouch.has_unlocked = true
|
||||
|
||||
func _on_buy_midas_touch_purchase_success():
|
||||
print("[ShopUI] Upgrading to Auto Gold * 8...")
|
||||
upgraded_auto_spawn.emit(gold_coin_scene, 0.125)
|
||||
|
||||
|
||||
signal upgraded_manual_spawn(scene: PackedScene)
|
||||
|
||||
func _on_buy_silver_star_purchase_success():
|
||||
print("[ShopUI] Upgrading to Manual Silver...")
|
||||
upgraded_manual_spawn.emit(silver_coin_scene)
|
||||
|
||||
func _on_buy_gold_star_purchase_success():
|
||||
print("[ShopUI] Upgrading to Manual Gold...")
|
||||
upgraded_manual_spawn.emit(gold_coin_scene)
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
[gd_scene load_steps=11 format=3 uid="uid://cklkdygv61bny"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://cklkdygv61bny"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_qdf0y"]
|
||||
[ext_resource type="PackedScene" uid="uid://dul1fpyh733t7" path="res://interface/purchasable_item.tscn" id="2_2dtc0"]
|
||||
[ext_resource type="Script" path="res://interface/shop_ui.gd" id="2_iyr7m"]
|
||||
[ext_resource type="PackedScene" uid="uid://wodgj6rp2ewm" path="res://interface/purchasable_item_padding.tscn" id="3_4feaj"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="3_6o10r"]
|
||||
[ext_resource type="PackedScene" uid="uid://bey5lilvteg32" path="res://interface/score_button.tscn" id="3_7vro3"]
|
||||
[ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver/coin_silver.tscn" id="4_phiuj"]
|
||||
[ext_resource type="Texture2D" uid="uid://pj3ip6vlatms" path="res://converters/copper_to_silver/copper_converter.png" id="5_lu2tr"]
|
||||
[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="5_yvhlq"]
|
||||
[ext_resource type="Texture2D" uid="uid://bnctqi24r6ycr" path="res://converters/silver_to_gold/silver_converter.png" id="6_70u64"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="8_270dw"]
|
||||
[ext_resource type="Texture2D" uid="uid://7b12rwclhrq0" path="res://interface/upgrade_silver.png" id="8_caq4i"]
|
||||
[ext_resource type="Texture2D" uid="uid://taojrwr7xrp4" path="res://interface/upgrade_gold.png" id="9_amnej"]
|
||||
|
||||
[node name="ShopUI" type="Panel" node_paths=PackedStringArray("score_button")]
|
||||
[node name="ShopUI" type="Panel"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -19,7 +22,9 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
theme = ExtResource("1_qdf0y")
|
||||
script = ExtResource("2_iyr7m")
|
||||
score_button = NodePath("Rows/UpperButtons/ScoreButton")
|
||||
copper_coin_scene = ExtResource("3_6o10r")
|
||||
silver_coin_scene = ExtResource("4_phiuj")
|
||||
gold_coin_scene = ExtResource("5_yvhlq")
|
||||
|
||||
[node name="Rows" type="VBoxContainer" parent="."]
|
||||
layout_mode = 1
|
||||
|
@ -174,8 +179,10 @@ layout_mode = 2
|
|||
item_icon = ExtResource("8_270dw")
|
||||
item_name = "Auto-copper"
|
||||
item_description = "Receive two copper coins per second!"
|
||||
item_cost_text = "??"
|
||||
has_unlocked = false
|
||||
item_cost_text = "50 copper"
|
||||
item_cost_type = &"Copper"
|
||||
item_cost_goal = 50
|
||||
one_shot = true
|
||||
|
||||
[node name="PurchasableItemPadding" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")]
|
||||
layout_mode = 2
|
||||
|
@ -185,8 +192,11 @@ layout_mode = 2
|
|||
item_icon = ExtResource("8_270dw")
|
||||
item_name = "Heli-copper"
|
||||
item_description = "Receive eight copper coins per second!"
|
||||
item_cost_text = "??"
|
||||
item_cost_text = "8 silver"
|
||||
item_cost_type = &"Silver"
|
||||
item_cost_goal = 8
|
||||
has_unlocked = false
|
||||
one_shot = true
|
||||
|
||||
[node name="PurchasableItemPadding2" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")]
|
||||
layout_mode = 2
|
||||
|
@ -198,6 +208,7 @@ item_name = "Auto-silver"
|
|||
item_description = "Receive two silver coins per second!"
|
||||
item_cost_text = "??"
|
||||
has_unlocked = false
|
||||
one_shot = true
|
||||
|
||||
[node name="PurchasableItemPadding4" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")]
|
||||
layout_mode = 2
|
||||
|
@ -209,6 +220,7 @@ item_name = "Super silver"
|
|||
item_description = "Receive eight silver coins per second!"
|
||||
item_cost_text = "??"
|
||||
has_unlocked = false
|
||||
one_shot = true
|
||||
|
||||
[node name="PurchasableItemPadding6" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")]
|
||||
layout_mode = 2
|
||||
|
@ -220,6 +232,7 @@ item_name = "Auto-gold"
|
|||
item_description = "Receive two gold coins per second!"
|
||||
item_cost_text = "??"
|
||||
has_unlocked = false
|
||||
one_shot = true
|
||||
|
||||
[node name="PurchasableItemPadding7" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")]
|
||||
layout_mode = 2
|
||||
|
@ -231,6 +244,7 @@ item_name = "Midas Touch"
|
|||
item_description = "Receive eight gold coins per second!"
|
||||
item_cost_text = "??"
|
||||
has_unlocked = false
|
||||
one_shot = true
|
||||
|
||||
[node name="PurchasableItemPadding8" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")]
|
||||
layout_mode = 2
|
||||
|
@ -260,6 +274,7 @@ item_name = "Silver star"
|
|||
item_description = "Create a silver coin when tapping!"
|
||||
item_cost_text = "??"
|
||||
has_unlocked = false
|
||||
one_shot = true
|
||||
|
||||
[node name="PurchasableItemPadding" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory" instance=ExtResource("3_4feaj")]
|
||||
layout_mode = 2
|
||||
|
@ -271,6 +286,7 @@ item_name = "Gold star"
|
|||
item_description = "Create a gold coin when tapping!"
|
||||
item_cost_text = "??"
|
||||
has_unlocked = false
|
||||
one_shot = true
|
||||
|
||||
[node name="PurchasableItemPadding2" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory" instance=ExtResource("3_4feaj")]
|
||||
layout_mode = 2
|
||||
|
@ -283,3 +299,11 @@ size_flags_horizontal = 8
|
|||
[connection signal="pressed" from="Rows/UpperButtons/ScoreButton" to="." method="_on_score_button_pressed"]
|
||||
[connection signal="pressed" from="Rows/UpperButtons/DeleteButton" to="." method="_on_delete_button_pressed"]
|
||||
[connection signal="pressed" from="Rows/UpperButtons/BackButton" to="." method="_on_back_button_pressed"]
|
||||
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoCopper" to="." method="_on_buy_auto_copper_purchase_success"]
|
||||
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyHeliCopper" to="." method="_on_buy_heli_copper_purchase_success"]
|
||||
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoSilver" to="." method="_on_buy_auto_silver_purchase_success"]
|
||||
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuySuperSilver" to="." method="_on_buy_super_silver_purchase_success"]
|
||||
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyAutoGold" to="." method="_on_buy_auto_gold_purchase_success"]
|
||||
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory/BuyMidasTouch" to="." method="_on_buy_midas_touch_purchase_success"]
|
||||
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory/BuySilverStar" to="." method="_on_buy_silver_star_purchase_success"]
|
||||
[connection signal="purchase_success" from="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory/BuyGoldStar" to="." method="_on_buy_gold_star_purchase_success"]
|
||||
|
|
4
main.gd
4
main.gd
|
@ -3,8 +3,8 @@ class_name Main
|
|||
|
||||
|
||||
@onready var tree: SceneTree = get_tree()
|
||||
@export var game_ui: GameUI
|
||||
@export var shop_ui: ShopUI
|
||||
@onready var game_ui: GameUI = $CustomUI/SafeUI/GameUI
|
||||
@onready var shop_ui: ShopUI = $CustomUI/SafeUI/ShopUI
|
||||
|
||||
|
||||
enum UIState {
|
||||
|
|
11
main.tscn
11
main.tscn
|
@ -8,10 +8,8 @@
|
|||
[ext_resource type="Script" path="res://interface/safe_ui.gd" id="4_nel0n"]
|
||||
[ext_resource type="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="4_siim3"]
|
||||
|
||||
[node name="Main" type="Node" node_paths=PackedStringArray("game_ui", "shop_ui")]
|
||||
[node name="Main" type="Node"]
|
||||
script = ExtResource("1_fqt34")
|
||||
game_ui = NodePath("CustomUI/SafeUI/GameUI")
|
||||
shop_ui = NodePath("CustomUI/SafeUI/ShopUI")
|
||||
|
||||
[node name="CustomUI" type="Control" parent="."]
|
||||
texture_filter = 1
|
||||
|
@ -78,6 +76,9 @@ layout_mode = 2
|
|||
[connection signal="back_button_pressed" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"]
|
||||
[connection signal="delete_button_pressed" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_delete_button_pressed"]
|
||||
[connection signal="purchase_begin" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"]
|
||||
[connection signal="purchase_cancel" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_cancel"]
|
||||
[connection signal="purchase_success" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_success"]
|
||||
[connection signal="purchase_begin" from="CustomUI/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_purchase_begin"]
|
||||
[connection signal="purchase_cancel" from="CustomUI/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_purchase_cancel"]
|
||||
[connection signal="purchase_success" from="CustomUI/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_purchase_success"]
|
||||
[connection signal="score_button_pressed" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_score_button_pressed"]
|
||||
[connection signal="upgraded_auto_spawn" from="CustomUI/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_upgraded_auto_spawn"]
|
||||
[connection signal="upgraded_manual_spawn" from="CustomUI/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_upgraded_manual_spawn"]
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# Z-layers
|
||||
|
||||
## Z-10
|
||||
- UI dietro-bottiglia
|
||||
|
||||
## Z-2
|
||||
- Converter background
|
||||
|
||||
|
|
Loading…
Reference in a new issue