1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-21 23:34:18 +00:00

Many things sorry i forgot to commit

This commit is contained in:
Steffo 2023-10-02 03:33:41 +02:00
parent e47898491f
commit aa2080c839
Signed by: steffo
GPG key ID: 2A24051445686895
13 changed files with 97 additions and 23 deletions

View file

@ -0,0 +1,30 @@
extends Area2D
class_name UniversalCollector
## Area that will pick up all [Collectible]s which enter inside it.
## The current amount of collected entities.
var collected_count: int = 0
## The goal amount of entities to collect.
##
## When [collected_count] reaches it, it will be reset to zero, and the "goal" signal will be emitted.
@export var collecting_amount: int
## The collector has picked up an object.
signal collected(body: PhysicsBody2D)
## The collector has received its collection goal and is about to reset.
signal goal
func _on_body_entered(body: Node2D):
if body is PhysicsBody2D:
var collectible: Collectible = body.find_child("Collectible")
if collectible:
collected_count += 1
collectible.collect()
emit_signal("collected", body)
if collected_count >= collecting_amount:
emit_signal("goal")
collected_count = 0

View file

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://c2rlx7egl7xiv"]
[ext_resource type="Script" path="res://collector/universal_collector.gd" id="1_xn6rb"]
[node name="UniversalCollector" type="Area2D"]
script = ExtResource("1_xn6rb")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

View file

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://bquk2q5g6bst5"
path="res://.godot/imported/diamond.png-e255ab09d23a24a6563c34236c6422d4.ctex"
path="res://.godot/imported/diamond.png-0575d649be1d35db3ad92a77f7f138c4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/diamond.png"
dest_files=["res://.godot/imported/diamond.png-e255ab09d23a24a6563c34236c6422d4.ctex"]
source_file="res://entity/gem/diamond.png"
dest_files=["res://.godot/imported/diamond.png-0575d649be1d35db3ad92a77f7f138c4.ctex"]
[params]

View file

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://b21bsbo5f0ed7"
path="res://.godot/imported/gemstone.png-9e77a54275f3114b69765356c5f68288.ctex"
path="res://.godot/imported/gemstone.png-bc91c9206ee29218d6a2eefb5595b7d3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/gemstone.png"
dest_files=["res://.godot/imported/gemstone.png-9e77a54275f3114b69765356c5f68288.ctex"]
source_file="res://entity/gem/gemstone.png"
dest_files=["res://.godot/imported/gemstone.png-bc91c9206ee29218d6a2eefb5595b7d3.ctex"]
[params]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://c3rxmcwa5nqng"]
[gd_scene load_steps=13 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"]
@ -8,6 +8,7 @@
[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"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"]
size = Vector2(80, 80)
@ -15,6 +16,9 @@ size = Vector2(80, 80)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_rh35r"]
size = Vector2(240, 384)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_auxq0"]
size = Vector2(270, 270)
[node name="Game" type="Node2D"]
texture_filter = 1
script = ExtResource("1_i3ly0")
@ -73,6 +77,12 @@ rotation = -1.57079
[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="CollisionShape2D" type="CollisionShape2D" parent="UniversalCollector"]
shape = SubResource("RectangleShape2D_auxq0")
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
[connection signal="changed" from="Evaluator" to="." method="_on_score_changed"]

View file

@ -10,6 +10,7 @@ anchors_preset = 10
anchor_right = 1.0
grow_horizontal = 2
size_flags_horizontal = 3
mouse_filter = 1
theme = ExtResource("1_r2qbu")
script = ExtResource("1_h8jix")
@ -24,24 +25,27 @@ grow_vertical = 2
[node name="HeaderPaddingTop" type="Control" parent="Contents"]
custom_minimum_size = Vector2(0, 4)
layout_mode = 2
mouse_filter = 1
[node name="Header" type="HBoxContainer" parent="Contents"]
layout_mode = 2
size_flags_vertical = 8
[node name="IconPaddingLeft" type="Control" parent="Contents/Header"]
custom_minimum_size = Vector2(8, 0)
custom_minimum_size = Vector2(4, 0)
layout_mode = 2
mouse_filter = 1
[node name="IconRect" type="TextureRect" parent="Contents/Header"]
custom_minimum_size = Vector2(54, 54)
custom_minimum_size = Vector2(50, 50)
layout_mode = 2
texture = ExtResource("1_drwcj")
expand_mode = 2
[node name="IconNameSeparator" type="Control" parent="Contents/Header"]
custom_minimum_size = Vector2(8, 0)
custom_minimum_size = Vector2(4, 0)
layout_mode = 2
mouse_filter = 1
[node name="NameLabel" type="Label" parent="Contents/Header"]
layout_mode = 2
@ -51,13 +55,15 @@ text = "ITEMNAME"
uppercase = true
[node name="NamePaddingRight" type="Control" parent="Contents/Header"]
custom_minimum_size = Vector2(8, 0)
custom_minimum_size = Vector2(4, 0)
layout_mode = 2
mouse_filter = 1
[node name="HeaderDescriptionPadding" type="Control" parent="Contents"]
custom_minimum_size = Vector2(0, 4)
layout_mode = 2
size_flags_vertical = 3
mouse_filter = 1
[node name="Description" type="HBoxContainer" parent="Contents"]
layout_mode = 2
@ -66,10 +72,12 @@ size_flags_vertical = 4
[node name="DescriptionPaddingLeft" type="Control" parent="Contents/Description"]
custom_minimum_size = Vector2(8, 0)
layout_mode = 2
mouse_filter = 1
[node name="DescriptionLabel" type="Label" parent="Contents/Description"]
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 1
theme_override_font_sizes/font_size = 16
text = "What does this item do? Nobody knows."
autowrap_mode = 2
@ -77,11 +85,13 @@ autowrap_mode = 2
[node name="DescriptionPaddingRight" type="Control" parent="Contents/Description"]
custom_minimum_size = Vector2(8, 0)
layout_mode = 2
mouse_filter = 1
[node name="DescriptionActionPadding" type="Control" parent="Contents"]
custom_minimum_size = Vector2(0, 4)
layout_mode = 2
size_flags_vertical = 3
mouse_filter = 1
[node name="Action" type="HBoxContainer" parent="Contents"]
layout_mode = 2
@ -90,6 +100,7 @@ size_flags_vertical = 0
[node name="BuyButtonPaddingLeft" type="Control" parent="Contents/Action"]
custom_minimum_size = Vector2(8, 0)
layout_mode = 2
mouse_filter = 1
[node name="BuyButton" type="Button" parent="Contents/Action"]
layout_mode = 2
@ -98,10 +109,12 @@ text = "Buy"
[node name="BuyCostPadding" type="Control" parent="Contents/Action"]
custom_minimum_size = Vector2(8, 0)
layout_mode = 2
mouse_filter = 1
[node name="CostLabel" type="Label" parent="Contents/Action"]
layout_mode = 2
size_flags_horizontal = 10
mouse_filter = 1
theme_override_font_sizes/font_size = 16
text = "3 fiorygi"
horizontal_alignment = 2
@ -110,9 +123,11 @@ vertical_alignment = 1
[node name="CostLabelPaddingRight" type="Control" parent="Contents/Action"]
custom_minimum_size = Vector2(8, 0)
layout_mode = 2
mouse_filter = 1
[node name="ActionPaddingBottom" type="Control" parent="Contents"]
custom_minimum_size = Vector2(0, 4)
layout_mode = 2
mouse_filter = 1
[connection signal="pressed" from="Contents/Action/BuyButton" to="." method="_on_buy_button_pressed"]

View file

@ -4,3 +4,4 @@
custom_minimum_size = Vector2(0, 8)
layout_mode = 3
anchors_preset = 0
mouse_filter = 1

View file

@ -7,6 +7,6 @@ custom_minimum_size = Vector2(72, 0)
offset_right = 72.0
offset_bottom = 54.0
size_flags_horizontal = 0
text = "$0"
text = "$0.00"
alignment = 0
script = ExtResource("1_ol56t")

View file

@ -1,6 +1,8 @@
extends Panel
class_name ShopUI
@export var score_button: ScoreButton
## Emitted when the Score button is pressed.
signal score_button_pressed
@ -61,6 +63,9 @@ func _on_any_purchase_success(what: Node):
continue
item.can_buy = true
func _on_game_score_changed(total: int):
score_button.set_score(total)
func _on_score_button_pressed():
score_button_pressed.emit()

View file

@ -1,12 +1,14 @@
[gd_scene load_steps=6 format=3 uid="uid://cklkdygv61bny"]
[gd_scene load_steps=8 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="Texture2D" uid="uid://pj3ip6vlatms" path="res://entity/copper_converter.png" id="5_lu2tr"]
[ext_resource type="PackedScene" uid="uid://bey5lilvteg32" path="res://interface/score_button.tscn" id="3_7vro3"]
[ext_resource type="Texture2D" uid="uid://pj3ip6vlatms" path="res://converters/copper_to_silver/copper_converter.png" id="5_lu2tr"]
[ext_resource type="Texture2D" uid="uid://bnctqi24r6ycr" path="res://converters/silver_to_gold/silver_converter.png" id="6_70u64"]
[node name="ShopUI" type="Panel"]
[node name="ShopUI" type="Panel" node_paths=PackedStringArray("score_button")]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
@ -14,6 +16,7 @@ grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_qdf0y")
script = ExtResource("2_iyr7m")
score_button = NodePath("Rows/UpperButtons/ScoreButton")
[node name="Rows" type="VBoxContainer" parent="."]
layout_mode = 1
@ -27,12 +30,8 @@ grow_vertical = 2
custom_minimum_size = Vector2(0, 54)
layout_mode = 2
[node name="ScoreButton" type="Button" parent="Rows/UpperButtons"]
custom_minimum_size = Vector2(72, 0)
[node name="ScoreButton" parent="Rows/UpperButtons" instance=ExtResource("3_7vro3")]
layout_mode = 2
size_flags_horizontal = 0
text = "$0"
alignment = 0
[node name="UpperButtonsSpacerLeft" type="Control" parent="Rows/UpperButtons"]
layout_mode = 2
@ -56,6 +55,7 @@ text = "Back"
alignment = 2
[node name="PaddedScrollable" type="HBoxContainer" parent="Rows"]
clip_contents = true
layout_mode = 2
size_flags_vertical = 3
@ -109,6 +109,7 @@ layout_mode = 2
[node name="BuyGoldenser" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/ConvertCategory" instance=ExtResource("2_2dtc0")]
layout_mode = 2
item_icon = ExtResource("6_70u64")
item_name = "Goldenser"
item_description = "Trades in ten silver coins for a sparkly gold coin!"
item_cost_text = "??"
@ -234,7 +235,7 @@ layout_mode = 2
[node name="EarnCoinsLabel" type="Label" parent="Rows/PaddedScrollable/Scrollable/ScrollableItems/AutomaticCategory"]
layout_mode = 2
theme_override_font_sizes/font_size = 24
text = "Automatic coin dropper"
text = "Be more efficient!"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2

View file

@ -28,13 +28,16 @@ script = ExtResource("3_xav0n")
[node name="GameWorld" type="CenterContainer" parent="CustomUI"]
custom_minimum_size = Vector2(270, 480)
layout_mode = 1
anchors_preset = 5
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -135.0
offset_top = -480.0
offset_right = 135.0
offset_bottom = 480.0
grow_horizontal = 2
grow_vertical = 0
[node name="GameViewport" type="SubViewportContainer" parent="CustomUI/GameWorld"]
layout_mode = 2
@ -68,6 +71,7 @@ visible = false
layout_mode = 2
[connection signal="score_changed" from="CustomUI/GameWorld/GameViewport/Viewport/Game" to="CustomUI/SafeUI/GameUI" method="_on_game_score_changed"]
[connection signal="score_changed" from="CustomUI/GameWorld/GameViewport/Viewport/Game" to="CustomUI/SafeUI/ShopUI" method="_on_game_score_changed"]
[connection signal="score_button_pressed" from="CustomUI/SafeUI/GameUI" to="." method="_on_game_ui_score_button_pressed"]
[connection signal="shop_button_pressed" from="CustomUI/SafeUI/GameUI" to="." method="_on_game_ui_shop_button_pressed"]
[connection signal="spawn_button_pressed" from="CustomUI/SafeUI/GameUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="trigger_spawn"]