feat: Implement core game mechanics including player, enemies, bullets, HUD, and level setup.
This commit is contained in:
18
scenes/ammo_pickup.tscn
Normal file
18
scenes/ammo_pickup.tscn
Normal file
@@ -0,0 +1,18 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://mmopickup123"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/ammo_pickup.gd" id="1_pickup"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddmjl3yshqcjw" path="res://icon.svg" id="2_icon"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pickup"]
|
||||
size = Vector2(32, 32)
|
||||
|
||||
[node name="AmmoPickup" type="Area2D"]
|
||||
script = ExtResource("1_pickup")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(0, 1, 0, 1)
|
||||
scale = Vector2(0.25, 0.25)
|
||||
texture = ExtResource("2_icon")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_pickup")
|
||||
17
scenes/bullet.tscn
Normal file
17
scenes/bullet.tscn
Normal file
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://b6x4y208a1b2c"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/bullet.gd" id="1_bullet"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddmjl3yshqcjw" path="res://icon.svg" id="2_icon"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[node name="Bullet" type="Area2D"]
|
||||
script = ExtResource("1_bullet")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(0.2, 0.2)
|
||||
texture = ExtResource("2_icon")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_1")
|
||||
20
scenes/bullet_ap.tscn
Normal file
20
scenes/bullet_ap.tscn
Normal file
@@ -0,0 +1,20 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bulletap12345"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/bullet.gd" id="1_bullet"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddmjl3yshqcjw" path="res://icon.svg" id="2_icon"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1"]
|
||||
size = Vector2(16, 16)
|
||||
|
||||
[node name="BulletAP" type="Area2D"]
|
||||
script = ExtResource("1_bullet")
|
||||
speed = 700.0
|
||||
damage = 50.0
|
||||
ammo_type = 0
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
scale = Vector2(0.2, 0.2)
|
||||
texture = ExtResource("2_icon")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_1")
|
||||
21
scenes/bullet_he.tscn
Normal file
21
scenes/bullet_he.tscn
Normal file
@@ -0,0 +1,21 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://bullethe68aa0"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/bullet.gd" id="1_bullet"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddmjl3yshqcjw" path="res://icon.svg" id="2_icon"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1"]
|
||||
size = Vector2(20, 20)
|
||||
|
||||
[node name="BulletHE" type="Area2D"]
|
||||
script = ExtResource("1_bullet")
|
||||
speed = 400.0
|
||||
damage = 20.0
|
||||
ammo_type = 1
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
scale = Vector2(0.25, 0.25)
|
||||
texture = ExtResource("2_icon")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_1")
|
||||
33
scenes/enemy.tscn
Normal file
33
scenes/enemy.tscn
Normal file
@@ -0,0 +1,33 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://enemy1234567"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/enemy.gd" id="1_enemy"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxvveyvfp8gmq" path="res://assets/cat_tank_hull.png" id="2_hull"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddktwa3t2dnlv" path="res://assets/cat_tank_turret.png" id="3_turret"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_enemy"]
|
||||
radius = 24.0
|
||||
|
||||
[node name="Enemy" type="CharacterBody2D"]
|
||||
script = ExtResource("1_enemy")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
modulate = Color(1, 0.5, 0.5, 1)
|
||||
rotation = 1.5707964
|
||||
texture = ExtResource("2_hull")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_enemy")
|
||||
|
||||
[node name="Turret" type="Node2D" parent="."]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="Turret"]
|
||||
modulate = Color(1, 0.5, 0.5, 1)
|
||||
rotation = 1.5707964
|
||||
texture = ExtResource("3_turret")
|
||||
|
||||
[node name="HealthBar" type="ProgressBar" parent="."]
|
||||
offset_left = -24.0
|
||||
offset_top = -40.0
|
||||
offset_right = 24.0
|
||||
offset_bottom = -34.0
|
||||
show_percentage = false
|
||||
98
scenes/hud.tscn
Normal file
98
scenes/hud.tscn
Normal file
@@ -0,0 +1,98 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://hud12345678"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/hud.gd" id="1_hud"]
|
||||
|
||||
[node name="HUD" type="CanvasLayer"]
|
||||
script = ExtResource("1_hud")
|
||||
|
||||
[node name="Control" type="Control" parent="."]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="HealthBar" type="ProgressBar" parent="Control"]
|
||||
layout_mode = 0
|
||||
offset_left = 20.0
|
||||
offset_top = 20.0
|
||||
offset_right = 220.0
|
||||
offset_bottom = 50.0
|
||||
value = 100.0
|
||||
|
||||
[node name="AmmoContainer" type="VBoxContainer" parent="Control"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 3
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -150.0
|
||||
offset_top = -80.0
|
||||
offset_right = -20.0
|
||||
offset_bottom = -20.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="APLabel" type="Label" parent="Control/AmmoContainer"]
|
||||
layout_mode = 2
|
||||
text = "AP: 20"
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="HELabel" type="Label" parent="Control/AmmoContainer"]
|
||||
layout_mode = 2
|
||||
text = "HE: 10"
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="GameOverScreen" type="Control" parent="."]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="GameOverScreen"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 0.5)
|
||||
|
||||
[node name="Label" type="Label" parent="GameOverScreen"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -46.0
|
||||
offset_top = -13.0
|
||||
offset_right = 46.0
|
||||
offset_bottom = 13.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "GAME OVER"
|
||||
|
||||
[node name="RestartButton" type="Button" parent="GameOverScreen"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -48.0
|
||||
offset_top = 40.0
|
||||
offset_right = 48.0
|
||||
offset_bottom = 71.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Restart"
|
||||
|
||||
[connection signal="pressed" from="GameOverScreen/RestartButton" to="." method="_on_restart_button_pressed"]
|
||||
28
scenes/level_0.tscn
Normal file
28
scenes/level_0.tscn
Normal file
@@ -0,0 +1,28 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cfwyr25ftoqpk"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cywexaqp3mvxh" path="res://scenes/player.tscn" id="1_7wnc2"]
|
||||
[ext_resource type="Script" uid="uid://m3ii2yiagrn1" path="res://scripts/level_0.gd" id="1_level"]
|
||||
[ext_resource type="Script" uid="uid://bgbuwhxk7uqah" path="res://scripts/spawner.gd" id="2_spawner"]
|
||||
[ext_resource type="PackedScene" uid="uid://enemy1234567" path="res://scenes/enemy.tscn" id="3_enemy"]
|
||||
[ext_resource type="PackedScene" path="res://scenes/hud.tscn" id="4_hud"]
|
||||
[ext_resource type="Script" path="res://scripts/camera_zoom.gd" id="5_camera"]
|
||||
[ext_resource type="Script" path="res://scripts/ammo_spawner.gd" id="6_ammo_spawner"]
|
||||
|
||||
[node name="Level0" type="Node2D"]
|
||||
script = ExtResource("1_level")
|
||||
|
||||
[node name="player" parent="." instance=ExtResource("1_7wnc2")]
|
||||
position = Vector2(234, 192)
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="player"]
|
||||
zoom = Vector2(3, 3)
|
||||
script = ExtResource("5_camera")
|
||||
|
||||
[node name="Spawner" type="Node" parent="."]
|
||||
script = ExtResource("2_spawner")
|
||||
enemy_scene = ExtResource("3_enemy")
|
||||
|
||||
[node name="AmmoSpawner" type="Node" parent="."]
|
||||
script = ExtResource("6_ammo_spawner")
|
||||
|
||||
[node name="HUD" parent="." instance=ExtResource("4_hud")]
|
||||
26
scenes/player.tscn
Normal file
26
scenes/player.tscn
Normal file
@@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://cywexaqp3mvxh"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b1bepj67ddf6c" path="res://scripts/player.gd" id="1_g2els"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxvveyvfp8gmq" path="res://assets/cat_tank_hull.png" id="2_dqkch"]
|
||||
[ext_resource type="Script" uid="uid://8jk475ak64ud" path="res://scripts/turret.gd" id="3_qhqgy"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddktwa3t2dnlv" path="res://assets/cat_tank_turret.png" id="4_qlg0r"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_tuyoq"]
|
||||
radius = 24.0
|
||||
|
||||
[node name="tank" type="CharacterBody2D"]
|
||||
script = ExtResource("1_g2els")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
rotation = 1.5707964
|
||||
texture = ExtResource("2_dqkch")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_tuyoq")
|
||||
|
||||
[node name="turret" type="Node2D" parent="."]
|
||||
script = ExtResource("3_qhqgy")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="turret"]
|
||||
rotation = 1.5707964
|
||||
texture = ExtResource("4_qlg0r")
|
||||
Reference in New Issue
Block a user