From 0c0674dc05d71ab156b7077f4415b78135d7c1cc Mon Sep 17 00:00:00 2001 From: perivesta <> Date: Sun, 9 Jul 2023 15:45:42 +0200 Subject: more sprites --- Levels/LevelTemplate.tscn | 12 +--------- Levels/Level_test_2.tscn | 61 +++++++++++++++++++++++++++++++++++++++++++++++ Levels/Tut01.tscn | 16 +++---------- Levels/Tut02.tscn | 15 +----------- Levels/Tut03.tscn | 12 +--------- Nodes/Level_test_2.tscn | 61 ----------------------------------------------- Nodes/car.tscn | 9 +++---- Nodes/checkpoint.tscn | 9 +++++-- Scripts/Checkpoint.gd | 8 +++---- Scripts/car_behaviour.gd | 3 +++ 10 files changed, 86 insertions(+), 120 deletions(-) create mode 100644 Levels/Level_test_2.tscn delete mode 100644 Nodes/Level_test_2.tscn diff --git a/Levels/LevelTemplate.tscn b/Levels/LevelTemplate.tscn index 18d6366..217a0b4 100644 --- a/Levels/LevelTemplate.tscn +++ b/Levels/LevelTemplate.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://dliou1u4o6bib"] +[gd_scene load_steps=10 format=3 uid="uid://dliou1u4o6bib"] [ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_2b4bf"] [ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="2_2w0c4"] @@ -6,7 +6,6 @@ [ext_resource type="Texture2D" uid="uid://cxhterify3l" path="res://Assets/Images/goal.png" id="4_x2h7q"] [ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="5_v816p"] [ext_resource type="Script" path="res://Scripts/drawing.gd" id="6_ihf71"] -[ext_resource type="Texture2D" uid="uid://dg3v488vx0oj6" path="res://Assets/checkpoint.png" id="7_bofa3"] [ext_resource type="TileSet" uid="uid://cl8153posdeim" path="res://Assets/grass_tile_set.tres" id="8_7sh6f"] [sub_resource type="CircleShape2D" id="CircleShape2D_6g88q"] @@ -51,15 +50,6 @@ curve = SubResource("Curve2D_0exre") [node name="TrackFollower" type="PathFollow2D" parent="DrawNode/TrackPath"] loop = false -[node name="Sprite2D" type="Sprite2D" parent="DrawNode/TrackPath/TrackFollower"] -visible = false -scale = Vector2(0.604, 0.604) -texture = ExtResource("7_bofa3") - -[node name="31005" type="Timer" parent="DrawNode/TrackPath/TrackFollower"] -wait_time = 0.2 -one_shot = true - [node name="Checkpoints" type="Node" parent="."] [node name="TileMap" type="TileMap" parent="."] diff --git a/Levels/Level_test_2.tscn b/Levels/Level_test_2.tscn new file mode 100644 index 0000000..fff7252 --- /dev/null +++ b/Levels/Level_test_2.tscn @@ -0,0 +1,61 @@ +[gd_scene load_steps=10 format=3 uid="uid://b7nxnsf8dirqk"] + +[ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_amd1r"] +[ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="2_veexm"] +[ext_resource type="Texture2D" uid="uid://5xqahgawme4m" path="res://Assets/start.png" id="3_sl2tq"] +[ext_resource type="Texture2D" uid="uid://b8vhe5kt6037n" path="res://Assets/end.png" id="4_1x7qu"] +[ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="5_vbxx6"] +[ext_resource type="Script" path="res://Scripts/drawing.gd" id="6_6cnd6"] +[ext_resource type="PackedScene" uid="uid://wkfai2lvnp7n" path="res://Nodes/checkpoint.tscn" id="8_8dt61"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_6g88q"] +radius = 18.0278 + +[sub_resource type="Curve2D" id="Curve2D_0exre"] + +[node name="Level_test" type="Node2D"] +script = ExtResource("1_amd1r") + +[node name="UI" parent="." instance=ExtResource("2_veexm")] + +[node name="Start" type="TextureButton" parent="."] +offset_left = 329.0 +offset_top = 574.0 +offset_right = 361.0 +offset_bottom = 606.0 +texture_normal = ExtResource("3_sl2tq") + +[node name="FinishLine" type="Sprite2D" parent="."] +position = Vector2(694, 598) +texture = ExtResource("4_1x7qu") + +[node name="Area2D" type="Area2D" parent="FinishLine"] + +[node name="CollisionShape2D" type="CollisionShape2D" parent="FinishLine/Area2D"] +shape = SubResource("CircleShape2D_6g88q") + +[node name="Car" parent="." instance=ExtResource("5_vbxx6")] + +[node name="DrawNode" type="Node2D" parent="."] +script = ExtResource("6_6cnd6") + +[node name="TrackLine" type="Line2D" parent="DrawNode"] + +[node name="TrackPath" type="Path2D" parent="DrawNode"] +curve = SubResource("Curve2D_0exre") + +[node name="TrackFollower" type="PathFollow2D" parent="DrawNode/TrackPath"] +loop = false + +[node name="Checkpoints" type="Node" parent="."] + +[node name="Checkpoint" parent="Checkpoints" instance=ExtResource("8_8dt61")] +position = Vector2(1023, 342) + +[node name="Checkpoint2" parent="Checkpoints" instance=ExtResource("8_8dt61")] +position = Vector2(113, 279) + +[node name="Checkpoint3" parent="Checkpoints" instance=ExtResource("8_8dt61")] +position = Vector2(517, 172) + +[connection signal="mouse_entered" from="FinishLine/Area2D" to="DrawNode" method="_end_drawing"] diff --git a/Levels/Tut01.tscn b/Levels/Tut01.tscn index d0ee5c6..d7441dc 100644 --- a/Levels/Tut01.tscn +++ b/Levels/Tut01.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=3 uid="uid://bp56skqd5gqub"] +[gd_scene load_steps=11 format=3 uid="uid://bp56skqd5gqub"] [ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_lcu5v"] [ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="2_44idh"] @@ -6,7 +6,6 @@ [ext_resource type="Texture2D" uid="uid://cxhterify3l" path="res://Assets/Images/goal.png" id="4_mfiv7"] [ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="5_mi6tb"] [ext_resource type="Script" path="res://Scripts/drawing.gd" id="6_0pqvb"] -[ext_resource type="Texture2D" uid="uid://dg3v488vx0oj6" path="res://Assets/checkpoint.png" id="7_00bmf"] [ext_resource type="TileSet" uid="uid://cl8153posdeim" path="res://Assets/grass_tile_set.tres" id="8_wphs7"] [sub_resource type="CircleShape2D" id="CircleShape2D_6g88q"] @@ -55,15 +54,6 @@ curve = SubResource("Curve2D_0exre") [node name="TrackFollower" type="PathFollow2D" parent="DrawNode/TrackPath"] loop = false -[node name="Sprite2D" type="Sprite2D" parent="DrawNode/TrackPath/TrackFollower"] -visible = false -scale = Vector2(0.604, 0.604) -texture = ExtResource("7_00bmf") - -[node name="31005" type="Timer" parent="DrawNode/TrackPath/TrackFollower"] -wait_time = 0.2 -one_shot = true - [node name="Checkpoints" type="Node" parent="."] [node name="Control" type="Control" parent="."] @@ -77,9 +67,9 @@ grow_vertical = 2 [node name="Label" type="Label" parent="Control"] layout_mode = 0 offset_left = 124.0 -offset_top = 378.0 +offset_top = 440.0 offset_right = 398.0 -offset_bottom = 404.0 +offset_bottom = 466.0 text = "Click here to start drawing the road" label_settings = SubResource("LabelSettings_sv8of") diff --git a/Levels/Tut02.tscn b/Levels/Tut02.tscn index ff34cd0..daf1ca0 100644 --- a/Levels/Tut02.tscn +++ b/Levels/Tut02.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=3 uid="uid://ccgojoehaouv0"] +[gd_scene load_steps=11 format=3 uid="uid://ccgojoehaouv0"] [ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_77i7n"] [ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="2_wchsl"] @@ -6,7 +6,6 @@ [ext_resource type="Texture2D" uid="uid://cxhterify3l" path="res://Assets/Images/goal.png" id="4_yklwl"] [ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="5_h0kjy"] [ext_resource type="Script" path="res://Scripts/drawing.gd" id="6_0m5bn"] -[ext_resource type="Texture2D" uid="uid://dg3v488vx0oj6" path="res://Assets/checkpoint.png" id="7_xyp4c"] [ext_resource type="TileSet" uid="uid://cl8153posdeim" path="res://Assets/grass_tile_set.tres" id="8_a1rvy"] [sub_resource type="CircleShape2D" id="CircleShape2D_6g88q"] @@ -22,7 +21,6 @@ outline_color = Color(0, 0, 0, 1) script = ExtResource("1_77i7n") [node name="UI" parent="." instance=ExtResource("2_wchsl")] -visible = false [node name="Start" type="Node2D" parent="."] position = Vector2(256, 422) @@ -35,7 +33,6 @@ offset_bottom = 9.0 texture_normal = ExtResource("3_eeg1f") [node name="FinishLine" type="Sprite2D" parent="."] -visible = false position = Vector2(983, 158) texture = ExtResource("4_yklwl") @@ -57,15 +54,6 @@ curve = SubResource("Curve2D_0exre") [node name="TrackFollower" type="PathFollow2D" parent="DrawNode/TrackPath"] loop = false -[node name="Sprite2D" type="Sprite2D" parent="DrawNode/TrackPath/TrackFollower"] -visible = false -scale = Vector2(0.604, 0.604) -texture = ExtResource("7_xyp4c") - -[node name="31005" type="Timer" parent="DrawNode/TrackPath/TrackFollower"] -wait_time = 0.2 -one_shot = true - [node name="Checkpoints" type="Node" parent="."] [node name="Control" type="Control" parent="."] @@ -86,7 +74,6 @@ text = "Sand is off limits and the car won't go there" label_settings = SubResource("LabelSettings_sv8of") [node name="TileMap" type="TileMap" parent="."] -visible = false z_index = -1 tile_set = ExtResource("8_a1rvy") format = 2 diff --git a/Levels/Tut03.tscn b/Levels/Tut03.tscn index 1aa974a..42ac325 100644 --- a/Levels/Tut03.tscn +++ b/Levels/Tut03.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://ceoxn74ev4wui"] +[gd_scene load_steps=12 format=3 uid="uid://ceoxn74ev4wui"] [ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_6ktyo"] [ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="2_cbrmn"] @@ -6,7 +6,6 @@ [ext_resource type="Texture2D" uid="uid://cxhterify3l" path="res://Assets/Images/goal.png" id="4_a601a"] [ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="5_hgfxg"] [ext_resource type="Script" path="res://Scripts/drawing.gd" id="6_uikm8"] -[ext_resource type="Texture2D" uid="uid://dg3v488vx0oj6" path="res://Assets/checkpoint.png" id="7_ius8n"] [ext_resource type="TileSet" uid="uid://cl8153posdeim" path="res://Assets/grass_tile_set.tres" id="8_1mcey"] [ext_resource type="PackedScene" uid="uid://wkfai2lvnp7n" path="res://Nodes/checkpoint.tscn" id="8_7nfp6"] @@ -56,15 +55,6 @@ curve = SubResource("Curve2D_0exre") [node name="TrackFollower" type="PathFollow2D" parent="DrawNode/TrackPath"] loop = false -[node name="Sprite2D" type="Sprite2D" parent="DrawNode/TrackPath/TrackFollower"] -visible = false -scale = Vector2(0.604, 0.604) -texture = ExtResource("7_ius8n") - -[node name="31005" type="Timer" parent="DrawNode/TrackPath/TrackFollower"] -wait_time = 0.2 -one_shot = true - [node name="Checkpoints" type="Node" parent="."] [node name="Checkpoint" parent="Checkpoints" instance=ExtResource("8_7nfp6")] diff --git a/Nodes/Level_test_2.tscn b/Nodes/Level_test_2.tscn deleted file mode 100644 index fff7252..0000000 --- a/Nodes/Level_test_2.tscn +++ /dev/null @@ -1,61 +0,0 @@ -[gd_scene load_steps=10 format=3 uid="uid://b7nxnsf8dirqk"] - -[ext_resource type="Script" path="res://Scripts/scene_control.gd" id="1_amd1r"] -[ext_resource type="PackedScene" uid="uid://c8r6i3bu37ogu" path="res://Nodes/ui.tscn" id="2_veexm"] -[ext_resource type="Texture2D" uid="uid://5xqahgawme4m" path="res://Assets/start.png" id="3_sl2tq"] -[ext_resource type="Texture2D" uid="uid://b8vhe5kt6037n" path="res://Assets/end.png" id="4_1x7qu"] -[ext_resource type="PackedScene" uid="uid://c1mvbh2fwqtkb" path="res://Nodes/car.tscn" id="5_vbxx6"] -[ext_resource type="Script" path="res://Scripts/drawing.gd" id="6_6cnd6"] -[ext_resource type="PackedScene" uid="uid://wkfai2lvnp7n" path="res://Nodes/checkpoint.tscn" id="8_8dt61"] - -[sub_resource type="CircleShape2D" id="CircleShape2D_6g88q"] -radius = 18.0278 - -[sub_resource type="Curve2D" id="Curve2D_0exre"] - -[node name="Level_test" type="Node2D"] -script = ExtResource("1_amd1r") - -[node name="UI" parent="." instance=ExtResource("2_veexm")] - -[node name="Start" type="TextureButton" parent="."] -offset_left = 329.0 -offset_top = 574.0 -offset_right = 361.0 -offset_bottom = 606.0 -texture_normal = ExtResource("3_sl2tq") - -[node name="FinishLine" type="Sprite2D" parent="."] -position = Vector2(694, 598) -texture = ExtResource("4_1x7qu") - -[node name="Area2D" type="Area2D" parent="FinishLine"] - -[node name="CollisionShape2D" type="CollisionShape2D" parent="FinishLine/Area2D"] -shape = SubResource("CircleShape2D_6g88q") - -[node name="Car" parent="." instance=ExtResource("5_vbxx6")] - -[node name="DrawNode" type="Node2D" parent="."] -script = ExtResource("6_6cnd6") - -[node name="TrackLine" type="Line2D" parent="DrawNode"] - -[node name="TrackPath" type="Path2D" parent="DrawNode"] -curve = SubResource("Curve2D_0exre") - -[node name="TrackFollower" type="PathFollow2D" parent="DrawNode/TrackPath"] -loop = false - -[node name="Checkpoints" type="Node" parent="."] - -[node name="Checkpoint" parent="Checkpoints" instance=ExtResource("8_8dt61")] -position = Vector2(1023, 342) - -[node name="Checkpoint2" parent="Checkpoints" instance=ExtResource("8_8dt61")] -position = Vector2(113, 279) - -[node name="Checkpoint3" parent="Checkpoints" instance=ExtResource("8_8dt61")] -position = Vector2(517, 172) - -[connection signal="mouse_entered" from="FinishLine/Area2D" to="DrawNode" method="_end_drawing"] diff --git a/Nodes/car.tscn b/Nodes/car.tscn index dbfb4e1..c3eb2a6 100644 --- a/Nodes/car.tscn +++ b/Nodes/car.tscn @@ -1,17 +1,18 @@ [gd_scene load_steps=4 format=3 uid="uid://c1mvbh2fwqtkb"] [ext_resource type="Script" path="res://Scripts/car_behaviour.gd" id="1_0e4ux"] - -[sub_resource type="CanvasTexture" id="CanvasTexture_aacgf"] +[ext_resource type="Texture2D" uid="uid://cjb81lukqo6n4" path="res://Assets/Images/car2.png" id="2_wteha"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_wvlyu"] +size = Vector2(32, 14) [node name="Car" type="CharacterBody2D"] script = ExtResource("1_0e4ux") [node name="Sprite2D" type="Sprite2D" parent="."] -scale = Vector2(19.92, 19.76) -texture = SubResource("CanvasTexture_aacgf") +visible = false +rotation = 1.5708 +texture = ExtResource("2_wteha") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] shape = SubResource("RectangleShape2D_wvlyu") diff --git a/Nodes/checkpoint.tscn b/Nodes/checkpoint.tscn index 458f121..5d95f7a 100644 --- a/Nodes/checkpoint.tscn +++ b/Nodes/checkpoint.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=3 uid="uid://wkfai2lvnp7n"] +[gd_scene load_steps=5 format=3 uid="uid://wkfai2lvnp7n"] [ext_resource type="Script" path="res://Scripts/Checkpoint.gd" id="1_fwyov"] [ext_resource type="Texture2D" uid="uid://2jhabylue78s" path="res://Assets/Images/checkpoint_open.png" id="2_62gva"] +[ext_resource type="Texture2D" uid="uid://c016iy5c3e472" path="res://Assets/Images/checkpoint_closed_2.png" id="3_ud10i"] [sub_resource type="CircleShape2D" id="CircleShape2D_q6wen"] radius = 17.0294 @@ -14,7 +15,11 @@ script = ExtResource("1_fwyov") [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] shape = SubResource("CircleShape2D_q6wen") -[node name="Sprite2D" type="Sprite2D" parent="."] +[node name="Sprite2Dopen" type="Sprite2D" parent="."] texture = ExtResource("2_62gva") +[node name="Sprite2Dclosed" type="Sprite2D" parent="."] +visible = false +texture = ExtResource("3_ud10i") + [connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"] diff --git a/Scripts/Checkpoint.gd b/Scripts/Checkpoint.gd index d8c671e..565afef 100644 --- a/Scripts/Checkpoint.gd +++ b/Scripts/Checkpoint.gd @@ -3,15 +3,15 @@ extends Node2D var was_visited = false -@onready var sprite : Sprite2D = $Sprite2D - func set_was_visited(visited: bool): was_visited = visited if(visited): - hide() +# $Sprite2Dopen.hide() + $Sprite2Dclosed.show() else: - show() + $Sprite2Dclosed.hide() +# $Sprite2Dopen.show() # TODO change the sprite to indicate the change func _on_area_2d_body_entered(body): diff --git a/Scripts/car_behaviour.gd b/Scripts/car_behaviour.gd index 8c22bf3..1a69b37 100644 --- a/Scripts/car_behaviour.gd +++ b/Scripts/car_behaviour.gd @@ -29,7 +29,10 @@ func _ready(): func _physics_process(delta): if not driving: + $Sprite2D.hide() return + + $Sprite2D.show() # Code for getting the next desired direction based on the environment set_interest() -- cgit