1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-21 23:34:18 +00:00
This commit is contained in:
Matteo Balugani 2023-10-02 19:58:35 +02:00
commit e74fdba486
15 changed files with 67 additions and 27 deletions

View file

@ -66,6 +66,7 @@ size = Vector2(26, 10)
scale = Vector2(3, 3) scale = Vector2(3, 3)
collision_layer = 8 collision_layer = 8
collision_mask = 0 collision_mask = 0
input_pickable = true
script = ExtResource("1_mas6k") script = ExtResource("1_mas6k")
sprite_front = NodePath("SpriteFront") sprite_front = NodePath("SpriteFront")
conversion_timer = NodePath("ConversionTimer") conversion_timer = NodePath("ConversionTimer")

View file

@ -71,8 +71,10 @@ size = Vector2(26, 5)
size = Vector2(26, 8.83334) size = Vector2(26, 8.83334)
[node name="GoldConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")] [node name="GoldConverter" type="StaticBody2D" node_paths=PackedStringArray("sprite_front", "conversion_timer", "sound_working", "sound_complete", "spawner")]
scale = Vector2(3, 3)
collision_layer = 8 collision_layer = 8
collision_mask = 0 collision_mask = 0
input_pickable = true
script = ExtResource("1_fgju3") script = ExtResource("1_fgju3")
sprite_front = NodePath("SpriteFront") sprite_front = NodePath("SpriteFront")
conversion_timer = NodePath("ConversionTimer") conversion_timer = NodePath("ConversionTimer")

View file

@ -146,6 +146,7 @@ size = Vector2(26, 8.83334)
scale = Vector2(3, 3) scale = Vector2(3, 3)
collision_layer = 8 collision_layer = 8
collision_mask = 0 collision_mask = 0
input_pickable = true
script = ExtResource("1_qln0a") script = ExtResource("1_qln0a")
sprite_front = NodePath("SpriteFront") sprite_front = NodePath("SpriteFront")
sprite_back = NodePath("SpriteBack") sprite_back = NodePath("SpriteBack")

View file

@ -50,6 +50,7 @@ size = Vector2(26, 10)
scale = Vector2(3, 3) scale = Vector2(3, 3)
collision_layer = 8 collision_layer = 8
collision_mask = 0 collision_mask = 0
input_pickable = true
script = ExtResource("1_chhfg") script = ExtResource("1_chhfg")
sprite_front = NodePath("SpriteFront") sprite_front = NodePath("SpriteFront")
conversion_timer = NodePath("ConversionTimer") conversion_timer = NodePath("ConversionTimer")

View file

@ -18,6 +18,7 @@ physics_material_override = ExtResource("1_1fypc")
continuous_cd = 1 continuous_cd = 1
max_contacts_reported = 1 max_contacts_reported = 1
contact_monitor = true contact_monitor = true
can_sleep = false
linear_damp = 0.1 linear_damp = 0.1
angular_damp = 0.1 angular_damp = 0.1

View file

@ -16,6 +16,7 @@ mass = 2.0
inertia = 600.0 inertia = 600.0
physics_material_override = ExtResource("1_nfq5t") physics_material_override = ExtResource("1_nfq5t")
continuous_cd = 1 continuous_cd = 1
can_sleep = false
linear_damp = 0.1 linear_damp = 0.1
angular_damp = 0.1 angular_damp = 0.1

View file

@ -17,6 +17,7 @@ mass = 1.5
inertia = 800.0 inertia = 800.0
physics_material_override = ExtResource("1_4sq1a") physics_material_override = ExtResource("1_4sq1a")
continuous_cd = 1 continuous_cd = 1
can_sleep = false
linear_damp = 0.1 linear_damp = 0.1
angular_damp = 0.1 angular_damp = 0.1

View file

@ -20,6 +20,7 @@ mass = 1.5
inertia = 800.0 inertia = 800.0
physics_material_override = ExtResource("1_vmemd") physics_material_override = ExtResource("1_vmemd")
continuous_cd = 1 continuous_cd = 1
can_sleep = false
linear_damp = 0.1 linear_damp = 0.1
angular_damp = 0.1 angular_damp = 0.1

View file

@ -91,4 +91,7 @@ func _on_ghost_requested(scene: PackedScene, texture: Texture2D):
ghost.show() ghost.show()
func _on_ghost_materialize(): func _on_ghost_materialize():
ghost.materialize() var instantiated = ghost.materialize()
var spawner = instantiated.find_child("Spawner")
if spawner != null:
spawner.target = self

View file

@ -21,7 +21,7 @@
size = Vector2(240, 384) size = Vector2(240, 384)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"]
size = Vector2(80, 80) size = Vector2(80, 160)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i50bq"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_i50bq"]
size = Vector2(540, 135) size = Vector2(540, 135)
@ -44,11 +44,10 @@ upgrade_gold_texture = ExtResource("4_i557v")
[node name="Ghost" parent="." node_paths=PackedStringArray("target") instance=ExtResource("16_8vhx6")] [node name="Ghost" parent="." node_paths=PackedStringArray("target") instance=ExtResource("16_8vhx6")]
process_mode = 4 process_mode = 4
visible = false visible = false
position = Vector2(135, 360) position = Vector2(253, 109)
preview_texture = ExtResource("6_0jj8g") preview_texture = ExtResource("6_0jj8g")
scene_to_instantiate = ExtResource("7_ipeok") scene_to_instantiate = ExtResource("7_ipeok")
target = NodePath("..") target = NodePath("..")
metadata/_edit_lock_ = true
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")] [node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
@ -71,7 +70,6 @@ overlapping_body_count_limit = 4
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
[node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"] [node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"]
position = Vector2(0, 40)
shape = SubResource("RectangleShape2D_4uksi") shape = SubResource("RectangleShape2D_4uksi")
debug_color = Color(0, 0.6, 0.701961, 0) debug_color = Color(0, 0.6, 0.701961, 0)
@ -87,7 +85,6 @@ overlapping_body_count_limit = 4
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
[node name="NeckShape" type="CollisionShape2D" parent="ButtonSpawner"] [node name="NeckShape" type="CollisionShape2D" parent="ButtonSpawner"]
position = Vector2(0, 40)
shape = SubResource("RectangleShape2D_4uksi") shape = SubResource("RectangleShape2D_4uksi")
debug_color = Color(0, 0.6, 0.701961, 0) debug_color = Color(0, 0.6, 0.701961, 0)

View file

@ -1,7 +1,8 @@
extends Control extends Control
class_name GameUI class_name GameUI
@export var score_button: ScoreButton @onready var score_button: ScoreButton = $ScoreButton
@onready var spawn_button: Button = $SpawnButton
## Emitted when the Score button is pressed. ## Emitted when the Score button is pressed.
signal score_button_pressed signal score_button_pressed
@ -24,3 +25,16 @@ func _on_shop_button_pressed():
func _on_game_score_changed(total: int): func _on_game_score_changed(total: int):
score_button.set_score(total) score_button.set_score(total)
func _on_shop_ui_purchase_begin(_what: PurchasableItem):
spawn_button.disabled = true
spawn_button.text = "Pay"
func _on_shop_ui_purchase_cancel(_what: PurchasableItem):
spawn_button.disabled = false
spawn_button.text = "Put"
func _on_shop_ui_purchase_success(_what: PurchasableItem):
spawn_button.disabled = false
spawn_button.text = "Put"

View file

@ -4,7 +4,7 @@
[ext_resource type="Script" path="res://interface/game_ui.gd" id="2_33nqa"] [ext_resource type="Script" path="res://interface/game_ui.gd" id="2_33nqa"]
[ext_resource type="PackedScene" uid="uid://bey5lilvteg32" path="res://interface/score_button.tscn" id="3_vobar"] [ext_resource type="PackedScene" uid="uid://bey5lilvteg32" path="res://interface/score_button.tscn" id="3_vobar"]
[node name="GameUI" type="Control" node_paths=PackedStringArray("score_button")] [node name="GameUI" type="Control"]
custom_minimum_size = Vector2(0, 54) custom_minimum_size = Vector2(0, 54)
layout_mode = 3 layout_mode = 3
anchors_preset = 10 anchors_preset = 10
@ -12,7 +12,6 @@ anchor_right = 1.0
grow_horizontal = 2 grow_horizontal = 2
theme = ExtResource("1_ppf8y") theme = ExtResource("1_ppf8y")
script = ExtResource("2_33nqa") script = ExtResource("2_33nqa")
score_button = NodePath("ScoreButton")
[node name="ScoreButton" parent="." instance=ExtResource("3_vobar")] [node name="ScoreButton" parent="." instance=ExtResource("3_vobar")]
custom_minimum_size = Vector2(88, 0) custom_minimum_size = Vector2(88, 0)
@ -29,7 +28,7 @@ offset_right = 36.0
offset_bottom = 54.0 offset_bottom = 54.0
grow_horizontal = 2 grow_horizontal = 2
size_flags_horizontal = 4 size_flags_horizontal = 4
text = "Drop" text = "Put"
[node name="ShopButton" type="Button" parent="."] [node name="ShopButton" type="Button" parent="."]
custom_minimum_size = Vector2(88, 0) custom_minimum_size = Vector2(88, 0)

View file

@ -105,3 +105,4 @@ func materialize():
instantiated.rotation = rotation instantiated.rotation = rotation
target.add_child(instantiated) target.add_child(instantiated)
materialized.emit(instantiated) materialized.emit(instantiated)
return instantiated

View file

@ -121,10 +121,10 @@ layout_mode = 2
item_icon = ExtResource("5_lu2tr") item_icon = ExtResource("5_lu2tr")
item_name = "Silver-ifier" item_name = "Silver-ifier"
item_description = "Exchanges ten copper coins for a shiny silver coin!" item_description = "Exchanges ten copper coins for a shiny silver coin!"
item_cost_text = "35 copper" item_cost_text = "100 copper"
item_scene = ExtResource("10_dui5v") item_scene = ExtResource("10_dui5v")
item_cost_type = &"Copper" item_cost_type = &"Copper"
item_cost_goal = 35 item_cost_goal = 100
[node name="PurchasableItemPadding" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")] [node name="PurchasableItemPadding" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")]
layout_mode = 2 layout_mode = 2
@ -134,8 +134,10 @@ layout_mode = 2
item_icon = ExtResource("6_70u64") item_icon = ExtResource("6_70u64")
item_name = "Gold-enser" item_name = "Gold-enser"
item_description = "Trades in ten silver coins for a sparkly gold coin!" item_description = "Trades in ten silver coins for a sparkly gold coin!"
item_cost_text = "??" item_cost_text = "40 silver"
item_scene = ExtResource("12_ml4jm") item_scene = ExtResource("12_ml4jm")
item_cost_type = &"Silver"
item_cost_goal = 40
has_unlocked = false has_unlocked = false
[node name="PurchasableItemPadding2" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")] [node name="PurchasableItemPadding2" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")]
@ -146,8 +148,10 @@ layout_mode = 2
item_icon = ExtResource("13_gsd84") item_icon = ExtResource("13_gsd84")
item_name = "Gem-ificator" item_name = "Gem-ificator"
item_description = "Converts ten gold coins into a randomly colored gem!" item_description = "Converts ten gold coins into a randomly colored gem!"
item_cost_text = "??" item_cost_text = "20 gold"
item_scene = ExtResource("13_m0kio") item_scene = ExtResource("13_m0kio")
item_cost_type = &"Gold"
item_cost_goal = 20
has_unlocked = false has_unlocked = false
[node name="PurchasableItemPadding4" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")] [node name="PurchasableItemPadding4" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")]
@ -171,6 +175,8 @@ item_name = "Arti-factory"
item_description = "Assembles an artifact from twenty-five gold coins and a gem or a diamond!" item_description = "Assembles an artifact from twenty-five gold coins and a gem or a diamond!"
item_cost_text = "??" item_cost_text = "??"
item_scene = ExtResource("14_tgckt") item_scene = ExtResource("14_tgckt")
item_cost_type = &"Gem"
item_cost_goal = 20
has_unlocked = false has_unlocked = false
[node name="PurchasableItemPadding7" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")] [node name="PurchasableItemPadding7" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("3_4feaj")]
@ -199,9 +205,9 @@ layout_mode = 2
item_icon = ExtResource("8_270dw") item_icon = ExtResource("8_270dw")
item_name = "Auto-copper" item_name = "Auto-copper"
item_description = "Receive two copper coins per second!" item_description = "Receive two copper coins per second!"
item_cost_text = "50 copper" item_cost_text = "40 copper"
item_cost_type = &"Copper" item_cost_type = &"Copper"
item_cost_goal = 50 item_cost_goal = 40
one_shot = true one_shot = true
[node name="PurchasableItemPadding" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")] [node name="PurchasableItemPadding" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("3_4feaj")]
@ -212,9 +218,9 @@ layout_mode = 2
item_icon = ExtResource("8_270dw") item_icon = ExtResource("8_270dw")
item_name = "Heli-copper" item_name = "Heli-copper"
item_description = "Receive eight copper coins per second!" item_description = "Receive eight copper coins per second!"
item_cost_text = "8 silver" item_cost_text = "160 copper"
item_cost_type = &"Silver" item_cost_type = &"Copper"
item_cost_goal = 8 item_cost_goal = 160
has_unlocked = false has_unlocked = false
one_shot = true one_shot = true
@ -226,7 +232,9 @@ layout_mode = 2
item_icon = ExtResource("8_caq4i") item_icon = ExtResource("8_caq4i")
item_name = "Auto-silver" item_name = "Auto-silver"
item_description = "Receive two silver coins per second!" item_description = "Receive two silver coins per second!"
item_cost_text = "??" item_cost_text = "40 silver"
item_cost_type = &"Silver"
item_cost_goal = 40
has_unlocked = false has_unlocked = false
one_shot = true one_shot = true
@ -236,9 +244,11 @@ layout_mode = 2
[node name="BuySuperSilver" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("2_2dtc0")] [node name="BuySuperSilver" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2 layout_mode = 2
item_icon = ExtResource("8_caq4i") item_icon = ExtResource("8_caq4i")
item_name = "Super silver" item_name = "Super-silver"
item_description = "Receive eight silver coins per second!" item_description = "Receive eight silver coins per second!"
item_cost_text = "??" item_cost_text = "5 gold"
item_cost_type = &"Gold"
item_cost_goal = 5
has_unlocked = false has_unlocked = false
one_shot = true one_shot = true
@ -250,7 +260,9 @@ layout_mode = 2
item_icon = ExtResource("9_amnej") item_icon = ExtResource("9_amnej")
item_name = "Auto-gold" item_name = "Auto-gold"
item_description = "Receive two gold coins per second!" item_description = "Receive two gold coins per second!"
item_cost_text = "??" item_cost_text = "15 gems"
item_cost_type = &"Gem"
item_cost_goal = 15
has_unlocked = false has_unlocked = false
one_shot = true one_shot = true
@ -260,9 +272,11 @@ layout_mode = 2
[node name="BuyMidasTouch" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("2_2dtc0")] [node name="BuyMidasTouch" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ManualCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2 layout_mode = 2
item_icon = ExtResource("9_amnej") item_icon = ExtResource("9_amnej")
item_name = "Midas Touch" item_name = "Tera-gold"
item_description = "Receive eight gold coins per second!" item_description = "Receive eight gold coins per second!"
item_cost_text = "??" item_cost_text = "5 gems"
item_cost_type = &"Gem"
item_cost_goal = 5
has_unlocked = false has_unlocked = false
one_shot = true one_shot = true
@ -290,7 +304,7 @@ layout_mode = 2
[node name="BuySilverStar" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory" instance=ExtResource("2_2dtc0")] [node name="BuySilverStar" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2 layout_mode = 2
item_icon = ExtResource("8_caq4i") item_icon = ExtResource("8_caq4i")
item_name = "Silver star" item_name = "Quick silver"
item_description = "Create a silver coin when tapping!" item_description = "Create a silver coin when tapping!"
item_cost_text = "??" item_cost_text = "??"
has_unlocked = false has_unlocked = false
@ -302,7 +316,7 @@ layout_mode = 2
[node name="BuyGoldStar" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory" instance=ExtResource("2_2dtc0")] [node name="BuyGoldStar" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2 layout_mode = 2
item_icon = ExtResource("9_amnej") item_icon = ExtResource("9_amnej")
item_name = "Gold star" item_name = "Midas Touch"
item_description = "Create a gold coin when tapping!" item_description = "Create a gold coin when tapping!"
item_cost_text = "??" item_cost_text = "??"
has_unlocked = false has_unlocked = false

View file

@ -87,8 +87,11 @@ layout_mode = 2
[connection signal="ghost_requested" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_ghost_requested"] [connection signal="ghost_requested" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_ghost_requested"]
[connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"] [connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"]
[connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_begin"] [connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_begin"]
[connection signal="purchase_begin" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameSafeUI/GameUI" method="_on_shop_ui_purchase_begin"]
[connection signal="purchase_cancel" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_cancel"] [connection signal="purchase_cancel" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_cancel"]
[connection signal="purchase_cancel" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameSafeUI/GameUI" method="_on_shop_ui_purchase_cancel"]
[connection signal="purchase_success" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_success"] [connection signal="purchase_success" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_purchase_success"]
[connection signal="purchase_success" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameSafeUI/GameUI" method="_on_shop_ui_purchase_success"]
[connection signal="score_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_score_button_pressed"] [connection signal="score_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_score_button_pressed"]
[connection signal="upgraded_auto_spawn" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_upgraded_auto_spawn"] [connection signal="upgraded_auto_spawn" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_upgraded_auto_spawn"]
[connection signal="upgraded_manual_spawn" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_upgraded_manual_spawn"] [connection signal="upgraded_manual_spawn" from="CustomUI/ShopSafeUI/ShopUI" to="CustomUI/GameViewport/Viewport/Game" method="_on_upgraded_manual_spawn"]