mirror of
https://github.com/Steffo99/swear-jar.git
synced 2024-11-24 08:34:19 +00:00
Tweak stuff but i forgot which
This commit is contained in:
parent
62190f1b18
commit
4cb232fb38
11 changed files with 202 additions and 83 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -3,7 +3,7 @@
|
||||||
".godot": true,
|
".godot": true,
|
||||||
"**/*.godot": true,
|
"**/*.godot": true,
|
||||||
"**/*.tres": true,
|
"**/*.tres": true,
|
||||||
"**/*.tscn": true,
|
"**/*.tscn": false,
|
||||||
"**/*.import": true,
|
"**/*.import": true,
|
||||||
},
|
},
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
|
|
|
@ -1,18 +1,117 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://bllsprv8orpn4"]
|
[gd_scene load_steps=5 format=3 uid="uid://bllsprv8orpn4"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://os7j1nq0sk5m" path="res://bottle/bottle_tiles.png" id="1_iubt6"]
|
[ext_resource type="Texture2D" uid="uid://vmedndbi8crf" path="res://bottle/glass_tileset.png" id="1_qvgnf"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_midqx"]
|
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_y0g3v"]
|
||||||
resource_name = "Bottle Placeholder"
|
friction = 0.1
|
||||||
texture = ExtResource("1_iubt6")
|
|
||||||
0:0/next_alternative_id = 2
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_6tyce"]
|
||||||
|
texture = ExtResource("1_qvgnf")
|
||||||
0:0/0 = 0
|
0:0/0 = 0
|
||||||
|
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:0/0 = 0
|
||||||
|
1:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:0/0 = 0
|
||||||
|
2:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:0/0 = 0
|
||||||
|
3:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:0/0 = 0
|
||||||
|
4:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
5:0/0 = 0
|
||||||
|
5:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:0/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
0:1/0 = 0
|
||||||
|
0:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:1/0 = 0
|
||||||
|
2:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:1/0 = 0
|
||||||
|
3:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
5:1/0 = 0
|
||||||
|
5:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:1/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
0:2/0 = 0
|
||||||
|
0:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
0:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
0:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:2/0 = 0
|
||||||
|
1:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:2/0 = 0
|
||||||
|
2:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:2/0 = 0
|
||||||
|
3:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:2/0 = 0
|
||||||
|
4:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
5:2/0 = 0
|
||||||
|
5:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
5:2/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
5:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:3/0 = 0
|
||||||
|
1:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:3/0 = 0
|
||||||
|
2:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:3/0 = 0
|
||||||
|
3:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:3/0 = 0
|
||||||
|
4:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:3/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
1:4/0 = 0
|
||||||
|
1:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
1:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
1:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
2:4/0 = 0
|
||||||
|
2:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
2:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
2:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
3:4/0 = 0
|
||||||
|
3:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
3:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
3:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
4:4/0 = 0
|
||||||
|
4:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
|
||||||
|
4:4/0/physics_layer_0/angular_velocity = 0.0
|
||||||
|
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)
|
||||||
|
|
||||||
[sub_resource type="TileSet" id="TileSet_tr7be"]
|
[sub_resource type="TileSet" id="TileSet_tr7be"]
|
||||||
sources/0 = SubResource("TileSetAtlasSource_midqx")
|
physics_layer_0/collision_layer = 3
|
||||||
|
physics_layer_0/collision_mask = 3
|
||||||
|
physics_layer_0/physics_material = SubResource("PhysicsMaterial_y0g3v")
|
||||||
|
sources/1 = SubResource("TileSetAtlasSource_6tyce")
|
||||||
|
|
||||||
[node name="Bottle" type="TileMap"]
|
[node name="Bottle" type="TileMap"]
|
||||||
tile_set = SubResource("TileSet_tr7be")
|
tile_set = SubResource("TileSet_tr7be")
|
||||||
collision_visibility_mode = 1
|
|
||||||
format = 2
|
format = 2
|
||||||
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)
|
layer_0/name = "Main"
|
||||||
|
layer_0/tile_data = PackedInt32Array(1900544, 1, 2, 1900545, 65537, 2, 1900546, 65537, 2, 1900547, 65537, 2, 1900548, 65537, 2, 1900549, 65537, 2, 1900550, 65537, 2, 1900551, 65537, 2, 1900552, 65537, 2, 1900553, 65537, 2, 1900554, 65537, 2, 1900555, 65537, 2, 1900556, 65537, 2, 1900557, 65537, 2, 1900558, 65537, 2, 1900559, 65537, 2, 1900560, 131073, 2, 1835024, 131073, 1, 1769488, 131073, 1, 1703952, 131073, 1, 1638416, 131073, 1, 1572880, 131073, 1, 1507344, 131073, 1, 1441808, 131073, 1, 1376272, 131073, 1, 1310736, 131073, 1, 1245200, 131073, 1, 1179664, 131073, 1, 1114128, 131073, 1, 1048592, 131073, 1, 983056, 131073, 1, 917520, 131073, 1, 851984, 131073, 1, 786448, 131073, 1, 720912, 131073, 1, 655376, 131073, 1, 589840, 131073, 1, 524304, 131073, 1, 458768, 131073, 1, 393232, 131073, 1, 327696, 131073, 1, 393216, 1, 1, 458752, 1, 1, 524288, 1, 1, 589824, 1, 1, 655360, 1, 1, 720896, 1, 1, 786432, 1, 1, 851968, 1, 1, 917504, 1, 1, 983040, 1, 1, 1048576, 1, 1, 1114112, 1, 1, 1179648, 1, 1, 1245184, 1, 1, 1310720, 1, 1, 1376256, 1, 1, 1441792, 1, 1, 1507328, 1, 1, 1572864, 1, 1, 1638400, 1, 1, 1703936, 1, 1, 1769472, 1, 1, 1835008, 1, 1, 262144, 1, 0, 327680, 1, 1, 262145, 65537, 0, 262146, 65537, 0, 262147, 65537, 0, 262148, 65537, 0, 262160, 131073, 0, 262159, 65537, 0, 262158, 65537, 0, 262157, 65537, 0, 262156, 65537, 0, 262149, 327681, 2, 196613, 327681, 1, 131077, 327681, 1, 65541, 327681, 1, 5, 327681, 0, 4, 196609, 4, 262155, 196609, 2, 196619, 196609, 1, 131083, 196609, 1, 65547, 196609, 1, 11, 196609, 0, 12, 262145, 4)
|
||||||
|
|
|
@ -3,15 +3,15 @@
|
||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://vmedndbi8crf"
|
uid="uid://vmedndbi8crf"
|
||||||
path="res://.godot/imported/glass_tileset.png-57c4af482ec4effcdc3bd1c8bfc5a751.ctex"
|
path="res://.godot/imported/glass_tileset.png-63b944a9d1f55b883f6e1f1194caed12.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://entity/glass_tileset.png"
|
source_file="res://bottle/glass_tileset.png"
|
||||||
dest_files=["res://.godot/imported/glass_tileset.png-57c4af482ec4effcdc3bd1c8bfc5a751.ctex"]
|
dest_files=["res://.godot/imported/glass_tileset.png-63b944a9d1f55b883f6e1f1194caed12.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://c3kitncwpi42j"]
|
[gd_scene load_steps=6 format=3 uid="uid://c3kitncwpi42j"]
|
||||||
|
|
||||||
[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_8k46m"]
|
[ext_resource type="PhysicsMaterial" uid="uid://c6kn1an85lccr" path="res://entity/coin_physics_material.tres" id="1_8k46m"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dbdkb4vt7dh85" path="res://entity/coin_copper_4.png" id="1_wedw1"]
|
[ext_resource type="Texture2D" uid="uid://dbdkb4vt7dh85" path="res://entity/coin_copper_4.png" id="1_wedw1"]
|
||||||
[ext_resource type="Texture2D" uid="uid://2vtvoj6ua3cb" path="res://entity/coin_copper_outline_2.png" id="2_2ifq3"]
|
[ext_resource type="Texture2D" uid="uid://2vtvoj6ua3cb" path="res://entity/coin_copper_outline_2.png" id="2_2ifq3"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_yefrx"]
|
[ext_resource type="PackedScene" uid="uid://bk1vvq5rug01m" path="res://collector/collectible.tscn" id="4_yefrx"]
|
||||||
[ext_resource type="PackedScene" uid="uid://ujpra0s1kpqi" path="res://value/valuable.tscn" id="5_jdvvd"]
|
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6byl"]
|
||||||
size = Vector2(16.5, 5.08333)
|
size = Vector2(14, 3)
|
||||||
|
|
||||||
[node name="CoinCopper" type="RigidBody2D"]
|
[node name="CoinCopper" type="RigidBody2D"]
|
||||||
collision_layer = 5
|
collision_layer = 5
|
||||||
collision_mask = 7
|
collision_mask = 7
|
||||||
inertia = 20000.0
|
inertia = 1000.0
|
||||||
physics_material_override = ExtResource("1_8k46m")
|
physics_material_override = ExtResource("1_8k46m")
|
||||||
continuous_cd = 1
|
continuous_cd = 1
|
||||||
linear_damp = 0.1
|
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"]
|
||||||
|
@ -32,6 +32,3 @@ texture = ExtResource("2_2ifq3")
|
||||||
|
|
||||||
[node name="Collectible" parent="." instance=ExtResource("4_yefrx")]
|
[node name="Collectible" parent="." instance=ExtResource("4_yefrx")]
|
||||||
type = &"Copper"
|
type = &"Copper"
|
||||||
|
|
||||||
[node name="Valuable" parent="." instance=ExtResource("5_jdvvd")]
|
|
||||||
value = 1
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://c3rxmcwa5nqng"]
|
[gd_scene load_steps=7 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"]
|
||||||
|
@ -6,6 +6,9 @@
|
||||||
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="3_qwsty"]
|
[ext_resource type="PackedScene" uid="uid://c67lfbk4gf1ga" path="res://spawner/spawner.tscn" id="3_qwsty"]
|
||||||
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper.tscn" id="4_e5nwi"]
|
[ext_resource type="PackedScene" uid="uid://c3kitncwpi42j" path="res://entity/coin_copper.tscn" id="4_e5nwi"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4uksi"]
|
||||||
|
size = Vector2(80, 80)
|
||||||
|
|
||||||
[node name="Game" type="Node2D"]
|
[node name="Game" type="Node2D"]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
script = ExtResource("1_i3ly0")
|
script = ExtResource("1_i3ly0")
|
||||||
|
@ -14,32 +17,31 @@ script = ExtResource("1_i3ly0")
|
||||||
|
|
||||||
[node name="GravityFromGyro" parent="Bottle" instance=ExtResource("2_h2pfr")]
|
[node name="GravityFromGyro" parent="Bottle" instance=ExtResource("2_h2pfr")]
|
||||||
|
|
||||||
[node name="CopperToSilver" parent="." instance=ExtResource("6_tf2pv")]
|
[node name="TimeSpawner" parent="." node_paths=PackedStringArray("target") instance=ExtResource("3_qwsty")]
|
||||||
z_index = 10
|
position = Vector2(136, 40)
|
||||||
position = Vector2(3, -298)
|
|
||||||
|
|
||||||
[node name="TimeSpawner" parent="." instance=ExtResource("3_qwsty")]
|
|
||||||
position = Vector2(0, -144)
|
|
||||||
scene = ExtResource("4_e5nwi")
|
scene = ExtResource("4_e5nwi")
|
||||||
target = NodePath("..")
|
target = NodePath("..")
|
||||||
buffer_cap = 1
|
buffer_cap = 1
|
||||||
spawn_position_range_x = 32.0
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
spawn_rotation_range = 15.0
|
|
||||||
overlapping_bodies_collision_mask = 4
|
|
||||||
overlapping_body_count_limit = 4
|
overlapping_body_count_limit = 4
|
||||||
|
|
||||||
|
[node name="NeckShape" type="CollisionShape2D" parent="TimeSpawner"]
|
||||||
|
shape = SubResource("RectangleShape2D_4uksi")
|
||||||
|
|
||||||
[node name="Timer" type="Timer" parent="TimeSpawner"]
|
[node name="Timer" type="Timer" parent="TimeSpawner"]
|
||||||
wait_time = 0.017
|
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")]
|
||||||
position = Vector2(0, -144)
|
position = Vector2(136, 0)
|
||||||
scene = ExtResource("4_e5nwi")
|
scene = ExtResource("4_e5nwi")
|
||||||
target = NodePath("..")
|
target = NodePath("..")
|
||||||
buffer_cap = 50
|
buffer_cap = 10
|
||||||
spawn_position_range_x = 32.0
|
spawn_rect = Rect2(-20, 0, 40, 0)
|
||||||
spawn_rotation_range = 15.0
|
|
||||||
overlapping_bodies_collision_mask = 4
|
|
||||||
overlapping_body_count_limit = 4
|
overlapping_body_count_limit = 4
|
||||||
|
|
||||||
|
[node name="NeckShape" type="CollisionShape2D" parent="ButtonSpawner"]
|
||||||
|
position = Vector2(0, 40)
|
||||||
|
shape = SubResource("RectangleShape2D_4uksi")
|
||||||
|
|
||||||
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
|
[connection signal="timeout" from="TimeSpawner/Timer" to="TimeSpawner" method="spawn"]
|
||||||
|
|
|
@ -34,6 +34,8 @@ window/handheld/orientation=1
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
2d/run_on_separate_thread=true
|
2d/run_on_separate_thread=true
|
||||||
|
common/physics_ticks_per_second=240
|
||||||
|
common/max_physics_steps_per_frame=30
|
||||||
2d/solver/solver_iterations=4
|
2d/solver/solver_iterations=4
|
||||||
2d/solver/contact_max_separation=1.0
|
2d/solver/contact_max_separation=1.0
|
||||||
2d/solver/contact_max_allowed_penetration=0.02
|
2d/solver/contact_max_allowed_penetration=0.02
|
||||||
|
|
4
root.gd
4
root.gd
|
@ -3,8 +3,8 @@ class_name Root
|
||||||
|
|
||||||
|
|
||||||
@onready var tree: SceneTree = get_tree()
|
@onready var tree: SceneTree = get_tree()
|
||||||
@onready var game_ui: GameUI = $UI/GameUI
|
@export var game_ui: GameUI
|
||||||
@onready var shop_ui: ShopUI = $UI/ShopUI
|
@export var shop_ui: ShopUI
|
||||||
|
|
||||||
|
|
||||||
enum UIState {
|
enum UIState {
|
||||||
|
|
37
root.tscn
37
root.tscn
|
@ -6,8 +6,10 @@
|
||||||
[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="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" node_paths=PackedStringArray("game_ui", "shop_ui")]
|
||||||
script = ExtResource("1_8jrhk")
|
script = ExtResource("1_8jrhk")
|
||||||
|
game_ui = NodePath("View/SafeUI/GameUI")
|
||||||
|
shop_ui = NodePath("View/SafeUI/ShopUI")
|
||||||
|
|
||||||
[node name="UI" type="Control" parent="."]
|
[node name="UI" type="Control" parent="."]
|
||||||
texture_filter = 1
|
texture_filter = 1
|
||||||
|
@ -20,8 +22,7 @@ grow_vertical = 2
|
||||||
size_flags_vertical = 8
|
size_flags_vertical = 8
|
||||||
theme = ExtResource("1_h26ax")
|
theme = ExtResource("1_h26ax")
|
||||||
|
|
||||||
[node name="GameContainer" type="Control" parent="UI"]
|
[node name="CenterUI" type="CenterContainer" parent="View"]
|
||||||
process_mode = 1
|
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
anchors_preset = 7
|
anchors_preset = 7
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
@ -29,11 +30,33 @@ anchor_top = 1.0
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 0
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="Game" parent="UI/GameContainer" instance=ExtResource("3_hrdyr")]
|
[node name="ViewportContainer" type="SubViewportContainer" parent="View/CenterUI"]
|
||||||
|
custom_minimum_size = Vector2(270, 480)
|
||||||
|
layout_mode = 2
|
||||||
|
stretch = true
|
||||||
|
|
||||||
[node name="GameUI" parent="UI" instance=ExtResource("5_2cc15")]
|
[node name="Viewport" type="SubViewport" parent="View/CenterUI/ViewportContainer"]
|
||||||
|
handle_input_locally = false
|
||||||
|
size = Vector2i(270, 480)
|
||||||
|
render_target_update_mode = 4
|
||||||
|
|
||||||
|
[node name="Game" parent="View/CenterUI/ViewportContainer/Viewport" instance=ExtResource("3_8gkpc")]
|
||||||
|
|
||||||
|
[node name="Camera2D" type="Camera2D" parent="View/CenterUI/ViewportContainer/Viewport"]
|
||||||
|
anchor_mode = 0
|
||||||
|
|
||||||
|
[node name="SafeUI" type="MarginContainer" parent="View"]
|
||||||
|
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="GameUI" parent="View/SafeUI" instance=ExtResource("5_2cc15")]
|
||||||
process_mode = 3
|
process_mode = 3
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
|
||||||
|
@ -44,7 +67,7 @@ layout_mode = 1
|
||||||
|
|
||||||
[connection signal="score_button_pressed" from="View/SafeUI/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="View/SafeUI/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="View/SafeUI/GameUI" to="View/GameWI/GameWorld/Game" method="trigger_spawn"]
|
[connection signal="spawn_button_pressed" from="View/SafeUI/GameUI" to="View/CenterUI/ViewportContainer/Viewport/Game" method="trigger_spawn"]
|
||||||
[connection signal="back_button_pressed" from="View/SafeUI/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="View/SafeUI/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="View/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"]
|
[connection signal="purchase_begin" from="View/SafeUI/ShopUI" to="." method="_on_shop_ui_purchase_begin"]
|
||||||
|
|
|
@ -1,21 +1,32 @@
|
||||||
extends Node2D
|
extends Area2D
|
||||||
class_name Spawner
|
class_name Spawner
|
||||||
|
|
||||||
|
## A node which spawns things!
|
||||||
|
|
||||||
|
## The scene to spawn.
|
||||||
@export var scene: PackedScene
|
@export var scene: PackedScene
|
||||||
|
|
||||||
|
## The node to add new scenes to.
|
||||||
@export var target: Node
|
@export var target: Node
|
||||||
|
|
||||||
|
## Count of how many items should be spawned when possible.
|
||||||
var buffer: int = 0
|
var buffer: int = 0
|
||||||
|
|
||||||
|
## Maximum amount of items whose spawn can be buffered.
|
||||||
@export var buffer_cap: int
|
@export var buffer_cap: int
|
||||||
|
|
||||||
@onready var area: Area2D = $Area
|
## Rect in which scenes can be spawned randomly in.
|
||||||
|
@export var spawn_rect: Rect2
|
||||||
|
|
||||||
@export var spawn_position_range_x: float
|
## Minimum rotation degrees that an object can spawn with.
|
||||||
@export_range(0, 90) var spawn_rotation_range: float
|
@export_range(0, 360) var spawn_rotation_degrees_min: float
|
||||||
@onready var rng: RandomNumberGenerator = RandomNumberGenerator.new()
|
|
||||||
|
## Maximum rotation degrees that an object can spawn with.
|
||||||
|
@export_range(0, 360) var spawn_rotation_degrees_max: float
|
||||||
|
|
||||||
|
## Maximum amount of bodies overlapping the spawner's area before the spawner stops spawning.
|
||||||
|
@export_range(0, 16, 1, "or_greater") var overlapping_body_count_limit: int
|
||||||
|
|
||||||
@export_flags_2d_physics var overlapping_bodies_collision_mask: int
|
|
||||||
@export_range(0, 16) var overlapping_body_count_limit: int
|
|
||||||
|
|
||||||
signal spawned(what: Node2D)
|
signal spawned(what: Node2D)
|
||||||
|
|
||||||
|
@ -25,34 +36,28 @@ func spawn():
|
||||||
if buffer > buffer_cap:
|
if buffer > buffer_cap:
|
||||||
buffer = buffer_cap
|
buffer = buffer_cap
|
||||||
|
|
||||||
func _count_overlapping_bodies() -> int:
|
|
||||||
var overlapping_bodies = area.get_overlapping_bodies()
|
|
||||||
var overlapping_body_count = 0
|
|
||||||
for overlapping_body in overlapping_bodies:
|
|
||||||
if overlapping_body.collision_layer & overlapping_bodies_collision_mask:
|
|
||||||
overlapping_body_count += 1
|
|
||||||
return overlapping_body_count
|
|
||||||
|
|
||||||
|
|
||||||
func _select_spawn_position() -> Vector2:
|
func _select_spawn_position() -> Vector2:
|
||||||
return Vector2(rng.randf_range(-spawn_position_range_x, +spawn_position_range_x), 0)
|
return Vector2(
|
||||||
|
Randomizer.rng.randf_range(spawn_rect.position.x, spawn_rect.end.x),
|
||||||
|
Randomizer.rng.randf_range(spawn_rect.position.y, spawn_rect.end.y),
|
||||||
|
)
|
||||||
|
|
||||||
func _select_spawn_rotation() -> float:
|
func _select_spawn_rotation() -> float:
|
||||||
return rng.randf_range(-spawn_rotation_range, spawn_rotation_range)
|
return Randomizer.rng.randf_range(
|
||||||
|
spawn_rotation_degrees_min,
|
||||||
|
spawn_rotation_degrees_max
|
||||||
|
)
|
||||||
|
|
||||||
func _do_spawn():
|
func _do_spawn():
|
||||||
if _count_overlapping_bodies() > overlapping_body_count_limit:
|
if len(get_overlapping_bodies()) > overlapping_body_count_limit:
|
||||||
return
|
return
|
||||||
var scene_instant = scene.instantiate()
|
var instantiated = scene.instantiate()
|
||||||
scene_instant.global_position = global_position + _select_spawn_position()
|
instantiated.position = position - target.position + _select_spawn_position()
|
||||||
scene_instant.rotation_degrees = _select_spawn_rotation()
|
instantiated.rotation_degrees = _select_spawn_rotation()
|
||||||
target.add_child(scene_instant)
|
target.add_child(instantiated)
|
||||||
emit_signal("spawned", scene_instant)
|
emit_signal("spawned", instantiated)
|
||||||
buffer -= 1
|
buffer -= 1
|
||||||
|
|
||||||
|
|
||||||
func _physics_process(_delta):
|
func _physics_process(_delta):
|
||||||
if buffer > 0:
|
if buffer > 0:
|
||||||
_do_spawn()
|
_do_spawn()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
[gd_scene load_steps=3 format=3 uid="uid://c67lfbk4gf1ga"]
|
[gd_scene load_steps=2 format=3 uid="uid://c67lfbk4gf1ga"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://spawner/spawner.gd" id="1_xqfmg"]
|
[ext_resource type="Script" path="res://spawner/spawner.gd" id="1_xqfmg"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_p13i4"]
|
[node name="Spawner" type="Area2D"]
|
||||||
size = Vector2(96, 96)
|
|
||||||
|
|
||||||
[node name="Spawner" type="Node2D"]
|
|
||||||
script = ExtResource("1_xqfmg")
|
script = ExtResource("1_xqfmg")
|
||||||
|
|
||||||
[node name="Area" type="Area2D" parent="."]
|
|
||||||
collision_mask = 4
|
|
||||||
|
|
||||||
[node name="Shape" type="CollisionShape2D" parent="Area"]
|
|
||||||
shape = SubResource("RectangleShape2D_p13i4")
|
|
||||||
|
|
Loading…
Reference in a new issue