1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-22 07:44:17 +00:00
This commit is contained in:
Maxim Lobovsky 2023-10-01 23:54:03 +02:00
commit c7804a607b
28 changed files with 459 additions and 92 deletions

23
View.gd Normal file
View file

@ -0,0 +1,23 @@
extends Control
class_name View
@onready var window: Window = get_window()
@onready var viewport: Viewport = window.get_viewport()
func _ready():
viewport.size_changed.connect(_on_viewport_size_changed)
func _on_viewport_size_changed():
var window_size: Vector2i = DisplayServer.window_get_size()
print("[View] Window size is: ", window_size)
var scaling_factor
if window_size.x < window_size.y:
scaling_factor = window_size.x / 270
else:
scaling_factor = window_size.y / 480
print("[View] Scaling factor is: ", scaling_factor)
get_window().set_content_scale_factor(scaling_factor)
$SafeUI.set_safe_margins(scaling_factor)

View file

@ -15,11 +15,11 @@ sources/0 = SubResource("TileSetAtlasSource_midqx")
tile_set = SubResource("TileSet_tr7be") tile_set = SubResource("TileSet_tr7be")
collision_visibility_mode = 1 collision_visibility_mode = 1
format = 2 format = 2
layer_0/tile_data = PackedInt32Array(-1638406, 0, 0, -1638407, 0, 0, -1638408, 0, 0, -1572872, 0, 0, -1507336, 0, 0, -1441800, 0, 0, -1376264, 0, 0, -1310728, 0, 0, -1245192, 0, 0, -393224, 0, 0, -327688, 0, 0, -262152, 0, 0, -458760, 0, 0, -524296, 0, 0, -589832, 0, 0, -655368, 0, 0, -720904, 0, 0, -786440, 0, 0, -851976, 0, 0, -917512, 0, 0, -983048, 0, 0, -1048584, 0, 0, -1114120, 0, 0, -1179656, 0, 0, -196616, 0, 0, -131080, 0, 0, -65544, 0, 0, -8, 0, 0, -7, 0, 0, -4, 0, 0, -3, 0, 0, -2, 0, 0, -1, 0, 0, -5, 0, 0, -6, 0, 0, -65536, 0, 0, -65535, 0, 0, -65534, 0, 0, -65533, 0, 0, -65532, 0, 0, -65531, 0, 0, -65530, 0, 0, -65529, 0, 0, -131065, 0, 0, -196601, 0, 0, -262137, 0, 0, -327673, 0, 0, -393209, 0, 0, -458745, 0, 0, -524281, 0, 0, -589817, 0, 0, -655353, 0, 0, -720889, 0, 0, -786425, 0, 0, -851961, 0, 0, -917497, 0, 0, -983033, 0, 0, -1048569, 0, 0, -1114105, 0, 0, -1441785, 0, 0, -1507321, 0, 0, -1376249, 0, 0, -1310713, 0, 0, -1245177, 0, 0, -1179641, 0, 0, -1572857, 0, 0, -1638393, 0, 0, -1703929, 0, 0, -1703930, 0, 0, -1703931, 0, 0, -1638405, 0, 0, -1638404, 0, 0, -1703940, 0, 0, -1769476, 0, 0, -1835012, 0, 0, -1900548, 0, 0, -1703932, 0, 0, -1703933, 0, 0, -1769469, 0, 0, -1835005, 0, 0, -1900541, 0, 0, -1966077, 0, 0) layer_0/tile_data = PackedInt32Array(-1376264, 0, 0, -1310728, 0, 0, -1245192, 0, 0, -393224, 0, 0, -327688, 0, 0, -262152, 0, 0, -458760, 0, 0, -524296, 0, 0, -589832, 0, 0, -655368, 0, 0, -720904, 0, 0, -786440, 0, 0, -851976, 0, 0, -917512, 0, 0, -983048, 0, 0, -1048584, 0, 0, -1114120, 0, 0, -1179656, 0, 0, -196616, 0, 0, -131080, 0, 0, -65544, 0, 0, -8, 0, 0, -7, 0, 0, -4, 0, 0, -3, 0, 0, -2, 0, 0, -1, 0, 0, -5, 0, 0, -6, 0, 0, -65536, 0, 0, -65535, 0, 0, -65534, 0, 0, -65533, 0, 0, -65532, 0, 0, -65531, 0, 0, -65530, 0, 0, -65529, 0, 0, -131065, 0, 0, -196601, 0, 0, -262137, 0, 0, -327673, 0, 0, -393209, 0, 0, -458745, 0, 0, -524281, 0, 0, -589817, 0, 0, -655353, 0, 0, -720889, 0, 0, -786425, 0, 0, -851961, 0, 0, -917497, 0, 0, -983033, 0, 0, -1048569, 0, 0, -1114105, 0, 0, -1441785, 0, 0, -1376249, 0, 0, -1310713, 0, 0, -1245177, 0, 0, -1179641, 0, 0, -1638404, 0, 0, -1703933, 0, 0, -1572868, 0, 0, -1507332, 0, 0, -1441796, 0, 0, -1376260, 0, 0, -1376261, 0, 0, -1376262, 0, 0, -1376263, 0, 0, -1638397, 0, 0, -1572861, 0, 0, -1507325, 0, 0, -1441789, 0, 0, -1441788, 0, 0, -1441787, 0, 0, -1441786, 0, 0)
[node name="StaticBody2D" type="StaticBody2D" parent="."] [node name="StaticBody2D" type="StaticBody2D" parent="."]
collision_layer = 3 collision_layer = 3
collision_mask = 0 collision_mask = 0
[node name="Poly" type="CollisionPolygon2D" parent="StaticBody2D"] [node name="Poly" type="CollisionPolygon2D" parent="StaticBody2D"]
polygon = PackedVector2Array(-320, -576, -320, 192, 320, 192, 320, -576, 48, -576, 48, -400, 112, -400, 112, -16, -112, -16, -112, -400, -48, -400, -48, -576) polygon = PackedVector2Array(-320, -576, -320, 192, 320, 192, 320, -576, 48, -576, 48, -336, 112, -336, 112, -16, -112, -16, -112, -336, -48, -336, -48, -576)

View file

@ -2,11 +2,18 @@ extends StaticBody2D
@export var scene: PackedScene @export var scene: PackedScene
@onready var _animated_sprite = $AnimatedSprite2D
func _on_collector_collected(body): func _on_collector_collected(body):
body.queue_free() body.queue_free()
func _on_collector_goal(): func _on_collector_goal():
print("silver") $AnimatedSprite2D.play()
$Spawner.spawn() $converter_working.play()
$Timer.start()
func _on_timer_timeout():
$AnimatedSprite2D.stop()
$converter_working.stop()
$New_item.play()
$Spawner.spawn()

View file

@ -1,10 +1,51 @@
[gd_scene load_steps=10 format=3 uid="uid://ratkps4plkhl"] [gd_scene load_steps=20 format=3 uid="uid://ratkps4plkhl"]
[ext_resource type="Script" path="res://convertors/copper_to_silver.gd" id="1_jjv83"] [ext_resource type="Script" path="res://convertors/copper_to_silver.gd" id="1_jjv83"]
[ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver.tscn" id="2_orv64"] [ext_resource type="PackedScene" uid="uid://dme22vvfgme5f" path="res://entity/coin_silver.tscn" id="2_orv64"]
[ext_resource type="Texture2D" uid="uid://b0uefih0ccwp3" path="res://entity/copper_converter_front_1.png" id="2_vm6by"]
[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="3_a4naa"] [ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="3_a4naa"]
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="3_uxx6n"]
[ext_resource type="Texture2D" uid="uid://dq5aowbt2wxec" path="res://entity/copper_to_silver/copper_converter_front_1.png" id="4_04v4v"]
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="5_1n0vw"] [ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="5_1n0vw"]
[ext_resource type="Texture2D" uid="uid://ck254fewe4l41" path="res://entity/copper_to_silver/copper_converter_front_2.png" id="5_tbfff"]
[ext_resource type="Texture2D" uid="uid://dg4qq1pgojk8d" path="res://entity/copper_to_silver/copper_converter_front_3.png" id="6_8ghce"]
[ext_resource type="Texture2D" uid="uid://60502lbpup6" path="res://entity/copper_to_silver/copper_converter_front_4.png" id="7_e53sb"]
[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="10_uc0v7"]
[sub_resource type="AtlasTexture" id="AtlasTexture_62dyi"]
atlas = ExtResource("4_04v4v")
region = Rect2(0, 2, 32, 33)
[sub_resource type="AtlasTexture" id="AtlasTexture_gs3wo"]
atlas = ExtResource("5_tbfff")
region = Rect2(0, 2, 32, 33)
[sub_resource type="AtlasTexture" id="AtlasTexture_tboq2"]
atlas = ExtResource("6_8ghce")
region = Rect2(0, 2, 32, 33)
[sub_resource type="AtlasTexture" id="AtlasTexture_okgf4"]
atlas = ExtResource("7_e53sb")
region = Rect2(0, 2, 32, 33)
[sub_resource type="SpriteFrames" id="SpriteFrames_4m3dg"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_62dyi")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gs3wo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tboq2")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_okgf4")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_k11if"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_k11if"]
size = Vector2(26, 5) size = Vector2(26, 5)
@ -19,18 +60,22 @@ size = Vector2(3, 28)
size = Vector2(25.8333, 5) size = Vector2(25.8333, 5)
[node name="CopperToSilver" type="StaticBody2D"] [node name="CopperToSilver" type="StaticBody2D"]
scale = Vector2(3, 3) scale = Vector2(2, 2)
script = ExtResource("1_jjv83") script = ExtResource("1_jjv83")
scene = ExtResource("2_orv64") scene = ExtResource("2_orv64")
[node name="CopperConverterFront1" type="Sprite2D" parent="."] [node name="converter_working" type="AudioStreamPlayer" parent="."]
stream = ExtResource("3_uxx6n")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
texture_filter = 1 texture_filter = 1
texture = ExtResource("2_vm6by") sprite_frames = SubResource("SpriteFrames_4m3dg")
frame_progress = 0.143561
[node name="Collector" parent="." instance=ExtResource("3_a4naa")] [node name="Collector" parent="." instance=ExtResource("3_a4naa")]
collecting_types = Array[StringName]([&"Copper"]) collecting_types = Array[StringName]([&"Copper"])
collecting_collision_mask = 4 collecting_collision_mask = 4
collecting_amount = 10 collecting_amount = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Collector"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Collector"]
position = Vector2(0, 9.5) position = Vector2(0, 9.5)
@ -52,7 +97,18 @@ shape = SubResource("RectangleShape2D_eqmlo")
[node name="CollisionShape2D3" type="CollisionShape2D" parent="."] [node name="CollisionShape2D3" type="CollisionShape2D" parent="."]
position = Vector2(0, 12.3333) position = Vector2(0, 12.3333)
rotation = 3.14159
shape = SubResource("RectangleShape2D_31dtl") shape = SubResource("RectangleShape2D_31dtl")
one_way_collision = true
one_way_collision_margin = 8.0
[node name="Timer" type="Timer" parent="."]
wait_time = 1.998
one_shot = true
[node name="New_item" type="AudioStreamPlayer" parent="."]
stream = ExtResource("10_uc0v7")
[connection signal="collected" from="Collector" to="." method="_on_collector_collected"] [connection signal="collected" from="Collector" to="." method="_on_collector_collected"]
[connection signal="goal" from="Collector" to="." method="_on_collector_goal"] [connection signal="goal" from="Collector" to="." method="_on_collector_goal"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]

8
default_bus_layout.tres Normal file
View file

@ -0,0 +1,8 @@
[gd_resource type="AudioBusLayout" load_steps=2 format=3 uid="uid://b2edg3n5pyluh"]
[sub_resource type="AudioEffectAmplify" id="AudioEffectAmplify_l4qbw"]
resource_name = "Amplify"
[resource]
bus/0/effect/0/effect = SubResource("AudioEffectAmplify_l4qbw")
bus/0/effect/0/enabled = false

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://qy1fubii8tqi"
path="res://.godot/imported/coin_gold.png-0c230a4cf47b2f846ae95a49942eff1e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/coin_gold.png"
dest_files=["res://.godot/imported/coin_gold.png-0c230a4cf47b2f846ae95a49942eff1e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://blfyda7vw3q3h"
path="res://.godot/imported/coin_gold_outline.png-a9a15b5756ee7fa7d320f210be0aa93e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/coin_gold_outline.png"
dest_files=["res://.godot/imported/coin_gold_outline.png-a9a15b5756ee7fa7d320f210be0aa93e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -19,7 +19,6 @@ linear_damp = 0.1
angular_damp = 0.1 angular_damp = 0.1
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
scale = Vector2(2, 2)
shape = SubResource("RectangleShape2D_c6byl") shape = SubResource("RectangleShape2D_c6byl")
[node name="Sprite" type="Sprite2D" parent="CollisionShape2D"] [node name="Sprite" type="Sprite2D" parent="CollisionShape2D"]

View file

@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://b0uefih0ccwp3" uid="uid://dq5aowbt2wxec"
path="res://.godot/imported/copper_converter_front_1.png-4a922506c789b120b43bf92ad029b601.ctex" path="res://.godot/imported/copper_converter_front_1.png-a66e383124c5d7a3b9eb25fbca72295e.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://entity/copper_converter_front_1.png" source_file="res://entity/copper_to_silver/copper_converter_front_1.png"
dest_files=["res://.godot/imported/copper_converter_front_1.png-4a922506c789b120b43bf92ad029b601.ctex"] dest_files=["res://.godot/imported/copper_converter_front_1.png-a66e383124c5d7a3b9eb25fbca72295e.ctex"]
[params] [params]

View file

@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://dejli5qv8w4wk" uid="uid://ck254fewe4l41"
path="res://.godot/imported/copper_converter_front_2.png-ad6be975b80b2675f665f38d953da271.ctex" path="res://.godot/imported/copper_converter_front_2.png-1979402e2a27fcfa511130668aff26e5.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://entity/copper_converter_front_2.png" source_file="res://entity/copper_to_silver/copper_converter_front_2.png"
dest_files=["res://.godot/imported/copper_converter_front_2.png-ad6be975b80b2675f665f38d953da271.ctex"] dest_files=["res://.godot/imported/copper_converter_front_2.png-1979402e2a27fcfa511130668aff26e5.ctex"]
[params] [params]

View file

@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://cj5di48de0ua0" uid="uid://dg4qq1pgojk8d"
path="res://.godot/imported/copper_converter_front_3.png-d70c1e7afbe0bf8e25a8058d0feed406.ctex" path="res://.godot/imported/copper_converter_front_3.png-b5633cd8b2b9353cf9b41b07df79cc44.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://entity/copper_converter_front_3.png" source_file="res://entity/copper_to_silver/copper_converter_front_3.png"
dest_files=["res://.godot/imported/copper_converter_front_3.png-d70c1e7afbe0bf8e25a8058d0feed406.ctex"] dest_files=["res://.godot/imported/copper_converter_front_3.png-b5633cd8b2b9353cf9b41b07df79cc44.ctex"]
[params] [params]

View file

@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://su0uwlynw8x2" uid="uid://60502lbpup6"
path="res://.godot/imported/copper_converter_front_4.png-9dd5af8e43a7b7232f0bd757b86bd9c1.ctex" path="res://.godot/imported/copper_converter_front_4.png-3e5661e50d79ebd32965daca68902adc.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://entity/copper_converter_front_4.png" source_file="res://entity/copper_to_silver/copper_converter_front_4.png"
dest_files=["res://.godot/imported/copper_converter_front_4.png-9dd5af8e43a7b7232f0bd757b86bd9c1.ctex"] dest_files=["res://.godot/imported/copper_converter_front_4.png-3e5661e50d79ebd32965daca68902adc.ctex"]
[params] [params]

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dky53nnnsqrf3"
path="res://.godot/imported/silver_converter_back.png-04ef08ef1c6ba3a7ef842e74e84ab87a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/silver_converter_back.png"
dest_files=["res://.godot/imported/silver_converter_back.png-04ef08ef1c6ba3a7ef842e74e84ab87a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://5320c0lts3sb"
path="res://.godot/imported/silver_converter_front_1.png-ef096085a3520f98616dff5262520f12.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/silver_converter_front_1.png"
dest_files=["res://.godot/imported/silver_converter_front_1.png-ef096085a3520f98616dff5262520f12.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://xocipqvibphg"
path="res://.godot/imported/silver_converter_front_2.png-04833d844d5196d082aa61a07f77cad8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/silver_converter_front_2.png"
dest_files=["res://.godot/imported/silver_converter_front_2.png-04833d844d5196d082aa61a07f77cad8.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c7lgajcnb0hxs"
path="res://.godot/imported/silver_converter_front_3.png-ba3e375be79147732d0a2cccd2e35d9d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/silver_converter_front_3.png"
dest_files=["res://.godot/imported/silver_converter_front_3.png-ba3e375be79147732d0a2cccd2e35d9d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://djixrek5573a6"
path="res://.godot/imported/silver_converter_front_4.png-a845708798135d9b44d995527379c3e3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/silver_converter_front_4.png"
dest_files=["res://.godot/imported/silver_converter_front_4.png-a845708798135d9b44d995527379c3e3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -12,6 +12,7 @@ texture_filter = 1
script = ExtResource("1_i3ly0") script = ExtResource("1_i3ly0")
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")] [node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
position = Vector2(0, 240)
[node name="GravityFromGyro" parent="Bottle" instance=ExtResource("2_h2pfr")] [node name="GravityFromGyro" parent="Bottle" instance=ExtResource("2_h2pfr")]
@ -20,7 +21,7 @@ z_index = 10
position = Vector2(2, -314) position = Vector2(2, -314)
[node name="TimeSpawner" parent="." instance=ExtResource("3_qwsty")] [node name="TimeSpawner" parent="." instance=ExtResource("3_qwsty")]
position = Vector2(0, -480) position = Vector2(0, -144)
scene = ExtResource("4_e5nwi") scene = ExtResource("4_e5nwi")
buffer_cap = 1 buffer_cap = 1
spawn_position_range_x = 32.0 spawn_position_range_x = 32.0
@ -31,7 +32,7 @@ overlapping_body_count_limit = 4
[node name="Timer" type="Timer" parent="TimeSpawner"] [node name="Timer" type="Timer" parent="TimeSpawner"]
[node name="ButtonSpawner" parent="." instance=ExtResource("3_qwsty")] [node name="ButtonSpawner" parent="." instance=ExtResource("3_qwsty")]
position = Vector2(0, -480) position = Vector2(0, -144)
scene = ExtResource("4_e5nwi") scene = ExtResource("4_e5nwi")
buffer_cap = 50 buffer_cap = 50
spawn_position_range_x = 32.0 spawn_position_range_x = 32.0

33
interface/SafeUI.gd Normal file
View file

@ -0,0 +1,33 @@
extends MarginContainer
class_name SafeUI
func set_safe_margins(scaling_factor: float):
var cutouts: Array[Rect2] = DisplayServer.get_display_cutouts()
var left
var right
var top
var bottom
if len(cutouts) == 0:
left = 8
right = 8
top = 8
bottom = 8
else:
var screen: Vector2i = DisplayServer.screen_get_size()
var rect: Rect2i = DisplayServer.get_display_safe_area()
left = rect.position.x
right = screen.x - rect.end.x
top = rect.position.y
bottom = screen.y - rect.end.y
print("[SafeUI] Left margin is: ", left)
print("[SafeUI] Right margin is: ", right)
print("[SafeUI] Top margin is: ", top)
print("[SafeUI] Bottom margin is: ", bottom)
add_theme_constant_override("margin_left", left / scaling_factor)
add_theme_constant_override("margin_right", right / scaling_factor)
add_theme_constant_override("margin_top", top / scaling_factor)
add_theme_constant_override("margin_bottom", bottom / scaling_factor)

View file

@ -1,15 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://c0uce7ssweke"]
[ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="1_dbqdv"]
[node name="GameContainer" type="Control"]
layout_mode = 3
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 0
[node name="Game" parent="." instance=ExtResource("1_dbqdv")]

View file

@ -1,4 +1,4 @@
extends VBoxContainer extends Control
class_name GameUI class_name GameUI
## Emitted when the Score button is pressed. ## Emitted when the Score button is pressed.

View file

@ -3,7 +3,8 @@
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_ppf8y"] [ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_ppf8y"]
[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"]
[node name="GameUI" type="VBoxContainer"] [node name="GameUI" type="Control"]
layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -12,40 +13,41 @@ grow_vertical = 2
theme = ExtResource("1_ppf8y") theme = ExtResource("1_ppf8y")
script = ExtResource("2_33nqa") script = ExtResource("2_33nqa")
[node name="UpperButtons" type="HBoxContainer" parent="."] [node name="ScoreButton" type="Button" parent="."]
custom_minimum_size = Vector2(0, 54)
layout_mode = 2
size_flags_vertical = 8
alignment = 1
[node name="ScoreButton" type="Button" parent="UpperButtons"]
custom_minimum_size = Vector2(72, 0) custom_minimum_size = Vector2(72, 0)
layout_mode = 2 layout_mode = 1
offset_right = 72.0
offset_bottom = 54.0
size_flags_horizontal = 0 size_flags_horizontal = 0
text = "$0" text = "$0"
alignment = 0 alignment = 0
[node name="UpperButtonsSpacerLeft" type="Control" parent="UpperButtons"] [node name="SpawnButton" type="Button" parent="."]
layout_mode = 2
size_flags_horizontal = 3
[node name="SpawnButton" type="Button" parent="UpperButtons"]
custom_minimum_size = Vector2(72, 0) custom_minimum_size = Vector2(72, 0)
layout_mode = 2 layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -36.0
offset_right = 36.0
offset_bottom = 54.0
grow_horizontal = 2
size_flags_horizontal = 4 size_flags_horizontal = 4
text = "Drop" text = "Drop"
[node name="UpperButtonsSpacerRight" type="Control" parent="UpperButtons"] [node name="ShopButton" type="Button" parent="."]
layout_mode = 2
size_flags_horizontal = 3
[node name="ShopButton" type="Button" parent="UpperButtons"]
custom_minimum_size = Vector2(72, 0) custom_minimum_size = Vector2(72, 0)
layout_mode = 2 layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
offset_left = -72.0
offset_bottom = 54.0
grow_horizontal = 0
size_flags_horizontal = 8 size_flags_horizontal = 8
text = "Shop" text = "Shop"
alignment = 2 alignment = 2
[connection signal="pressed" from="UpperButtons/ScoreButton" to="." method="_on_score_button_pressed"] [connection signal="pressed" from="ScoreButton" to="." method="_on_score_button_pressed"]
[connection signal="pressed" from="UpperButtons/SpawnButton" to="." method="_on_spawn_button_pressed"] [connection signal="pressed" from="SpawnButton" to="." method="_on_spawn_button_pressed"]
[connection signal="pressed" from="UpperButtons/ShopButton" to="." method="_on_shop_button_pressed"] [connection signal="pressed" from="ShopButton" to="." method="_on_shop_button_pressed"]

View file

@ -22,7 +22,6 @@ config/icon="res://icon.svg"
window/size/viewport_width=270 window/size/viewport_width=270
window/size/viewport_height=480 window/size/viewport_height=480
window/size/mode=2 window/size/mode=2
window/stretch/mode="viewport"
window/stretch/aspect="keep_height" window/stretch/aspect="keep_height"
window/handheld/orientation=1 window/handheld/orientation=1

View file

@ -1,15 +1,17 @@
[gd_scene load_steps=6 format=3 uid="uid://cbccs6kwwf265"] [gd_scene load_steps=8 format=3 uid="uid://cbccs6kwwf265"]
[ext_resource type="Script" path="res://root.gd" id="1_8jrhk"] [ext_resource type="Script" path="res://root.gd" id="1_8jrhk"]
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_h26ax"] [ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_h26ax"]
[ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="3_hrdyr"] [ext_resource type="Script" path="res://View.gd" id="3_1ki2g"]
[ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="3_8gkpc"]
[ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="3_lvefk"] [ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="3_lvefk"]
[ext_resource type="Script" path="res://interface/SafeUI.gd" id="4_grf0c"]
[ext_resource type="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="5_2cc15"] [ext_resource type="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="5_2cc15"]
[node name="Root" type="Node"] [node name="Root" type="Node"]
script = ExtResource("1_8jrhk") script = ExtResource("1_8jrhk")
[node name="UI" type="Control" parent="."] [node name="View" type="Control" parent="."]
texture_filter = 1 texture_filter = 1
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
@ -19,33 +21,47 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
size_flags_vertical = 8 size_flags_vertical = 8
theme = ExtResource("1_h26ax") theme = ExtResource("1_h26ax")
script = ExtResource("3_1ki2g")
[node name="GameContainer" type="Control" parent="UI"] [node name="GameWI" type="CenterContainer" parent="View"]
process_mode = 1 process_mode = 1
layout_mode = 1 layout_mode = 1
anchors_preset = 7 anchors_preset = 15
anchor_left = 0.5 anchor_right = 1.0
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 0 grow_vertical = 2
size_flags_horizontal = 3
size_flags_vertical = 3
metadata/_edit_vertical_guides_ = []
[node name="Game" parent="UI/GameContainer" instance=ExtResource("3_hrdyr")] [node name="GameWorld" type="Control" parent="View/GameWI"]
layout_mode = 2
[node name="GameUI" parent="UI" instance=ExtResource("5_2cc15")] [node name="Game" parent="View/GameWI/GameWorld" instance=ExtResource("3_8gkpc")]
process_mode = 3
[node name="SafeUI" type="MarginContainer" parent="View"]
layout_mode = 1 layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("4_grf0c")
[node name="ShopUI" parent="UI" instance=ExtResource("3_lvefk")] [node name="GameUI" parent="View/SafeUI" instance=ExtResource("5_2cc15")]
process_mode = 3
layout_mode = 2
[node name="ShopUI" parent="View/SafeUI" instance=ExtResource("3_lvefk")]
process_mode = 3 process_mode = 3
visible = false visible = false
layout_mode = 1 layout_mode = 2
[connection signal="score_button_pressed" from="UI/GameUI" to="." method="_on_game_ui_score_button_pressed"] [connection signal="score_button_pressed" from="View/SafeUI/GameUI" to="." method="_on_game_ui_score_button_pressed"]
[connection signal="shop_button_pressed" from="UI/GameUI" to="." method="_on_game_ui_shop_button_pressed"] [connection signal="shop_button_pressed" from="View/SafeUI/GameUI" to="." method="_on_game_ui_shop_button_pressed"]
[connection signal="spawn_button_pressed" from="UI/GameUI" to="." method="_on_game_ui_spawn_button_pressed"] [connection signal="spawn_button_pressed" from="View/SafeUI/GameUI" to="." method="_on_game_ui_spawn_button_pressed"]
[connection signal="back_button_pressed" from="UI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"] [connection signal="back_button_pressed" from="View/SafeUI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"]
[connection signal="delete_button_pressed" from="UI/ShopUI" to="." method="_on_shop_ui_delete_button_pressed"] [connection signal="delete_button_pressed" from="View/SafeUI/ShopUI" to="." method="_on_shop_ui_delete_button_pressed"]
[connection signal="purchase_begin" from="UI/ShopUI" to="." method="_on_shop_ui_purchase_begin"] [connection signal="purchase_begin" from="View/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"]
[connection signal="score_button_pressed" from="UI/ShopUI" to="." method="_on_shop_ui_score_button_pressed"] [connection signal="score_button_pressed" from="View/SafeUI/ShopUI" to="." method="_on_shop_ui_score_button_pressed"]