Turret shooting and damaing

This commit is contained in:
2025-08-30 13:05:50 +08:00
parent 1c6c03cd41
commit 7438ba407a
14 changed files with 410 additions and 14 deletions

BIN
Scenes/Entities/Bullet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 659 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5mb8tu15rc2p"
path="res://.godot/imported/Bullet.png-db4c50cb16094f39ca6a1b9de30a2fe2.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Scenes/Entities/Bullet.png"
dest_files=["res://.godot/imported/Bullet.png-db4c50cb16094f39ca6a1b9de30a2fe2.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=3 uid="uid://erqawdsydh6a"]
[ext_resource type="Texture2D" uid="uid://b5mb8tu15rc2p" path="res://Scenes/Entities/Bullet.png" id="1_fi8au"]
[ext_resource type="Script" uid="uid://vgx2a8gm7l8b" path="res://Scripts/Entities/Bullet.cs" id="1_k5b1m"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_fi8au"]
size = Vector2(44, 12)
[node name="Bullet" type="Area2D"]
collision_mask = 2
script = ExtResource("1_k5b1m")
[node name="Sprite2D" type="Sprite2D" parent="."]
scale = Vector2(0.03, 0.03)
texture = ExtResource("1_fi8au")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_fi8au")

View File

@@ -7,6 +7,8 @@
size = Vector2(60, 74)
[node name="Enemy" type="CharacterBody2D"]
collision_layer = 2
collision_mask = 3
script = ExtResource("1_jajit")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]

View File

@@ -4,6 +4,7 @@
[ext_resource type="Texture2D" uid="uid://jye6c2ehuxtg" path="res://Scenes/Entities/Player.png" id="1_ucweq"]
[node name="Player" type="CharacterBody2D"]
collision_mask = 3
script = ExtResource("1_08t41")
MinZoom = 0.1
MaxZoom = 5.0

View File

@@ -8,6 +8,7 @@ size = Vector2(54, 54)
[node name="GroundTile" type="StaticBody2D"]
collision_layer = 0
collision_mask = 0
script = ExtResource("1_mqsaf")
TileId = "ground"

View File

@@ -8,6 +8,7 @@ size = Vector2(54, 54)
[node name="OreIronTile" type="StaticBody2D"]
collision_layer = 0
collision_mask = 0
script = ExtResource("1_exnim")
TileId = "ore_iron"

View File

@@ -8,6 +8,7 @@ size = Vector2(54, 54)
[node name="StoneTile" type="StaticBody2D"]
collision_layer = 0
collision_mask = 0
script = ExtResource("1_rndy8")
TileId = "stone"

View File

@@ -1,7 +1,8 @@
[gd_scene load_steps=5 format=3 uid="uid://dbup2pvjl8het"]
[gd_scene load_steps=6 format=3 uid="uid://dbup2pvjl8het"]
[ext_resource type="Script" uid="uid://n5g6i0uovxfk" path="res://Scripts/Tiles/TurretTile.cs" id="1_j3157"]
[ext_resource type="Texture2D" uid="uid://ckssi7soymu7g" path="res://Scenes/Tiles/TurretTile.png" id="2_7ljeh"]
[ext_resource type="PackedScene" uid="uid://erqawdsydh6a" path="res://Scenes/Entities/Bullet.tscn" id="2_gfad6"]
[ext_resource type="Texture2D" uid="uid://dmbbkwgff7dej" path="res://Scenes/Tiles/TurretTileBarrel.png" id="3_gfad6"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pndcb"]
@@ -9,6 +10,8 @@ size = Vector2(54, 54)
[node name="Turret" type="StaticBody2D"]
script = ExtResource("1_j3157")
BulletScene = ExtResource("2_gfad6")
BarrelTipPath = NodePath("Barrel/Marker2D")
TileId = "turret"
[node name="Sprite2D" type="Sprite2D" parent="."]
@@ -21,6 +24,10 @@ scale = Vector2(0.08, 0.08)
texture = ExtResource("3_gfad6")
offset = Vector2(0, -54)
[node name="Marker2D" type="Marker2D" parent="Barrel"]
position = Vector2(0, 37.5)
scale = Vector2(12.5, 12.5)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_pndcb")