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-02 15:49:51 +02:00
commit 82e4c76bb8
37 changed files with 765 additions and 132 deletions

View file

@ -1,5 +1,35 @@
# Attribution # Attribution
## Code
- [Color Conversion Shader](https://github.com/paddy-exe/ShaderFunction-Extras/blob/682301c10a4cc4dbe53b81dade46948e80e25c6a/addons/ShaderFunction-Extras/Color/LicenseInfo.md)
```
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
```
## Fonts ## Fonts
[Press Start Regular](https://www.1001fonts.com/press-start-font.html) by [codeman38](http://www.zone38.net/) - [Press Start Regular](https://www.1001fonts.com/press-start-font.html) by [codeman38](http://www.zone38.net/)

View file

@ -1,8 +0,0 @@
extends Node2D
func _on_roller_failure():
print("failure")
func _on_roller_success():
print("success")

14
color/Colored.gd Normal file
View file

@ -0,0 +1,14 @@
extends Node
class_name Colored
@export var shader: Shader
@onready var hue: float = Randomizer.rng.randf()
@onready var parent: Sprite2D = get_parent()
func _ready():
var material = ShaderMaterial.new()
material.shader = shader
material.set_shader_parameter("hue", hue)
parent.material = material

6
color/colored.tscn Normal file
View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://vkvtap437nnf"]
[ext_resource type="Script" path="res://color/Colored.gd" id="1_wy58a"]
[node name="Colored" type="Node"]
script = ExtResource("1_wy58a")

View file

@ -1,47 +1,55 @@
[gd_scene load_steps=21 format=3 uid="uid://c4ew8x4gch275"] [gd_scene load_steps=23 format=3 uid="uid://c4ew8x4gch275"]
[ext_resource type="Script" path="res://converters/converter.gd" id="1_f5plk"] [ext_resource type="Script" path="res://converters/converter.gd" id="1_f5plk"]
[ext_resource type="Texture2D" uid="uid://440yhlpwpfw4" path="res://converters/copper_to_silver/copper_converter_back.png" id="2_10qqc"] [ext_resource type="Texture2D" uid="uid://bbn8t32v1ie0y" path="res://entity/gold_converter_back.png" id="2_4abgr"]
[ext_resource type="Texture2D" uid="uid://dq5aowbt2wxec" path="res://converters/copper_to_silver/copper_converter_front_1.png" id="3_m7rs2"] [ext_resource type="Texture2D" uid="uid://0u8wtb38l3s5" path="res://entity/gold_converter_front_1.png" id="3_rtp3d"]
[ext_resource type="Texture2D" uid="uid://ck254fewe4l41" path="res://converters/copper_to_silver/copper_converter_front_2.png" id="4_aibvv"] [ext_resource type="Texture2D" uid="uid://bo46tom7khspd" path="res://entity/gold_converter_front_2.png" id="4_oathm"]
[ext_resource type="Texture2D" uid="uid://dg4qq1pgojk8d" path="res://converters/copper_to_silver/copper_converter_front_3.png" id="5_vqrfc"] [ext_resource type="Texture2D" uid="uid://dclhuc7h26brj" path="res://entity/gold_converter_front_3.png" id="5_5deah"]
[ext_resource type="Texture2D" uid="uid://60502lbpup6" path="res://converters/copper_to_silver/copper_converter_front_4.png" id="6_r2hfj"] [ext_resource type="Texture2D" uid="uid://dn433fvnhgp5v" path="res://entity/gold_converter_front_4.png" id="6_isyc7"]
[ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_m34js"] [ext_resource type="PackedScene" uid="uid://c5w3b55aiui6c" path="res://collector/collector.tscn" id="7_m34js"]
[ext_resource type="Texture2D" uid="uid://bfxmurfe4o44s" path="res://entity/gold_converter_front_5.png" id="7_w8dcp"]
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_qwbjp"] [ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="8_qwbjp"]
[ext_resource type="PackedScene" uid="uid://w2er6cmul5yx" path="res://entity/gem/gem.tscn" id="9_2ugi1"] [ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="10_5hiv4"]
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_f1h6i"] [ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="10_f1h6i"]
[ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_ywwn2"] [ext_resource type="AudioStream" uid="uid://7tw5efuo3gxj" path="res://audio/conversione/coin_to_coin.wav" id="11_ywwn2"]
[sub_resource type="AtlasTexture" id="AtlasTexture_62dyi"] [sub_resource type="AtlasTexture" id="AtlasTexture_wy1v3"]
atlas = ExtResource("3_m7rs2") atlas = ExtResource("3_rtp3d")
region = Rect2(0, 2, 32, 33) region = Rect2(0, 4, 32, 31)
[sub_resource type="AtlasTexture" id="AtlasTexture_gs3wo"] [sub_resource type="AtlasTexture" id="AtlasTexture_2164d"]
atlas = ExtResource("4_aibvv") atlas = ExtResource("4_oathm")
region = Rect2(0, 2, 32, 33) region = Rect2(0, 4, 32, 31)
[sub_resource type="AtlasTexture" id="AtlasTexture_tboq2"] [sub_resource type="AtlasTexture" id="AtlasTexture_i5584"]
atlas = ExtResource("5_vqrfc") atlas = ExtResource("5_5deah")
region = Rect2(0, 2, 32, 33) region = Rect2(0, 4, 32, 31)
[sub_resource type="AtlasTexture" id="AtlasTexture_okgf4"] [sub_resource type="AtlasTexture" id="AtlasTexture_qad4c"]
atlas = ExtResource("6_r2hfj") atlas = ExtResource("6_isyc7")
region = Rect2(0, 2, 32, 33) region = Rect2(0, 4, 32, 31)
[sub_resource type="AtlasTexture" id="AtlasTexture_600qi"]
atlas = ExtResource("7_w8dcp")
region = Rect2(0, 4, 32, 31)
[sub_resource type="SpriteFrames" id="SpriteFrames_4m3dg"] [sub_resource type="SpriteFrames" id="SpriteFrames_4m3dg"]
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_62dyi") "texture": SubResource("AtlasTexture_wy1v3")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_gs3wo") "texture": SubResource("AtlasTexture_2164d")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_tboq2") "texture": SubResource("AtlasTexture_i5584")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_okgf4") "texture": SubResource("AtlasTexture_qad4c")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_600qi")
}], }],
"loop": true, "loop": true,
"name": &"default", "name": &"default",
@ -68,12 +76,14 @@ script = ExtResource("1_f5plk")
[node name="SpriteBack" type="Sprite2D" parent="."] [node name="SpriteBack" type="Sprite2D" parent="."]
z_index = -2 z_index = -2
texture_filter = 1 texture_filter = 1
texture = ExtResource("2_10qqc") texture = ExtResource("2_4abgr")
[node name="SpriteFront" type="AnimatedSprite2D" parent="."] [node name="SpriteFront" type="AnimatedSprite2D" parent="."]
z_index = 2 z_index = 2
texture_filter = 1 texture_filter = 1
position = Vector2(0, 2)
sprite_frames = SubResource("SpriteFrames_4m3dg") sprite_frames = SubResource("SpriteFrames_4m3dg")
frame_progress = 0.0969002
[node name="LeftWall" type="CollisionShape2D" parent="."] [node name="LeftWall" type="CollisionShape2D" parent="."]
z_index = 2 z_index = 2
@ -102,7 +112,7 @@ debug_color = Color(0, 0.701961, 0.188235, 0.419608)
[node name="Spawner" parent="." instance=ExtResource("8_qwbjp")] [node name="Spawner" parent="." instance=ExtResource("8_qwbjp")]
position = Vector2(0, 8) position = Vector2(0, 8)
scene = ExtResource("9_2ugi1") scene = ExtResource("10_5hiv4")
buffer_cap = 1 buffer_cap = 1
spawn_rect = Rect2(-8, 0, 16, 4) spawn_rect = Rect2(-8, 0, 16, 4)
spawn_rotation_degrees_min = 80.0 spawn_rotation_degrees_min = 80.0

View file

@ -23,11 +23,8 @@ func _on_sleeping_state_changed():
was_sleeping = true was_sleeping = true
func _on_body_entered(body): func _on_body_entered(body):
print("touch")
if not was_sleeping: if not was_sleeping:
if touched==false and $Timer.is_stopped(): if touched==false and $Timer.is_stopped():
print(str(self)+" hits "+str(body))
#$sound_touch.play() #$sound_touch.play()
$Timer.start() $Timer.start()
var other_node=body var other_node=body

BIN
entity/gem/diamond_white.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bgq5afrrpc4a3"
path="res://.godot/imported/diamond_white.png-ea17eba66708a2de5eae13c889056729.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/gem/diamond_white.png"
dest_files=["res://.godot/imported/diamond_white.png-ea17eba66708a2de5eae13c889056729.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

@ -1,11 +0,0 @@
extends RigidBody2D
# Called when the node enters the scene tree for the first time.
func _ready():
print($Valuable.value)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

View file

@ -1,9 +1,11 @@
[gd_scene load_steps=8 format=3 uid="uid://w2er6cmul5yx"] [gd_scene load_steps=10 format=3 uid="uid://bawprh8kluilq"]
[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_vmemd"] [ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_vmemd"]
[ext_resource type="Texture2D" uid="uid://b21bsbo5f0ed7" path="res://entity/gem/gemstone.png" id="3_6jejy"] [ext_resource type="Texture2D" uid="uid://b21bsbo5f0ed7" path="res://entity/gem/gemstone.png" id="3_6jejy"]
[ext_resource type="PackedScene" uid="uid://vkvtap437nnf" path="res://color/colored.tscn" id="4_2cetq"]
[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_idoeu"] [ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_idoeu"]
[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_7bd6c"] [ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_7bd6c"]
[ext_resource type="Shader" path="res://entity/gem/gem_shading_material.gdshader" id="5_v6ppl"]
[ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="6_3lulr"] [ext_resource type="Script" path="res://entity/gem/RandomValue.gd" id="6_3lulr"]
[ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="6_svrnw"] [ext_resource type="AudioStream" uid="uid://br25ip30mu174" path="res://audio/conversione/mechanic_sound.wav" id="6_svrnw"]
@ -29,6 +31,9 @@ shape = SubResource("CapsuleShape2D_jkfas")
texture_filter = 1 texture_filter = 1
texture = ExtResource("3_6jejy") texture = ExtResource("3_6jejy")
[node name="Colored" parent="CollisionShape2D/Sprite" instance=ExtResource("4_2cetq")]
shader = ExtResource("5_v6ppl")
[node name="Collectible" parent="." instance=ExtResource("4_idoeu")] [node name="Collectible" parent="." instance=ExtResource("4_idoeu")]
type = &"Silver" type = &"Silver"

View file

@ -0,0 +1,25 @@
shader_type canvas_item;
uniform float hue;
vec3 hsv_to_rgb(vec3 color) {
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
vec3 p = abs(fract(color.xxx + K.xyz) * 6.0 - K.www);
return color.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), color.y);
}
vec3 rgb_to_hsv(vec3 color) {
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(color.bg, K.wz), vec4(color.gb, K.xy), step(color.b, color.g));
vec4 q = mix(vec4(p.xyw, color.r), vec4(color.r, p.yzx), step(p.x, color.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
void fragment() {
vec3 hsv = rgb_to_hsv(COLOR.rgb);
hsv.x = hue;
vec3 rgb = hsv_to_rgb(hsv);
COLOR.rgb = rgb;
}

View file

@ -0,0 +1,7 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://dbnxaw6yecsyv"]
[ext_resource type="Shader" path="res://entity/gem/gem_shading_material.gdshader" id="1_h813y"]
[resource]
shader = ExtResource("1_h813y")
shader_parameter/hue = 0.0

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://chc8wqc1pclbk"
path="res://.godot/imported/gold_converter_back.png-542530d6d643b64e20755f9b54d1da49.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/gold_converter_back.png"
dest_files=["res://.godot/imported/gold_converter_back.png-542530d6d643b64e20755f9b54d1da49.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://dgw5ip5qf5k7a"
path="res://.godot/imported/gold_converter_front_1.png-20d40342907ebeaf5453b3fbc06f6b04.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/gold_converter_front_1.png"
dest_files=["res://.godot/imported/gold_converter_front_1.png-20d40342907ebeaf5453b3fbc06f6b04.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://h7hu4paxjq84"
path="res://.godot/imported/gold_converter_front_2.png-6b48a8121d01d35430dedd6a7ebaaed7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/gold_converter_front_2.png"
dest_files=["res://.godot/imported/gold_converter_front_2.png-6b48a8121d01d35430dedd6a7ebaaed7.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://dlog0f5nk4b3c"
path="res://.godot/imported/gold_converter_front_3.png-4b8a07d186c945c584be92c7bbbf79b8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/gold_converter_front_3.png"
dest_files=["res://.godot/imported/gold_converter_front_3.png-4b8a07d186c945c584be92c7bbbf79b8.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://cj5m5k0hr3wmw"
path="res://.godot/imported/gold_converter_front_4.png-1dd90efaf325965268d803bbed7fda3b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/gold_converter_front_4.png"
dest_files=["res://.godot/imported/gold_converter_front_4.png-1dd90efaf325965268d803bbed7fda3b.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://b5uershakuq20"
path="res://.godot/imported/gold_converter_front_5.png-a825d75eb13b041b1a6213049c3d7637.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/gold_converter_front_5.png"
dest_files=["res://.godot/imported/gold_converter_front_5.png-a825d75eb13b041b1a6213049c3d7637.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://wpen8vmuyvqv"
path="res://.godot/imported/item_chalice.png-7c6bf5aba6af81724e4a9b47b0fa9097.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/item_chalice.png"
dest_files=["res://.godot/imported/item_chalice.png-7c6bf5aba6af81724e4a9b47b0fa9097.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://dvthocklcjh15"
path="res://.godot/imported/item_chalice_gems.png-182c84a35d2925a897cade98742ac714.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/item_chalice_gems.png"
dest_files=["res://.godot/imported/item_chalice_gems.png-182c84a35d2925a897cade98742ac714.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://brlo5pqo0x86l"
path="res://.godot/imported/item_crown.png-b1fdb9663d17347d4fbd39044017f645.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/item_crown.png"
dest_files=["res://.godot/imported/item_crown.png-b1fdb9663d17347d4fbd39044017f645.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://l7kr24oe0fc8"
path="res://.godot/imported/item_crown_gems.png-57e99547b8bc3470cb75cd17193c0abd.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/item_crown_gems.png"
dest_files=["res://.godot/imported/item_crown_gems.png-57e99547b8bc3470cb75cd17193c0abd.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://dcw3cq3ni253t"
path="res://.godot/imported/item_ring.png-a4f5983b41259568642782622b1a92ac.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/item_ring.png"
dest_files=["res://.godot/imported/item_ring.png-a4f5983b41259568642782622b1a92ac.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://dnfkvj0usdb6n"
path="res://.godot/imported/item_ring_gems.png-15fb2caf015b721a6fe6cd5c86878289.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entity/item_ring_gems.png"
dest_files=["res://.godot/imported/item_ring_gems.png-15fb2caf015b721a6fe6cd5c86878289.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

@ -55,7 +55,6 @@ func _on_purchase_success(what: PurchasableItem):
store_collector_panel.hide() store_collector_panel.hide()
func _on_store_collector_collected(_body: RigidBody2D): func _on_store_collector_collected(_body: RigidBody2D):
print("collected")
update_counter_text() update_counter_text()
func update_counter_text(): func update_counter_text():
@ -76,4 +75,3 @@ func update_counter_icon():
store_collector_texturerect.texture = upgrade_gold_texture store_collector_texturerect.texture = upgrade_gold_texture
else: else:
store_collector_texturerect.texture = null store_collector_texturerect.texture = null

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://c3rxmcwa5nqng"] [gd_scene load_steps=22 format=3 uid="uid://c3rxmcwa5nqng"]
[ext_resource type="Script" path="res://game/game.gd" id="1_i3ly0"] [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://bllsprv8orpn4" path="res://bottle/bottle.tscn" id="1_y7o2l"]
@ -8,13 +8,15 @@
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper/coin_copper.tscn" id="4_5oayc"] [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="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://beg758fa6o0cs" path="res://value/evaluator.tscn" id="6_my6nv"]
[ext_resource type="PackedScene" uid="uid://du3005kwybbrh" path="res://entity/coin_gold/coin_gold.tscn" id="7_hh80i"]
[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://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://but1bdslxp5jl" path="res://converters/silver_to_gold/silver_converter.tscn" id="8_0bbpi"]
[ext_resource type="PackedScene" uid="uid://bawprh8kluilq" path="res://entity/gem/gem.tscn" id="8_a3sk0"]
[ext_resource type="PackedScene" uid="uid://c2rlx7egl7xiv" path="res://collector/universal_collector.tscn" id="9_7op48"] [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="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="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"] [ext_resource type="Texture2D" uid="uid://c8pvjgtr2ufjl" path="res://interface/upgrade_copper.png" id="11_lt33g"]
[ext_resource type="PackedScene" uid="uid://c4ew8x4gch275" path="res://converters/gold_to_gem/gem_converter.tscn" id="16_e62br"] [ext_resource type="PackedScene" uid="uid://qtk4tm6l367w" path="res://interface/ghost.tscn" id="16_8vhx6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"]
size = Vector2(80, 80) size = Vector2(80, 80)
@ -38,11 +40,16 @@ upgrade_copper_texture = ExtResource("11_lt33g")
upgrade_silver_texture = ExtResource("3_8wvr1") upgrade_silver_texture = ExtResource("3_8wvr1")
upgrade_gold_texture = ExtResource("4_i557v") upgrade_gold_texture = ExtResource("4_i557v")
[node name="Ghost" parent="." instance=ExtResource("16_8vhx6")]
position = Vector2(90, 306)
collision_layer = 8
collision_mask = 6
[node name="Bottle" parent="." instance=ExtResource("1_y7o2l")] [node name="Bottle" parent="." instance=ExtResource("1_y7o2l")]
[node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] [node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
position = Vector2(136, 0) position = Vector2(136, 0)
scene = ExtResource("4_5oayc") scene = ExtResource("8_a3sk0")
target = NodePath("..") target = NodePath("..")
buffer_cap = 1 buffer_cap = 1
spawn_rect = Rect2(-20, 0, 40, 0) spawn_rect = Rect2(-20, 0, 40, 0)
@ -54,6 +61,7 @@ shape = SubResource("RectangleShape2D_4uksi")
debug_color = Color(0, 0.6, 0.701961, 0) debug_color = Color(0, 0.6, 0.701961, 0)
[node name="Timer" type="Timer" parent="TimeSpawner"] [node name="Timer" type="Timer" parent="TimeSpawner"]
wait_time = 0.1
autostart = true autostart = true
[node name="ButtonSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")] [node name="ButtonSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
@ -79,7 +87,7 @@ shape = SubResource("RectangleShape2D_rh35r")
debug_color = Color(0, 0.6, 0.701961, 0) debug_color = Color(0, 0.6, 0.701961, 0)
[node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")] [node name="CopperConverter" parent="." instance=ExtResource("7_ipeok")]
position = Vector2(140, 151) position = Vector2(62, 176)
metadata/_edit_group_ = true metadata/_edit_group_ = true
[node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")] [node name="Spawner" parent="CopperConverter" index="6" node_paths=PackedStringArray("target")]
@ -89,12 +97,8 @@ target = NodePath("../..")
position = Vector2(0, 4.08333) position = Vector2(0, 4.08333)
[node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")] [node name="SilverConverter" parent="." instance=ExtResource("8_0bbpi")]
position = Vector2(139, 254) position = Vector2(205, 337)
rotation = -3.14159 rotation = -3.14159
metadata/_edit_group_ = true
[node name="CollectShape" parent="SilverConverter/Collector" index="1"]
metadata/_edit_group_ = true
[node name="Spawner" parent="SilverConverter" index="6" node_paths=PackedStringArray("target")] [node name="Spawner" parent="SilverConverter" index="6" node_paths=PackedStringArray("target")]
target = NodePath("../..") target = NodePath("../..")
@ -176,10 +180,6 @@ position = Vector2(405, 540)
shape = SubResource("RectangleShape2D_jed57") shape = SubResource("RectangleShape2D_jed57")
debug_color = Color(0, 0, 0, 0.419608) debug_color = Color(0, 0, 0, 0.419608)
[node name="GemConverter" parent="." instance=ExtResource("16_e62br")]
position = Vector2(139, 371)
metadata/_edit_group_ = true
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"] [connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
[connection signal="changed" from="Evaluator" to="." method="_on_score_changed"] [connection signal="changed" from="Evaluator" to="." method="_on_score_changed"]
[connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"] [connection signal="collected" from="StoreCollector" to="." method="_on_store_collector_collected"]

20
game_camera.gd Normal file
View file

@ -0,0 +1,20 @@
extends Camera2D
class_name GameCamera
func set_camera_position(scaling_factor: float):
var cutouts: Array[Rect2] = DisplayServer.get_display_cutouts()
var bottom
if len(cutouts) == 0:
bottom = 8
else:
var screen: Vector2i = DisplayServer.screen_get_size()
var rect: Rect2i = DisplayServer.get_display_safe_area()
bottom = max(8, screen.y - rect.end.y)
print("[GameCamera] Bottom margin is: ", bottom)
var size = get_window().size.y / scaling_factor
position.y = 480 - (size / 2)

View file

@ -5,6 +5,10 @@ class_name CustomUI
@onready var window: Window = get_window() @onready var window: Window = get_window()
@onready var viewport: Viewport = window.get_viewport() @onready var viewport: Viewport = window.get_viewport()
@onready var game_safe_ui: MarginContainer = $GameSafeUI
@onready var shop_safe_ui: MarginContainer = $ShopSafeUI
@onready var game_camera: GameCamera = $GameViewport/Viewport/GameCamera
func _ready(): func _ready():
viewport.size_changed.connect(_on_viewport_size_changed) viewport.size_changed.connect(_on_viewport_size_changed)
@ -21,4 +25,6 @@ func _on_viewport_size_changed():
scaling_factor = window_size.y / 480 scaling_factor = window_size.y / 480
print("[View] Scaling factor is: ", scaling_factor) print("[View] Scaling factor is: ", scaling_factor)
get_window().set_content_scale_factor(scaling_factor) get_window().set_content_scale_factor(scaling_factor)
$SafeUI.set_safe_margins(scaling_factor) game_safe_ui.set_safe_margins(scaling_factor)
shop_safe_ui.set_safe_margins(scaling_factor)
game_camera.set_camera_position(scaling_factor)

View file

@ -5,12 +5,11 @@
[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" node_paths=PackedStringArray("score_button")]
custom_minimum_size = Vector2(0, 54)
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 10
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2
theme = ExtResource("1_ppf8y") theme = ExtResource("1_ppf8y")
script = ExtResource("2_33nqa") script = ExtResource("2_33nqa")
score_button = NodePath("ScoreButton") score_button = NodePath("ScoreButton")
@ -18,7 +17,6 @@ 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)
layout_mode = 0 layout_mode = 0
text = "$0.00"
[node name="SpawnButton" type="Button" parent="."] [node name="SpawnButton" type="Button" parent="."]
custom_minimum_size = Vector2(88, 0) custom_minimum_size = Vector2(88, 0)

25
interface/ghost.gd Normal file
View file

@ -0,0 +1,25 @@
extends Area2D
class_name Ghost
var is_dragging: bool
var previous_position: Vector2
func _input(event: InputEvent):
if event is InputEventMouseButton:
is_dragging = event.pressed
previous_position = event.position
elif event is InputEventScreenTouch:
is_dragging = event.pressed
previous_position = event.position
if is_dragging:
if event is InputEventMouseMotion:
var delta = event.position - previous_position
print(delta)
position += delta
previous_position = event.position
elif event is InputEventScreenDrag:
var delta = event.position - previous_position
print(delta)
position += delta
previous_position = event.position

20
interface/ghost.tscn Normal file
View file

@ -0,0 +1,20 @@
[gd_scene load_steps=4 format=3 uid="uid://qtk4tm6l367w"]
[ext_resource type="Script" path="res://interface/ghost.gd" id="1_gvls7"]
[ext_resource type="Texture2D" uid="uid://pj3ip6vlatms" path="res://converters/copper_to_silver/copper_converter.png" id="1_lo8gj"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_hmopu"]
size = Vector2(34, 34)
[node name="Ghost" type="Area2D"]
scale = Vector2(3, 3)
input_pickable = false
script = ExtResource("1_gvls7")
[node name="Sprite" type="Sprite2D" parent="."]
modulate = Color(1, 1, 1, 0.470588)
z_index = 10
texture = ExtResource("1_lo8gj")
[node name="Shape" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_hmopu")

View file

@ -2,6 +2,12 @@ extends MarginContainer
class_name SafeUI class_name SafeUI
@export var apply_margin_left: bool
@export var apply_margin_right: bool
@export var apply_margin_top: bool
@export var apply_margin_bottom: bool
func set_safe_margins(scaling_factor: float): func set_safe_margins(scaling_factor: float):
var cutouts: Array[Rect2] = DisplayServer.get_display_cutouts() var cutouts: Array[Rect2] = DisplayServer.get_display_cutouts()
@ -18,16 +24,21 @@ func set_safe_margins(scaling_factor: float):
else: else:
var screen: Vector2i = DisplayServer.screen_get_size() var screen: Vector2i = DisplayServer.screen_get_size()
var rect: Rect2i = DisplayServer.get_display_safe_area() var rect: Rect2i = DisplayServer.get_display_safe_area()
left = rect.position.x left = max(8, rect.position.x)
right = screen.x - rect.end.x right = max(8, screen.x - rect.end.x)
top = rect.position.y top = max(8, rect.position.y)
bottom = screen.y - rect.end.y bottom = max(8, screen.y - rect.end.y)
print("[SafeUI] Left margin is: ", left) print("[SafeUI] Left margin is: ", left)
print("[SafeUI] Right margin is: ", right) print("[SafeUI] Right margin is: ", right)
print("[SafeUI] Top margin is: ", top) print("[SafeUI] Top margin is: ", top)
print("[SafeUI] Bottom margin is: ", bottom) print("[SafeUI] Bottom margin is: ", bottom)
if apply_margin_left:
add_theme_constant_override("margin_left", left / scaling_factor) add_theme_constant_override("margin_left", left / scaling_factor)
if apply_margin_right:
add_theme_constant_override("margin_right", right / scaling_factor) add_theme_constant_override("margin_right", right / scaling_factor)
if apply_margin_top:
add_theme_constant_override("margin_top", top / scaling_factor) add_theme_constant_override("margin_top", top / scaling_factor)
if apply_margin_bottom:
add_theme_constant_override("margin_bottom", bottom / scaling_factor) add_theme_constant_override("margin_bottom", bottom / scaling_factor)

11
interface/safe_ui.tscn Normal file
View file

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=3 uid="uid://e4be5wkya7g0"]
[ext_resource type="Script" path="res://interface/safe_ui.gd" id="1_ceq6m"]
[node name="SafeUI" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_ceq6m")

16
main.gd
View file

@ -3,8 +3,10 @@ class_name Main
@onready var tree: SceneTree = get_tree() @onready var tree: SceneTree = get_tree()
@onready var game_ui: GameUI = $CustomUI/SafeUI/GameUI @onready var game_safe_ui: MarginContainer = $CustomUI/GameSafeUI
@onready var shop_ui: ShopUI = $CustomUI/SafeUI/ShopUI @onready var game_ui: GameUI = $CustomUI/GameSafeUI/GameUI
@onready var shop_safe_ui: MarginContainer = $CustomUI/ShopSafeUI
@onready var shop_ui: ShopUI = $CustomUI/ShopSafeUI/ShopUI
enum UIState { enum UIState {
@ -20,12 +22,14 @@ enum UIState {
match value: match value:
UIState.GAME: UIState.GAME:
tree.paused = false tree.paused = false
game_ui.show() game_safe_ui.show()
shop_ui.hide() shop_safe_ui.hide()
shop_safe_ui.process_mode = Node.PROCESS_MODE_DISABLED
UIState.SHOP: UIState.SHOP:
tree.paused = true tree.paused = true
game_ui.hide() game_safe_ui.hide()
shop_ui.show() shop_safe_ui.show()
shop_safe_ui.process_mode = Node.PROCESS_MODE_ALWAYS
UIState.SCORE: UIState.SCORE:
pass pass

106
main.tscn
View file

@ -1,12 +1,17 @@
[gd_scene load_steps=8 format=3 uid="uid://dqm0h5h0baqcg"] [gd_scene load_steps=10 format=3 uid="uid://dqm0h5h0baqcg"]
[ext_resource type="Script" path="res://main.gd" id="1_fqt34"] [ext_resource type="Script" path="res://main.gd" id="1_fqt34"]
[ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_je7w1"] [ext_resource type="Theme" uid="uid://ba5utvfhnxa5i" path="res://interface/interface_theme.tres" id="1_je7w1"]
[ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="2_32lou"] [ext_resource type="PackedScene" uid="uid://c3rxmcwa5nqng" path="res://game/game.tscn" id="2_32lou"]
[ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="2_qj86l"] [ext_resource type="PackedScene" uid="uid://cklkdygv61bny" path="res://interface/shop_ui.tscn" id="2_qj86l"]
[ext_resource type="Script" path="res://interface/custom_ui.gd" id="3_xav0n"] [ext_resource type="Script" path="res://interface/custom_ui.gd" id="3_xav0n"]
[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"] [ext_resource type="PackedScene" uid="uid://bo5unrhqpoyim" path="res://interface/game_ui.tscn" id="4_siim3"]
[ext_resource type="PackedScene" uid="uid://bpvx3nkkbluip" path="res://safe_ui.tscn" id="5_2uxda"]
[ext_resource type="Script" path="res://game_camera.gd" id="5_xxjtg"]
[sub_resource type="GDScript" id="GDScript_kyj65"]
script/source = "extends SubViewport
"
[node name="Main" type="Node"] [node name="Main" type="Node"]
script = ExtResource("1_fqt34") script = ExtResource("1_fqt34")
@ -20,65 +25,68 @@ anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
size_flags_vertical = 8 size_flags_vertical = 8
mouse_filter = 1
theme = ExtResource("1_je7w1") theme = ExtResource("1_je7w1")
script = ExtResource("3_xav0n") script = ExtResource("3_xav0n")
[node name="GameWorld" type="CenterContainer" parent="CustomUI"] [node name="GameViewport" type="SubViewportContainer" parent="CustomUI"]
custom_minimum_size = Vector2(270, 480)
layout_mode = 1
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
grow_horizontal = 2
grow_vertical = 0
[node name="GameViewport" type="SubViewportContainer" parent="CustomUI/GameWorld"]
layout_mode = 2
[node name="Viewport" type="SubViewport" parent="CustomUI/GameWorld/GameViewport"]
disable_3d = true
handle_input_locally = false
size = Vector2i(270, 480)
render_target_update_mode = 4
[node name="Game" parent="CustomUI/GameWorld/GameViewport/Viewport" instance=ExtResource("2_32lou")]
[node name="Camera" type="Camera2D" parent="CustomUI/GameWorld/GameViewport/Viewport"]
anchor_mode = 0
[node name="SafeUI" type="MarginContainer" parent="CustomUI"]
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("4_nel0n") mouse_default_cursor_shape = 5
stretch = true
[node name="GameUI" parent="CustomUI/SafeUI" instance=ExtResource("4_siim3")] [node name="Viewport" type="SubViewport" parent="CustomUI/GameViewport"]
disable_3d = true
handle_input_locally = false
physics_object_picking = true
size = Vector2i(270, 480)
render_target_update_mode = 4
script = SubResource("GDScript_kyj65")
[node name="Game" parent="CustomUI/GameViewport/Viewport" instance=ExtResource("2_32lou")]
[node name="GameCamera" type="Camera2D" parent="CustomUI/GameViewport/Viewport"]
position = Vector2(135, 480)
script = ExtResource("5_xxjtg")
[node name="GameSafeUI" parent="CustomUI" instance=ExtResource("5_2uxda")]
layout_mode = 1
anchors_preset = 10
anchor_bottom = 0.0
grow_vertical = 1
apply_margin_left = true
apply_margin_right = true
apply_margin_top = true
[node name="GameUI" parent="CustomUI/GameSafeUI" instance=ExtResource("4_siim3")]
layout_mode = 2 layout_mode = 2
[node name="ShopUI" parent="CustomUI/SafeUI" instance=ExtResource("2_qj86l")] [node name="ShopSafeUI" parent="CustomUI" instance=ExtResource("5_2uxda")]
process_mode = 3 process_mode = 4
visible = false visible = false
layout_mode = 1
apply_margin_left = true
apply_margin_right = true
apply_margin_top = true
apply_margin_bottom = true
[node name="ShopUI" parent="CustomUI/ShopSafeUI" instance=ExtResource("2_qj86l")]
layout_mode = 2 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/GameViewport/Viewport/Game" to="CustomUI/GameSafeUI/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/GameSafeUI/GameUI" to="." method="_on_game_ui_score_button_pressed"]
[connection signal="score_button_pressed" from="CustomUI/SafeUI/GameUI" to="." method="_on_game_ui_score_button_pressed"] [connection signal="shop_button_pressed" from="CustomUI/GameSafeUI/GameUI" to="." method="_on_game_ui_shop_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/GameSafeUI/GameUI" to="CustomUI/GameViewport/Viewport/Game" method="trigger_spawn"]
[connection signal="spawn_button_pressed" from="CustomUI/SafeUI/GameUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="trigger_spawn"] [connection signal="back_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"]
[connection signal="back_button_pressed" from="CustomUI/SafeUI/ShopUI" to="." method="_on_shop_ui_back_button_pressed"] [connection signal="delete_button_pressed" from="CustomUI/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_delete_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/ShopSafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"]
[connection signal="purchase_begin" from="CustomUI/SafeUI/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/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_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/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_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/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_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/SafeUI/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/SafeUI/ShopUI" to="CustomUI/GameWorld/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/SafeUI/ShopUI" to="CustomUI/GameWorld/GameViewport/Viewport/Game" method="_on_upgraded_manual_spawn"]

View file

@ -30,6 +30,7 @@ window/handheld/orientation=1
2d_physics/layer_1="Default" 2d_physics/layer_1="Default"
2d_physics/layer_2="Bottle" 2d_physics/layer_2="Bottle"
2d_physics/layer_3="Entities" 2d_physics/layer_3="Entities"
2d_physics/layer_4="Ghost"
[physics] [physics]

11
safe_ui.tscn Normal file
View file

@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=3 uid="uid://bpvx3nkkbluip"]
[ext_resource type="Script" path="res://interface/safe_ui.gd" id="1_y2ofp"]
[node name="SafeUI" type="MarginContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_y2ofp")