mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-10 02:05:54 +00:00
Turrets
This commit is contained in:
parent
1d24be6156
commit
d60878c94b
10 changed files with 180 additions and 4 deletions
|
|
@ -31,7 +31,6 @@ collision_layer = 16
|
|||
collision_mask = 2
|
||||
script = ExtResource("3_ax0x5")
|
||||
SweepSpeed = 10.0
|
||||
Debug = true
|
||||
SpritePath = NodePath("../AnimatedSprite2D")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
|
||||
|
|
|
|||
95
Scenes/Actors/Turret.tscn
Normal file
95
Scenes/Actors/Turret.tscn
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
[gd_scene load_steps=14 format=3 uid="uid://b3485f35xal4g"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Actors/Turret.cs" id="1_8kaj0"]
|
||||
[ext_resource type="Texture2D" uid="uid://coai700bkqote" path="res://Sprites/Actors/Turret.png" id="2_epkv0"]
|
||||
[ext_resource type="Script" path="res://Scripts/Components/CameraPlayerDetection.cs" id="3_qgpoq"]
|
||||
[ext_resource type="PackedScene" uid="uid://bhl8u2plfk4yh" path="res://Scenes/Weapons/enemy_weapon_spread.tscn" id="4_dbwkh"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_5n5rh"]
|
||||
atlas = ExtResource("2_epkv0")
|
||||
region = Rect2(64, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_01kjk"]
|
||||
atlas = ExtResource("2_epkv0")
|
||||
region = Rect2(48, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_w7jtw"]
|
||||
atlas = ExtResource("2_epkv0")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_er617"]
|
||||
atlas = ExtResource("2_epkv0")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_sdq4o"]
|
||||
atlas = ExtResource("2_epkv0")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_57tcf"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_5n5rh")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_01kjk")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_w7jtw")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_er617")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_sdq4o")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_nkpag"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_gs7jc"]
|
||||
radius = 85.0529
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_3bqsq"]
|
||||
size = Vector2(8, 12)
|
||||
|
||||
[node name="Turret" type="CharacterBody2D" node_paths=PackedStringArray("EquippedWeapon", "_playerDetection")]
|
||||
collision_layer = 16
|
||||
collision_mask = 75
|
||||
script = ExtResource("1_8kaj0")
|
||||
WalkSpeed = 0.0
|
||||
PlayerDisengageRange = 200.0
|
||||
EquippedWeapon = NodePath("EnemyWeapon")
|
||||
_playerDetection = NodePath("PlayerDetection")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_57tcf")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_nkpag")
|
||||
|
||||
[node name="PlayerDetection" type="Area2D" parent="."]
|
||||
collision_layer = 16
|
||||
collision_mask = 2
|
||||
script = ExtResource("3_qgpoq")
|
||||
SweepSpeed = 10.0
|
||||
SpritePath = NodePath("../AnimatedSprite2D")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="PlayerDetection"]
|
||||
shape = SubResource("CircleShape2D_gs7jc")
|
||||
|
||||
[node name="DamageHitbox" type="Area2D" parent="."]
|
||||
collision_layer = 16
|
||||
collision_mask = 9
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="DamageHitbox"]
|
||||
shape = SubResource("RectangleShape2D_3bqsq")
|
||||
|
||||
[node name="EnemyWeapon" parent="." instance=ExtResource("4_dbwkh")]
|
||||
|
||||
[connection signal="area_entered" from="PlayerDetection" to="PlayerDetection" method="_on_area_entered"]
|
||||
[connection signal="area_exited" from="PlayerDetection" to="PlayerDetection" method="_on_area_exited"]
|
||||
[connection signal="area_entered" from="DamageHitbox" to="." method="_on_damage_hitbox_area_entered"]
|
||||
9
Scenes/Weapons/enemy_weapon_base.tscn
Normal file
9
Scenes/Weapons/enemy_weapon_base.tscn
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cj63k0dmk7tl1"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://crry0rgk7a8sm" path="res://Scenes/Weapons/BaseWeapon.tscn" id="1_60orr"]
|
||||
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="2_dyoou"]
|
||||
|
||||
[node name="EnemyWeapon" instance=ExtResource("1_60orr")]
|
||||
BulletScene = ExtResource("2_dyoou")
|
||||
BulletCapacity = 4
|
||||
BulletSpeed = 50.0
|
||||
11
Scenes/Weapons/enemy_weapon_spread.tscn
Normal file
11
Scenes/Weapons/enemy_weapon_spread.tscn
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bhl8u2plfk4yh"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://crry0rgk7a8sm" path="res://Scenes/Weapons/BaseWeapon.tscn" id="1_o4ne4"]
|
||||
[ext_resource type="PackedScene" uid="uid://cuixq5ex0j40h" path="res://Scenes/enemyBullet.tscn" id="2_85ojb"]
|
||||
|
||||
[node name="EnemyWeapon" instance=ExtResource("1_o4ne4")]
|
||||
BulletScene = ExtResource("2_85ojb")
|
||||
BulletCapacity = 4
|
||||
BulletSpeed = 50.0
|
||||
BulletsPerShot = 3
|
||||
BulletsSpreadAngle = 45.0
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=27 format=4 uid="uid://bv451a8wgty4u"]
|
||||
[gd_scene load_steps=28 format=4 uid="uid://bv451a8wgty4u"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/GameManager.cs" id="1_8tmoj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bghghp5ep4w2j" path="res://Scenes/player.tscn" id="2_8mh54"]
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://cxjumgf8bhr3l" path="res://Scenes/Elevator.tscn" id="16_n40rt"]
|
||||
[ext_resource type="PackedScene" uid="uid://d1h48wgasakk4" path="res://Scenes/Interactable/alarm_box.tscn" id="17_dppcs"]
|
||||
[ext_resource type="PackedScene" uid="uid://cdr4m7pydqk6u" path="res://Scenes/Interactable/control_pad_red_keycard.tscn" id="17_e3v0b"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3485f35xal4g" path="res://Scenes/Actors/Turret.tscn" id="18_6y85f"]
|
||||
[ext_resource type="Script" path="res://Scripts/InventoryManager.cs" id="18_dvo37"]
|
||||
[ext_resource type="PackedScene" uid="uid://v8s3kubgb2qg" path="res://Scenes/Enemy.tscn" id="18_ixcwn"]
|
||||
[ext_resource type="PackedScene" uid="uid://dxs3ks2ucaxl4" path="res://Scenes/Items/Red_Keycard.tscn" id="19_8fb73"]
|
||||
|
|
@ -54,7 +55,7 @@ tile_map_data = PackedByteArray("AADL//L/AAAAAAQAAADL//P/AAAAAAQAAADL//T/AAAAAAQ
|
|||
tile_set = ExtResource("3_kgs2x")
|
||||
|
||||
[node name="Props" type="TileMapLayer" parent="Factory Tilemaps"]
|
||||
tile_map_data = PackedByteArray("AADK/wkAAQAAAAAACgC+/wAAAQAAAAAAAgC9/wAAAQAAAAAAAgC+/wEAAQAAAAAAAgC8/wAAAQAAAAAAAQC+/wIAAQAAAAAAAQC+/wUAAQAAAAAAAQDJ/wQAAQAAAAAAAQDI/wQAAQAAAAAAAQDJ/wUAAQAAAAAAAQDD/wQAAQAAAAAAAQDE/wQAAQAAAAAAAQDJ/wsAAQAAAAAAAgCv//3/AQAAAAAAAQCw//3/AQAAAAAAAQCi/wEAAQAAAAAAAQCj/wEAAQAAAAAAAQCk/wEAAQAAAAAAAQCv/wEAAQAAAAAAAQCu/wEAAQAAAAAAAQC2/w0AAAAGAAAAAAC3/w0AAAAHAAAAAADN//P/AAAAAAIAAADQ//P/AAAAAAIAAAA=")
|
||||
tile_map_data = PackedByteArray("AADK/wkAAQAAAAAACgC+/wAAAQAAAAAAAgC9/wAAAQAAAAAAAgC+/wEAAQAAAAAAAgC8/wAAAQAAAAAAAQC+/wIAAQAAAAAAAQC+/wUAAQAAAAAAAQDJ/wQAAQAAAAAAAQDI/wQAAQAAAAAAAQDJ/wUAAQAAAAAAAQDD/wQAAQAAAAAAAQDE/wQAAQAAAAAAAQDJ/wsAAQAAAAAAAgCv//3/AQAAAAAAAQCw//3/AQAAAAAAAQCi/wEAAQAAAAAAAQCj/wEAAQAAAAAAAQCk/wEAAQAAAAAAAQCv/wEAAQAAAAAAAQCu/wEAAQAAAAAAAQC2/w0AAAAGAAAAAAC3/w0AAAAHAAAAAADN//P/AAAAAAIAAADQ//P/AAAAAAIAAADF/wQAAAAGAAAAAADG/wQAAAAHAAAAAADJ/wYAAAAIAAAAAADJ/wcAAAAIAAEAAAA=")
|
||||
tile_set = ExtResource("3_kgs2x")
|
||||
|
||||
[node name="LargeTank" parent="Factory Tilemaps" instance=ExtResource("6_nkauc")]
|
||||
|
|
@ -131,6 +132,9 @@ position = Vector2(-713, -153)
|
|||
[node name="AlarmBox2" parent="Factory Tilemaps" instance=ExtResource("17_dppcs")]
|
||||
position = Vector2(-616, -153)
|
||||
|
||||
[node name="Turret" parent="Factory Tilemaps" instance=ExtResource("18_6y85f")]
|
||||
position = Vector2(-723, -165)
|
||||
|
||||
[node name="CameraController" type="Camera2D" parent="."]
|
||||
script = ExtResource("6_t8ide")
|
||||
pixel_snap = false
|
||||
|
|
|
|||
19
Scripts/Actors/Turret.cs
Normal file
19
Scripts/Actors/Turret.cs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
public partial class Turret : Enemy
|
||||
{
|
||||
private AnimatedSprite2D _sprite;
|
||||
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
|
||||
_sprite = GetNode<AnimatedSprite2D>("AnimatedSprite2D");
|
||||
|
||||
_sprite.Play("default");
|
||||
_sprite.SpeedScale = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -113,7 +113,6 @@ public partial class CameraPlayerDetection : PlayerDetection
|
|||
Node colliderNode = result["collider"].As<Node>();
|
||||
if (colliderNode is InteractionController interactionController && interactionController == _cachedPlayer)
|
||||
{
|
||||
GD.Print("Player detected!");
|
||||
detected = true;
|
||||
// Handle detection logic here
|
||||
}
|
||||
|
|
|
|||
BIN
Sprites/Actors/Turret.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/Turret.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Actors/Turret.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/Turret.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Actors/Turret.png.import
Normal file
34
Sprites/Actors/Turret.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://coai700bkqote"
|
||||
path="res://.godot/imported/Turret.png-38b0303cb7cd7838f861951126be472e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/Turret.png"
|
||||
dest_files=["res://.godot/imported/Turret.png-38b0303cb7cd7838f861951126be472e.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
|
||||
Loading…
Add table
Add a link
Reference in a new issue