Dodge - cleanup. Added Survivor. /JL

This commit is contained in:
2025-12-03 18:44:37 +01:00
parent b2e3877d3b
commit cfeaba54b4
18 changed files with 82 additions and 14 deletions

63
dodge/scenes/hud.tscn Normal file
View File

@@ -0,0 +1,63 @@
[gd_scene load_steps=3 format=3 uid="uid://cql0s0a26rpks"]
[ext_resource type="Script" uid="uid://bm3hot0cb2ls8" path="res://scripts/hud.gd" id="1_64ctp"]
[ext_resource type="FontFile" uid="uid://col2dlmx64bnf" path="res://fonts/Xolonium-Regular.ttf" id="2_8sq4i"]
[node name="HUD" type="CanvasLayer"]
script = ExtResource("1_64ctp")
[node name="ScoreLabel" type="Label" parent="."]
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -22.5
offset_right = 22.5
offset_bottom = 78.0
grow_horizontal = 2
theme_override_fonts/font = ExtResource("2_8sq4i")
theme_override_font_sizes/font_size = 64
text = "0"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Message" type="Label" parent="."]
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -240.0
offset_top = -120.0
offset_right = 240.0
offset_bottom = 120.0
grow_horizontal = 2
grow_vertical = 2
theme_override_fonts/font = ExtResource("2_8sq4i")
theme_override_font_sizes/font_size = 64
text = "Dodge the Creeps!"
horizontal_alignment = 1
vertical_alignment = 1
autowrap_mode = 2
[node name="StartButton" type="Button" parent="."]
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -100.0
offset_top = -140.0
offset_right = 100.0
offset_bottom = -40.0
grow_horizontal = 2
grow_vertical = 0
theme_override_fonts/font = ExtResource("2_8sq4i")
theme_override_font_sizes/font_size = 64
text = "Start"
[node name="MessageTimer" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
[connection signal="pressed" from="StartButton" to="." method="_on_start_button_pressed"]
[connection signal="timeout" from="MessageTimer" to="." method="_on_message_timer_timeout"]

45
dodge/scenes/main.tscn Normal file
View File

@@ -0,0 +1,45 @@
[gd_scene load_steps=6 format=3 uid="uid://d16wqwmxi6r6u"]
[ext_resource type="Script" uid="uid://c6ywdg0jd2u57" path="res://scripts/main.gd" id="1_jyhfs"]
[ext_resource type="PackedScene" uid="uid://2eni4bs27j67" path="res://scenes/mob.tscn" id="2_tbgi4"]
[ext_resource type="PackedScene" uid="uid://clybje3qfbio0" path="res://scenes/player.tscn" id="3_tefeu"]
[ext_resource type="PackedScene" uid="uid://cql0s0a26rpks" path="res://scenes/hud.tscn" id="4_o6xl0"]
[sub_resource type="Curve2D" id="Curve2D_ig7tw"]
_data = {
"points": PackedVector2Array(0, 0, 0, 0, -3, -3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 476, -2, 0, 0, 0, 0, 477, 720, 0, 0, 0, 0, -1, 717, 0, 0, 0, 0, -3, -3)
}
point_count = 6
[node name="main" type="Node"]
script = ExtResource("1_jyhfs")
mob_scene = ExtResource("2_tbgi4")
[node name="Player" parent="." instance=ExtResource("3_tefeu")]
[node name="MobTimer" type="Timer" parent="."]
wait_time = 0.5
[node name="ScoreTimer" type="Timer" parent="."]
[node name="StartTimer" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
[node name="StartPosition" type="Marker2D" parent="."]
position = Vector2(240, 450)
[node name="MobPath" type="Path2D" parent="."]
curve = SubResource("Curve2D_ig7tw")
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath"]
position = Vector2(-3, -3)
rotation = 0.7853982
[node name="HUD" parent="." instance=ExtResource("4_o6xl0")]
[connection signal="hit" from="Player" to="." method="game_over"]
[connection signal="timeout" from="MobTimer" to="." method="_on_mob_timer_timeout"]
[connection signal="timeout" from="ScoreTimer" to="." method="_on_score_timer_timeout"]
[connection signal="timeout" from="StartTimer" to="." method="_on_start_timer_timeout"]
[connection signal="start_game" from="HUD" to="." method="new_game"]

66
dodge/scenes/mob.tscn Normal file
View File

@@ -0,0 +1,66 @@
[gd_scene load_steps=10 format=3 uid="uid://2eni4bs27j67"]
[ext_resource type="Script" uid="uid://byts86xvp7fx5" path="res://scripts/mob.gd" id="1_1qmh0"]
[ext_resource type="Texture2D" uid="uid://c4q2xg7ghmu0u" path="res://art/enemyFlyingAlt_1.png" id="1_b3mxk"]
[ext_resource type="Texture2D" uid="uid://biqy7mqwcxgy1" path="res://art/enemyFlyingAlt_2.png" id="2_1qmh0"]
[ext_resource type="Texture2D" uid="uid://b4bdmsm2sb3mo" path="res://art/enemySwimming_1.png" id="3_gfurk"]
[ext_resource type="Texture2D" uid="uid://cmku4evhd6211" path="res://art/enemySwimming_2.png" id="4_ieysi"]
[ext_resource type="Texture2D" uid="uid://b0r3ayjjpeayb" path="res://art/enemyWalking_1.png" id="5_cixyi"]
[ext_resource type="Texture2D" uid="uid://8uhf1xx0kuqy" path="res://art/enemyWalking_2.png" id="6_7ulmv"]
[sub_resource type="SpriteFrames" id="SpriteFrames_pcqmr"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_b3mxk")
}, {
"duration": 1.0,
"texture": ExtResource("2_1qmh0")
}],
"loop": true,
"name": &"fly",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_gfurk")
}, {
"duration": 1.0,
"texture": ExtResource("4_ieysi")
}],
"loop": true,
"name": &"swim",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("5_cixyi")
}, {
"duration": 1.0,
"texture": ExtResource("6_7ulmv")
}],
"loop": true,
"name": &"walk",
"speed": 5.0
}]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_b3mxk"]
radius = 36.0
height = 100.0
[node name="Mob" type="RigidBody2D" groups=["mobs"]]
collision_mask = 0
gravity_scale = 0.0
script = ExtResource("1_1qmh0")
metadata/_edit_group_ = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
scale = Vector2(0.75, 0.75)
sprite_frames = SubResource("SpriteFrames_pcqmr")
animation = &"walk"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.5707964
shape = SubResource("CapsuleShape2D_b3mxk")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]

50
dodge/scenes/player.tscn Normal file
View File

@@ -0,0 +1,50 @@
[gd_scene load_steps=8 format=3 uid="uid://clybje3qfbio0"]
[ext_resource type="Texture2D" uid="uid://twyr3m3mqj74" path="res://art/playerGrey_up1.png" id="1_hqtel"]
[ext_resource type="Script" uid="uid://uto2x8nu0r1u" path="res://scripts/player.gd" id="1_sweqy"]
[ext_resource type="Texture2D" uid="uid://vdvw5mdy2dsi" path="res://art/playerGrey_up2.png" id="2_sweqy"]
[ext_resource type="Texture2D" uid="uid://d30i17te0nve0" path="res://art/playerGrey_walk1.png" id="3_2hs0m"]
[ext_resource type="Texture2D" uid="uid://8rmp6koh2moy" path="res://art/playerGrey_walk2.png" id="4_1jxqw"]
[sub_resource type="SpriteFrames" id="SpriteFrames_dw050"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("1_hqtel")
}, {
"duration": 1.0,
"texture": ExtResource("2_sweqy")
}],
"loop": true,
"name": &"up",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("3_2hs0m")
}, {
"duration": 1.0,
"texture": ExtResource("4_1jxqw")
}],
"loop": true,
"name": &"walk",
"speed": 5.0
}]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_b26j0"]
radius = 27.0
height = 68.0
[node name="Player" type="Area2D"]
script = ExtResource("1_sweqy")
metadata/_edit_group_ = true
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
scale = Vector2(0.5, 0.5)
sprite_frames = SubResource("SpriteFrames_dw050")
animation = &"up"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CapsuleShape2D_b26j0")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]