add endscreen with animation
This commit is contained in:
parent
768dbaf21c
commit
7889e71581
6 changed files with 450 additions and 55 deletions
146
scenes/game.tscn
146
scenes/game.tscn
|
@ -1,6 +1,116 @@
|
||||||
[gd_scene load_steps=2 format=3 uid="uid://cotth8e5rtioe"]
|
[gd_scene load_steps=6 format=3 uid="uid://cotth8e5rtioe"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/game.gd" id="1_7syh4"]
|
[ext_resource type="Script" path="res://scripts/game.gd" id="1_7syh4"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/times.gd" id="2_80mhm"]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_gjxtp"]
|
||||||
|
resource_name = "game_end"
|
||||||
|
length = 2.0
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("times_container:position")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.7, 2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(92.1386, 36.868), Vector2(92.1386, 36.868), Vector2(410, 72)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("overlaycolor:self_modulate")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0, 0.966667),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 0.568627)]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("timer:self_modulate")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0.0333333, 2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/path = NodePath("times_container:scale")
|
||||||
|
tracks/3/interp = 2
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PackedFloat32Array(0.7, 2),
|
||||||
|
"transitions": PackedFloat32Array(1, 1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1), Vector2(1.5, 1.5)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id="Animation_ph30r"]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/path = NodePath("times_container:position")
|
||||||
|
tracks/0/interp = 2
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(92.1386, 36.868)]
|
||||||
|
}
|
||||||
|
tracks/1/type = "value"
|
||||||
|
tracks/1/imported = false
|
||||||
|
tracks/1/enabled = true
|
||||||
|
tracks/1/path = NodePath("overlaycolor:self_modulate")
|
||||||
|
tracks/1/interp = 1
|
||||||
|
tracks/1/loop_wrap = true
|
||||||
|
tracks/1/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 0)]
|
||||||
|
}
|
||||||
|
tracks/2/type = "value"
|
||||||
|
tracks/2/imported = false
|
||||||
|
tracks/2/enabled = true
|
||||||
|
tracks/2/path = NodePath("timer:self_modulate")
|
||||||
|
tracks/2/interp = 1
|
||||||
|
tracks/2/loop_wrap = true
|
||||||
|
tracks/2/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Color(1, 1, 1, 1)]
|
||||||
|
}
|
||||||
|
tracks/3/type = "value"
|
||||||
|
tracks/3/imported = false
|
||||||
|
tracks/3/enabled = true
|
||||||
|
tracks/3/path = NodePath("times_container:scale")
|
||||||
|
tracks/3/interp = 1
|
||||||
|
tracks/3/loop_wrap = true
|
||||||
|
tracks/3/keys = {
|
||||||
|
"times": PackedFloat32Array(0),
|
||||||
|
"transitions": PackedFloat32Array(1),
|
||||||
|
"update": 0,
|
||||||
|
"values": [Vector2(1, 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="AnimationLibrary" id="AnimationLibrary_wuihg"]
|
||||||
|
_data = {
|
||||||
|
"RESET": SubResource("Animation_ph30r"),
|
||||||
|
"game_end": SubResource("Animation_gjxtp")
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Game" type="Node2D"]
|
[node name="Game" type="Node2D"]
|
||||||
script = ExtResource("1_7syh4")
|
script = ExtResource("1_7syh4")
|
||||||
|
@ -38,27 +148,32 @@ text = "3"
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[node name="overlaycolor" type="ColorRect" parent="hud"]
|
||||||
|
self_modulate = Color(1, 1, 1, 0)
|
||||||
|
offset_left = -25.0
|
||||||
|
offset_top = -20.0
|
||||||
|
offset_right = 1190.0
|
||||||
|
offset_bottom = 682.0
|
||||||
|
color = Color(0.482353, 0.482353, 0.482353, 0.52549)
|
||||||
|
|
||||||
[node name="times_container" type="HFlowContainer" parent="hud"]
|
[node name="times_container" type="HFlowContainer" parent="hud"]
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
offset_left = -546.0
|
offset_left = -483.861
|
||||||
offset_top = -294.0
|
offset_top = -287.132
|
||||||
offset_right = -506.0
|
offset_right = -425.861
|
||||||
offset_bottom = -254.0
|
offset_bottom = -210.132
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
script = ExtResource("2_80mhm")
|
||||||
|
|
||||||
[node name="overlaycolor" type="ColorRect" parent="hud"]
|
[node name="game_hud_animations" type="AnimationPlayer" parent="hud"]
|
||||||
visible = false
|
libraries = {
|
||||||
modulate = Color(1, 1, 1, 0)
|
"": SubResource("AnimationLibrary_wuihg")
|
||||||
offset_left = -25.0
|
}
|
||||||
offset_top = -20.0
|
|
||||||
offset_right = 1190.0
|
|
||||||
offset_bottom = 682.0
|
|
||||||
color = Color(0.482353, 0.482353, 0.482353, 0.52549)
|
|
||||||
|
|
||||||
[node name="Camera2D" type="Camera2D" parent="."]
|
[node name="Camera2D" type="Camera2D" parent="."]
|
||||||
|
|
||||||
|
@ -68,4 +183,9 @@ color = Color(0.482353, 0.482353, 0.482353, 0.52549)
|
||||||
wait_time = 3.0
|
wait_time = 3.0
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="timer_close" type="Timer" parent="."]
|
||||||
|
wait_time = 5.0
|
||||||
|
one_shot = true
|
||||||
|
|
||||||
[connection signal="timeout" from="countdown" to="." method="_on_countdown_timeout"]
|
[connection signal="timeout" from="countdown" to="." method="_on_countdown_timeout"]
|
||||||
|
[connection signal="timeout" from="timer_close" to="." method="_on_timer_close_timeout"]
|
||||||
|
|
|
@ -202,7 +202,7 @@ tile_map_data = PackedByteArray("AAD/////AgAAAAAAAGD//wAAAgAAAAAAAFAAAP//AgAAAAA
|
||||||
tile_set = ExtResource("2_aegf7")
|
tile_set = ExtResource("2_aegf7")
|
||||||
|
|
||||||
[node name="road_bg2" type="TileMapLayer" parent="."]
|
[node name="road_bg2" type="TileMapLayer" parent="."]
|
||||||
tile_map_data = PackedByteArray("AAAKAAMAAgABAAIAAAALAAIAAgACAAIAADALAAMAAgAHAAEAAAAEAAEAAgAHAAIAAGAFAAEAAAAFAAIAAAAFAAIAAAAFAAMAAAAFAAMAAAAAAAIAAFAFAAQAAAABAAIAAFAEAAMAAAAAAAMAAFAEAAQAAAABAAMAAFD7/wEAAgABAAEAAAD7/wIAAgABAAEAAAD6/wEAAAABAAEAADD6/wIAAAABAAAAADD7/wAAAgAEAAAAAGAAAAEAAgABAAEAAGACAAEAAgABAAEAAFD7////AAAFAAMAAGD6////AAAFAAIAAGD6/wAAAAAEAAIAAGAGAAcAAAAEAAIAAFAGAAgAAAAFAAIAAFAFAAgAAAAFAAMAAFAJAAEAAAAFAAIAAAAJAAIAAAAFAAMAAAAIAAEAAAAEAAIAAAAHAAEAAAAFAAMAAGAGAAEAAAAFAAIAAGAGAAIAAAAEAAIAAGALAP7/AAAFAAIAAAALAP//AAAFAAMAAAAKAP7/AAAEAAIAAAAIAP7/AgAHAAIAAGAKAP//AgAEAAAAAAAJAAUAAgABAAEAAFAGAAUAAAACAAIAAFAGAAYAAAADAAIAAFAFAAUAAAACAAMAAFAFAAYAAAADAAMAAFAAAAYAAAACAAMAADAAAAcAAAACAAIAADD//wYAAAADAAMAADD//wcAAAADAAIAADAAAAMAAAADAAMAAGAAAAQAAAACAAMAAGD//wMAAAADAAIAAGD//wQAAAACAAIAAGD//wIAAgACAAIAAED//wgAAgAHAAEAAFD+/wcAAgAHAAEAAFD9/wYAAgAHAAEAAFD9/wMAAgAHAAEAADD+/wIAAgAHAAEAADABAAYAAgAHAAEAADACAAYAAgACAAIAAEAAAAgAAgACAAIAAGD9/wQAAgACAAIAAAD9/wUAAgACAAIAACABAAcAAgABAAIAAHADAAMAAAAAAAAAAHAIAAIAAgAEAAAAAAAHAAIAAgAEAAAAABA=")
|
tile_map_data = PackedByteArray("AAAKAAMAAgABAAIAAAALAAIAAgACAAIAADALAAMAAgAHAAEAAAAEAAEAAgAHAAIAAGAFAAEAAAAFAAIAAAAFAAIAAAAFAAMAAAAFAAMAAAAAAAIAAFAFAAQAAAABAAIAAFAEAAMAAAAAAAMAAFAEAAQAAAABAAMAAFD7/wEAAgABAAEAAAD7/wIAAgABAAEAAAD6/wEAAAABAAEAADD6/wIAAAABAAAAADD7/wAAAgAEAAAAAGAAAAEAAgABAAEAAGACAAEAAgABAAEAAFD7////AAAFAAMAAGD6////AAAFAAIAAGD6/wAAAAAEAAIAAGAGAAcAAAAEAAIAAFAGAAgAAAAFAAIAAFAFAAgAAAAFAAMAAFAJAAEAAAAFAAIAAAAJAAIAAAAFAAMAAAAIAAEAAAAEAAIAAAAHAAEAAAAFAAMAAGAGAAEAAAAFAAIAAGAGAAIAAAAEAAIAAGALAP7/AAAFAAIAAAALAP//AAAFAAMAAAAKAP7/AAAEAAIAAAAIAP7/AgAHAAIAAGAKAP//AgAEAAAAAAAJAAUAAgABAAEAAFAGAAUAAAACAAIAAFAGAAYAAgAHAAIAAAAFAAUAAAACAAMAAFAFAAYAAAADAAMAAFAAAAYAAAACAAMAADAAAAcAAAACAAIAADD//wYAAAADAAMAADD//wcAAAADAAIAADAAAAMAAAADAAMAAGAAAAQAAAACAAMAAGD//wMAAAADAAIAAGD//wQAAAACAAIAAGD//wIAAgACAAIAAED//wgAAgAHAAEAAFD+/wcAAgAHAAEAAFD9/wYAAgAHAAEAAFD9/wMAAgAHAAEAADD+/wIAAgAHAAEAADABAAYAAgAHAAEAADACAAYAAgACAAIAAEAAAAgAAgACAAIAAGD9/wQAAgACAAIAAAD9/wUAAgACAAIAACABAAcAAgABAAIAAHADAAMAAAAAAAAAAHAIAAIAAgAEAAAAAAAHAAIAAgAEAAAAABACAAMAAgAHAAIAAFAFAP//AgAHAAIAAGAGAP//AgAHAAIAAGAHAP//AgAHAAIAAFA=")
|
||||||
tile_set = ExtResource("2_aegf7")
|
tile_set = ExtResource("2_aegf7")
|
||||||
|
|
||||||
[node name="road_bg_fixes" type="TileMapLayer" parent="."]
|
[node name="road_bg_fixes" type="TileMapLayer" parent="."]
|
||||||
|
|
256
scenes/map_goaltest.tscn
Normal file
256
scenes/map_goaltest.tscn
Normal file
|
@ -0,0 +1,256 @@
|
||||||
|
[gd_scene load_steps=14 format=4 uid="uid://cmp1wkkkeu1ea"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bu05e161cb61k" path="res://sprites/background/spritesheet_bg.png" id="1_d4btd"]
|
||||||
|
[ext_resource type="TileSet" uid="uid://beswbm12qkkxk" path="res://sprites/spritesheet_road/bg_road.tres" id="2_a3tr3"]
|
||||||
|
[ext_resource type="TileSet" uid="uid://buu8w8n61kbxf" path="res://sprites/spritesheet_road/markings.tres" id="3_lymgv"]
|
||||||
|
[ext_resource type="TileSet" uid="uid://b15864hbqomim" path="res://sprites/spritesheet_road/road.tres" id="4_asfaj"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dpuhee0x5ekud" path="res://sprites/background/spritesheet_scenery.png" id="5_clogf"]
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_qbu02"]
|
||||||
|
texture = ExtResource("1_d4btd")
|
||||||
|
texture_region_size = Vector2i(256, 256)
|
||||||
|
0:0/0 = 0
|
||||||
|
1:0/0 = 0
|
||||||
|
2:0/0 = 0
|
||||||
|
3:0/0 = 0
|
||||||
|
4:0/0 = 0
|
||||||
|
5:0/0 = 0
|
||||||
|
6:0/0 = 0
|
||||||
|
7:0/0 = 0
|
||||||
|
0:1/0 = 0
|
||||||
|
1:1/0 = 0
|
||||||
|
2:1/0 = 0
|
||||||
|
3:1/0 = 0
|
||||||
|
4:1/0 = 0
|
||||||
|
5:1/0 = 0
|
||||||
|
6:1/0 = 0
|
||||||
|
7:1/0 = 0
|
||||||
|
0:2/0 = 0
|
||||||
|
1:2/0 = 0
|
||||||
|
2:2/0 = 0
|
||||||
|
3:2/0 = 0
|
||||||
|
4:2/0 = 0
|
||||||
|
5:2/0 = 0
|
||||||
|
6:2/0 = 0
|
||||||
|
7:2/0 = 0
|
||||||
|
0:3/0 = 0
|
||||||
|
1:3/0 = 0
|
||||||
|
2:3/0 = 0
|
||||||
|
3:3/0 = 0
|
||||||
|
4:3/0 = 0
|
||||||
|
5:3/0 = 0
|
||||||
|
6:3/0 = 0
|
||||||
|
7:3/0 = 0
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_5knbn"]
|
||||||
|
tile_size = Vector2i(256, 256)
|
||||||
|
sources/1 = SubResource("TileSetAtlasSource_qbu02")
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_daqun"]
|
||||||
|
size = Vector2(23, 222)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_dltky"]
|
||||||
|
size = Vector2(19, 108)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_uys5r"]
|
||||||
|
size = Vector2(20, 126)
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_82iti"]
|
||||||
|
size = Vector2(20, 231)
|
||||||
|
|
||||||
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_hclam"]
|
||||||
|
texture = ExtResource("5_clogf")
|
||||||
|
texture_region_size = Vector2i(128, 128)
|
||||||
|
2:0/0 = 0
|
||||||
|
3:0/0 = 0
|
||||||
|
6:0/0 = 0
|
||||||
|
7:0/0 = 0
|
||||||
|
8:0/0 = 0
|
||||||
|
9:0/0 = 0
|
||||||
|
10:0/0 = 0
|
||||||
|
11:0/0 = 0
|
||||||
|
12:0/0 = 0
|
||||||
|
13:0/0 = 0
|
||||||
|
14:0/0 = 0
|
||||||
|
15:0/0 = 0
|
||||||
|
2:1/0 = 0
|
||||||
|
3:1/0 = 0
|
||||||
|
6:1/0 = 0
|
||||||
|
7:1/0 = 0
|
||||||
|
8:1/0 = 0
|
||||||
|
9:1/0 = 0
|
||||||
|
10:1/0 = 0
|
||||||
|
11:1/0 = 0
|
||||||
|
12:1/0 = 0
|
||||||
|
13:1/0 = 0
|
||||||
|
14:1/0 = 0
|
||||||
|
15:1/0 = 0
|
||||||
|
0:2/0 = 0
|
||||||
|
1:2/0 = 0
|
||||||
|
2:2/0 = 0
|
||||||
|
3:2/0 = 0
|
||||||
|
4:2/0 = 0
|
||||||
|
5:2/0 = 0
|
||||||
|
6:2/0 = 0
|
||||||
|
7:2/0 = 0
|
||||||
|
8:2/0 = 0
|
||||||
|
9:2/0 = 0
|
||||||
|
10:2/0 = 0
|
||||||
|
11:2/0 = 0
|
||||||
|
12:2/0 = 0
|
||||||
|
13:2/0 = 0
|
||||||
|
14:2/0 = 0
|
||||||
|
15:2/0 = 0
|
||||||
|
0:3/0 = 0
|
||||||
|
1:3/0 = 0
|
||||||
|
2:3/0 = 0
|
||||||
|
3:3/0 = 0
|
||||||
|
4:3/0 = 0
|
||||||
|
5:3/0 = 0
|
||||||
|
6:3/0 = 0
|
||||||
|
7:3/0 = 0
|
||||||
|
8:3/0 = 0
|
||||||
|
9:3/0 = 0
|
||||||
|
10:3/0 = 0
|
||||||
|
11:3/0 = 0
|
||||||
|
12:3/0 = 0
|
||||||
|
13:3/0 = 0
|
||||||
|
14:3/0 = 0
|
||||||
|
15:3/0 = 0
|
||||||
|
0:4/0 = 0
|
||||||
|
1:4/0 = 0
|
||||||
|
2:4/0 = 0
|
||||||
|
3:4/0 = 0
|
||||||
|
4:4/0 = 0
|
||||||
|
5:4/0 = 0
|
||||||
|
6:4/0 = 0
|
||||||
|
7:4/0 = 0
|
||||||
|
8:4/0 = 0
|
||||||
|
9:4/0 = 0
|
||||||
|
10:4/0 = 0
|
||||||
|
11:4/0 = 0
|
||||||
|
12:4/0 = 0
|
||||||
|
13:4/0 = 0
|
||||||
|
14:4/0 = 0
|
||||||
|
15:4/0 = 0
|
||||||
|
0:5/0 = 0
|
||||||
|
1:5/0 = 0
|
||||||
|
2:5/0 = 0
|
||||||
|
3:5/0 = 0
|
||||||
|
4:5/0 = 0
|
||||||
|
5:5/0 = 0
|
||||||
|
6:5/0 = 0
|
||||||
|
7:5/0 = 0
|
||||||
|
8:5/0 = 0
|
||||||
|
9:5/0 = 0
|
||||||
|
10:5/0 = 0
|
||||||
|
11:5/0 = 0
|
||||||
|
12:5/0 = 0
|
||||||
|
13:5/0 = 0
|
||||||
|
14:5/0 = 0
|
||||||
|
15:5/0 = 0
|
||||||
|
0:6/0 = 0
|
||||||
|
1:6/0 = 0
|
||||||
|
2:6/0 = 0
|
||||||
|
3:6/0 = 0
|
||||||
|
4:6/0 = 0
|
||||||
|
5:6/0 = 0
|
||||||
|
6:6/0 = 0
|
||||||
|
7:6/0 = 0
|
||||||
|
8:6/0 = 0
|
||||||
|
9:6/0 = 0
|
||||||
|
10:6/0 = 0
|
||||||
|
11:6/0 = 0
|
||||||
|
12:6/0 = 0
|
||||||
|
13:6/0 = 0
|
||||||
|
14:6/0 = 0
|
||||||
|
15:6/0 = 0
|
||||||
|
0:7/0 = 0
|
||||||
|
1:7/0 = 0
|
||||||
|
2:7/0 = 0
|
||||||
|
3:7/0 = 0
|
||||||
|
4:7/0 = 0
|
||||||
|
5:7/0 = 0
|
||||||
|
6:7/0 = 0
|
||||||
|
7:7/0 = 0
|
||||||
|
8:7/0 = 0
|
||||||
|
9:7/0 = 0
|
||||||
|
10:7/0 = 0
|
||||||
|
11:7/0 = 0
|
||||||
|
12:7/0 = 0
|
||||||
|
13:7/0 = 0
|
||||||
|
14:7/0 = 0
|
||||||
|
15:7/0 = 0
|
||||||
|
0:0/size_in_atlas = Vector2i(2, 2)
|
||||||
|
0:0/0 = 0
|
||||||
|
4:0/size_in_atlas = Vector2i(2, 2)
|
||||||
|
4:0/0 = 0
|
||||||
|
|
||||||
|
[sub_resource type="TileSet" id="TileSet_s6rw7"]
|
||||||
|
tile_size = Vector2i(128, 128)
|
||||||
|
sources/0 = SubResource("TileSetAtlasSource_hclam")
|
||||||
|
|
||||||
|
[node name="Map" type="Node"]
|
||||||
|
|
||||||
|
[node name="Background" type="TileMapLayer" parent="."]
|
||||||
|
tile_set = SubResource("TileSet_5knbn")
|
||||||
|
collision_enabled = false
|
||||||
|
|
||||||
|
[node name="road_bg" type="TileMapLayer" parent="."]
|
||||||
|
tile_map_data = PackedByteArray("AAD/////AgAAAAAAAGD//wAAAgAAAAAAAFAAAP//AgAAAAAAAGAAAAAAAgAAAAAAAFABAP//AgAAAAAAAGABAAAAAgAAAAAAAFA=")
|
||||||
|
tile_set = ExtResource("2_a3tr3")
|
||||||
|
|
||||||
|
[node name="road_bg2" type="TileMapLayer" parent="."]
|
||||||
|
tile_set = ExtResource("2_a3tr3")
|
||||||
|
|
||||||
|
[node name="road_bg_fixes" type="TileMapLayer" parent="."]
|
||||||
|
tile_set = ExtResource("2_a3tr3")
|
||||||
|
|
||||||
|
[node name="markings" type="TileMapLayer" parent="."]
|
||||||
|
z_index = 1
|
||||||
|
tile_map_data = PackedByteArray("AAAAAAAAAQAAAAAAAFAAAP//AQAAAAAAAHA=")
|
||||||
|
tile_set = ExtResource("3_lymgv")
|
||||||
|
|
||||||
|
[node name="road_r" type="TileMapLayer" parent="."]
|
||||||
|
tile_map_data = PackedByteArray("AAD//wAAAgABAAAAAFAAAAAAAgABAAAAAFABAAAAAgABAAAAAFACAAAAAgABAAAAAFADAAAAAgABAAAAAFAEAAAAAgABAAAAAFAFAAAAAgABAAAAAFAGAAAAAgABAAAAAFA=")
|
||||||
|
tile_set = ExtResource("4_asfaj")
|
||||||
|
|
||||||
|
[node name="road_l" type="TileMapLayer" parent="."]
|
||||||
|
tile_map_data = PackedByteArray("AAABAP//AgABAAAAAHAAAP//AgABAAAAAHD/////AgABAAAAAHADAP//AAADAAAAAHADAAAAAAACAAAAAHACAP//AAADAAEAAHAEAAAAAgABAAAAAHAFAAAAAgABAAAAAHAGAAAAAgABAAAAAHA=")
|
||||||
|
tile_set = ExtResource("4_asfaj")
|
||||||
|
|
||||||
|
[node name="area_finish" type="Area2D" parent="."]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D_Fin" type="CollisionShape2D" parent="area_finish"]
|
||||||
|
position = Vector2(668, 10)
|
||||||
|
shape = SubResource("RectangleShape2D_daqun")
|
||||||
|
|
||||||
|
[node name="area_cp0" type="Area2D" parent="."]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp0"]
|
||||||
|
position = Vector2(385, 52)
|
||||||
|
shape = SubResource("RectangleShape2D_dltky")
|
||||||
|
|
||||||
|
[node name="area_cp1" type="Area2D" parent="."]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp1"]
|
||||||
|
position = Vector2(454, 52)
|
||||||
|
shape = SubResource("RectangleShape2D_uys5r")
|
||||||
|
|
||||||
|
[node name="area_cp2" type="Area2D" parent="."]
|
||||||
|
collision_layer = 4
|
||||||
|
collision_mask = 4
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="area_cp2"]
|
||||||
|
position = Vector2(539, 23)
|
||||||
|
shape = SubResource("RectangleShape2D_82iti")
|
||||||
|
|
||||||
|
[node name="scenery" type="TileMapLayer" parent="."]
|
||||||
|
z_index = 20
|
||||||
|
tile_set = SubResource("TileSet_s6rw7")
|
|
@ -5,11 +5,13 @@ extends Node2D
|
||||||
@onready var countdown_label: Label = $hud/countdown_label
|
@onready var countdown_label: Label = $hud/countdown_label
|
||||||
|
|
||||||
@onready var cars: Node = $cars
|
@onready var cars: Node = $cars
|
||||||
|
|
||||||
|
@onready var game_hud_animations: AnimationPlayer = $hud/game_hud_animations
|
||||||
|
|
||||||
@onready var times_container: HFlowContainer = $hud/times_container
|
@onready var times_container: HFlowContainer = $hud/times_container
|
||||||
|
@onready var timer_close: Timer = $timer_close
|
||||||
|
|
||||||
|
|
||||||
@onready var overlaycolor: ColorRect = $hud/overlaycolor
|
|
||||||
|
|
||||||
const caroffset= 32+4 #space cars on start line
|
const caroffset= 32+4 #space cars on start line
|
||||||
|
|
||||||
var viewCarMargin=Vector2(0.7,0.7) #1=zoom out full speed when car is at border. 0.9 zoom out full speed when car is 10% away from border
|
var viewCarMargin=Vector2(0.7,0.7) #1=zoom out full speed when car is at border. 0.9 zoom out full speed when car is 10% away from border
|
||||||
|
@ -18,14 +20,17 @@ var viewCarMargin_zoombackup=viewCarMargin_zoomstart-Vector2(0.1,0.1) #start zoo
|
||||||
var zoomspeed=0.5
|
var zoomspeed=0.5
|
||||||
var zoomspeed_backup=0.1 #relative to screen size
|
var zoomspeed_backup=0.1 #relative to screen size
|
||||||
var zoom_normal=1.5
|
var zoom_normal=1.5
|
||||||
const CAMERA_POSITION_SPEED=0.95 #0.0 - 1.0, higher=faster
|
const CAMERA_POSITION_SPEED=0.05 #0.0 - 1.0, higher=faster
|
||||||
|
|
||||||
var running=false
|
var running=false
|
||||||
|
|
||||||
var rounds=3
|
var rounds=1
|
||||||
|
|
||||||
|
var time_close_keypressed=1#seconds to wait after key pressed at endscreen
|
||||||
|
|
||||||
var game_ended=false
|
var game_ended=false
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
countdown.start()
|
countdown.start()
|
||||||
|
@ -33,7 +38,7 @@ func _ready() -> void:
|
||||||
|
|
||||||
#Load Map
|
#Load Map
|
||||||
var checkpoints :Array[String]=[]
|
var checkpoints :Array[String]=[]
|
||||||
var mapscene=load("res://scenes/map_00.tscn")
|
var mapscene=load("res://scenes/map_goaltest.tscn")
|
||||||
var mapsceneinstance=mapscene.instantiate()
|
var mapsceneinstance=mapscene.instantiate()
|
||||||
add_child(mapsceneinstance)
|
add_child(mapsceneinstance)
|
||||||
for mapc in mapsceneinstance.get_children():
|
for mapc in mapsceneinstance.get_children():
|
||||||
|
@ -97,24 +102,11 @@ func _process(delta: float) -> void:
|
||||||
|
|
||||||
meanCarPosition/=displayedCarCount
|
meanCarPosition/=displayedCarCount
|
||||||
|
|
||||||
#camera.position=meanCarPosition
|
|
||||||
camera.position=lerp(camera.position,meanCarPosition,CAMERA_POSITION_SPEED)
|
camera.position=lerp(camera.position,meanCarPosition,CAMERA_POSITION_SPEED)
|
||||||
#rint("zoom = "+str(camera.zoom))
|
|
||||||
#camera.zoom=Vector2(1.5,1.5)
|
|
||||||
|
|
||||||
'''var allCarsInView=checkPositionInsideView(minPos) and checkPositionInsideView(maxPos)
|
|
||||||
if not allCarsInView:
|
|
||||||
camera.zoom-=Vector2(0.1*delta,0.1*delta)
|
|
||||||
else:
|
|
||||||
if camera.zoom<Vector2(1.0,1.0):
|
|
||||||
camera.zoom+=Vector2(0.1*delta,0.1*delta)
|
|
||||||
'''
|
|
||||||
|
|
||||||
#var viewsize = camera.get_viewport_rect().size/camera.zoom
|
|
||||||
var viewsize = camera.get_viewport_rect().size
|
var viewsize = camera.get_viewport_rect().size
|
||||||
var carSpread=Vector2(maxPos.x-minPos.x,maxPos.y-minPos.y)
|
var carSpread=Vector2(maxPos.x-minPos.x,maxPos.y-minPos.y)
|
||||||
#var calculatedViewCarMargin=Vector2((viewsize.x-carSpread.x)/2,(viewsize.y-carSpread.y)/2)
|
|
||||||
#var calculatedViewCarMargin=Vector2(carSpread.x/viewsize.x,carSpread.y/viewsize.y)
|
|
||||||
var calculatedViewCarMargin=carSpread*camera.zoom #when cars are screen width apart this number matches viewsize=camera.get_viewport_rect().size
|
var calculatedViewCarMargin=carSpread*camera.zoom #when cars are screen width apart this number matches viewsize=camera.get_viewport_rect().size
|
||||||
|
|
||||||
|
|
||||||
|
@ -140,18 +132,15 @@ func _process(delta: float) -> void:
|
||||||
|
|
||||||
|
|
||||||
if game_ended:
|
if game_ended:
|
||||||
var ovlcolor=overlaycolor.get_modulate()
|
var anyplayerkeypressed=false
|
||||||
ovlcolor.a+=0.5*delta
|
for p in Gamestate.getPlayers():
|
||||||
ovlcolor.a=constrain(ovlcolor.a,0.0,1.0)
|
if Input.is_action_pressed(Gamestate.userinput_prefix+str(p.id)):
|
||||||
overlaycolor.set_modulate(ovlcolor)
|
anyplayerkeypressed=true
|
||||||
|
if anyplayerkeypressed and timer_close.time_left<time_close_keypressed:
|
||||||
var tconpos_goal=Vector2(556,304)
|
timer_close.wait_time=time_close_keypressed #set time back
|
||||||
var tconpos=times_container.get_position()
|
timer_close.stop() #prepare for restarting at this time
|
||||||
var tconsize=times_container.get_size()
|
if !anyplayerkeypressed and timer_close.is_stopped():
|
||||||
tconpos+=constrain2((tconpos_goal-tconpos),Vector2(100,100)*delta,Vector2(100,100)*delta) #TODO Fix movement
|
timer_close.start() #start timer when no key is pressed
|
||||||
times_container.set_position(tconpos)
|
|
||||||
#TODO change size container
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _input(ev):
|
func _input(ev):
|
||||||
|
@ -193,16 +182,9 @@ func _on_countdown_timeout() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_car_finished(playerid,finalTime) -> void:
|
func _on_car_finished(playerid,finalTime) -> void:
|
||||||
print("Finished "+str(playerid)+" final time="+str(finalTime))
|
times_container.addFinishedPlayer(playerid,finalTime)
|
||||||
var place=times_container.get_child_count()+1
|
|
||||||
print("New Label. Place "+str(place))
|
|
||||||
var newlabel= Label.new()
|
|
||||||
times_container.add_child(newlabel)
|
|
||||||
newlabel.set("theme_override_font_sizes/font_size",40)
|
|
||||||
newlabel.text=str(place)+": "+str(round(finalTime*1000)/1000.0)+"s"
|
|
||||||
newlabel.set("theme_override_colors/font_color",Gamestate.getPlayers()[playerid].color)
|
|
||||||
|
|
||||||
if times_container.get_child_count() == Gamestate.getPlayers().size(): #all players have finish times
|
if times_container.getPlayersFinished() == Gamestate.getPlayers().size(): #all players have finish times
|
||||||
finishGame()# Game finished
|
finishGame()# Game finished
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,5 +193,14 @@ func finishGame():
|
||||||
print("Game Finished")
|
print("Game Finished")
|
||||||
running=false
|
running=false
|
||||||
game_ended=true
|
game_ended=true
|
||||||
overlaycolor.visible=true
|
game_hud_animations.play("game_end")
|
||||||
|
timer_close.start()
|
||||||
|
#overlaycolor.visible=true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_timer_close_timeout() -> void:
|
||||||
|
print("Close Map")
|
||||||
|
get_tree().change_scene_to_file("res://scenes/menu.tscn")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,11 @@ func getPlayers() -> Array[Player]:
|
||||||
class Player:
|
class Player:
|
||||||
var inputkey:int
|
var inputkey:int
|
||||||
var color:Color
|
var color:Color
|
||||||
|
var id:int
|
||||||
|
|
||||||
func _init(key:int, i:int=-1):
|
func _init(key:int, i:int=-1):
|
||||||
inputkey=key
|
inputkey=key
|
||||||
|
id=i
|
||||||
var sat = 1.0
|
var sat = 1.0
|
||||||
var val = 0.7
|
var val = 0.7
|
||||||
|
|
||||||
|
|
26
scripts/times.gd
Normal file
26
scripts/times.gd
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
extends HFlowContainer
|
||||||
|
|
||||||
|
const fontSize_mini=40
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready() -> void:
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func addFinishedPlayer(playerid,finalTime):
|
||||||
|
print("Finished "+str(playerid)+" final time="+str(finalTime))
|
||||||
|
var place=get_child_count()+1
|
||||||
|
#print("New Label. Place "+str(place))
|
||||||
|
var newlabel= Label.new()
|
||||||
|
add_child(newlabel)
|
||||||
|
newlabel.set("theme_override_font_sizes/font_size",fontSize_mini)
|
||||||
|
newlabel.text=str(place)+": "+str(round(finalTime*1000)/1000.0)+"s"
|
||||||
|
newlabel.set("theme_override_colors/font_color",Gamestate.getPlayers()[playerid].color)
|
||||||
|
|
||||||
|
func getPlayersFinished():
|
||||||
|
return get_child_count()
|
||||||
|
|
Loading…
Reference in a new issue