mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 08:55:35 +00:00
Camera fix and broken
This commit is contained in:
parent
91fcd73688
commit
dd9c666995
10 changed files with 202 additions and 139 deletions
70
Resources/Sprites/explosion_sprite_animation.tres
Normal file
70
Resources/Sprites/explosion_sprite_animation.tres
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
[gd_resource type="SpriteFrames" load_steps=10 format=3 uid="uid://b2opim6hbj1ir"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b2bp03a70cpyd" path="res://Sprites/Explosion1.png" id="1_da4r8"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ltwjd"]
|
||||
atlas = ExtResource("1_da4r8")
|
||||
region = Rect2(0, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_b8hsa"]
|
||||
atlas = ExtResource("1_da4r8")
|
||||
region = Rect2(32, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1jqx0"]
|
||||
atlas = ExtResource("1_da4r8")
|
||||
region = Rect2(64, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g2luq"]
|
||||
atlas = ExtResource("1_da4r8")
|
||||
region = Rect2(96, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yyc14"]
|
||||
atlas = ExtResource("1_da4r8")
|
||||
region = Rect2(128, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qhukn"]
|
||||
atlas = ExtResource("1_da4r8")
|
||||
region = Rect2(160, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_afp5d"]
|
||||
atlas = ExtResource("1_da4r8")
|
||||
region = Rect2(192, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cpopo"]
|
||||
atlas = ExtResource("1_da4r8")
|
||||
region = Rect2(224, 0, 32, 32)
|
||||
|
||||
[resource]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ltwjd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_b8hsa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1jqx0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_g2luq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_yyc14")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qhukn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_afp5d")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_cpopo")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": null
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"default",
|
||||
"speed": 8.0
|
||||
}]
|
||||
43
Scenes/Actors/BrokenCamera.tscn
Normal file
43
Scenes/Actors/BrokenCamera.tscn
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
[gd_scene load_steps=8 format=3 uid="uid://bai06iwuli4nj"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cpuffmksk41n4" path="res://Sprites/Actors/Camera.png" id="1_d5e54"]
|
||||
[ext_resource type="PackedScene" uid="uid://jmijre3eaf8m" path="res://Scenes/Explosion.tscn" id="2_dr41q"]
|
||||
[ext_resource type="Script" uid="uid://c4molirtle8a0" path="res://Scripts/Components/AutodeleteParticle.cs" id="3_fvpk1"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://b2opim6hbj1ir" path="res://Resources/Sprites/explosion_sprite_animation.tres" id="4_dr41q"]
|
||||
[ext_resource type="AudioStream" uid="uid://ds84e0m5l4i5d" path="res://SFX/404752__owlstorm__retro-video-game-sfx-explode-3.wav" id="5_fvpk1"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_05any"]
|
||||
atlas = ExtResource("1_d5e54")
|
||||
region = Rect2(80, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_sdgd5"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_05any")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="BrokenCamera" type="Node2D"]
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_sdgd5")
|
||||
|
||||
[node name="Explosion" parent="." instance=ExtResource("2_dr41q")]
|
||||
script = ExtResource("3_fvpk1")
|
||||
LifeTime = 5.0
|
||||
AutoStart = true
|
||||
|
||||
[node name="Explosion2" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = ExtResource("4_dr41q")
|
||||
autoplay = "default"
|
||||
frame = 8
|
||||
frame_progress = 1.0
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("5_fvpk1")
|
||||
autoplay = true
|
||||
max_distance = 100.0
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://c27co22bjym3c"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://c27co22bjym3c"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c534mr1ub2dwl" path="res://Scripts/Actors/Camera.cs" id="1_2qb38"]
|
||||
[ext_resource type="PackedScene" uid="uid://bai06iwuli4nj" path="res://Scenes/Actors/BrokenCamera.tscn" id="2_aysqd"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://yfxog8pww6ih" path="res://Resources/Sprites/Camera.tres" id="2_omkb8"]
|
||||
[ext_resource type="Script" uid="uid://ec2wfevxxgy8" path="res://Scripts/Components/CameraPlayerDetection.cs" id="3_ax0x5"]
|
||||
|
||||
|
|
@ -18,6 +19,7 @@ collision_mask = 75
|
|||
script = ExtResource("1_2qb38")
|
||||
Health = 1.0
|
||||
WalkSpeed = 0.0
|
||||
CorpseTemplate = ExtResource("2_aysqd")
|
||||
_playerDetection = NodePath("PlayerDetection")
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
|
|
@ -28,11 +30,11 @@ visible = false
|
|||
shape = SubResource("CircleShape2D_nkpag")
|
||||
|
||||
[node name="PlayerDetection" type="Area2D" parent="."]
|
||||
visible = false
|
||||
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"]
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ shape = SubResource("CircleShape2D_igu66")
|
|||
|
||||
[node name="InteractionProvider" type="Area2D" parent="." node_paths=PackedStringArray("_inputProvider", "_errorSound")]
|
||||
visible = false
|
||||
collision_layer = 2
|
||||
collision_layer = 0
|
||||
collision_mask = 4
|
||||
script = ExtResource("22_12cwd")
|
||||
SelectorScene = ExtResource("23_5tmtw")
|
||||
|
|
|
|||
|
|
@ -1,73 +1,9 @@
|
|||
[gd_scene load_steps=14 format=3 uid="uid://h11o0et1y54v"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://h11o0et1y54v"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dsa4b75hdig8p" path="res://Scripts/Bullet.cs" id="1_f0epf"]
|
||||
[ext_resource type="Texture2D" uid="uid://b2bp03a70cpyd" path="res://Sprites/Explosion1.png" id="2_gmwb3"]
|
||||
[ext_resource type="SpriteFrames" uid="uid://b2opim6hbj1ir" path="res://Resources/Sprites/explosion_sprite_animation.tres" id="2_wng0j"]
|
||||
[ext_resource type="AudioStream" uid="uid://ds84e0m5l4i5d" path="res://SFX/404752__owlstorm__retro-video-game-sfx-explode-3.wav" id="3_wng0j"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_ltwjd"]
|
||||
atlas = ExtResource("2_gmwb3")
|
||||
region = Rect2(0, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_b8hsa"]
|
||||
atlas = ExtResource("2_gmwb3")
|
||||
region = Rect2(32, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_1jqx0"]
|
||||
atlas = ExtResource("2_gmwb3")
|
||||
region = Rect2(64, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_g2luq"]
|
||||
atlas = ExtResource("2_gmwb3")
|
||||
region = Rect2(96, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yyc14"]
|
||||
atlas = ExtResource("2_gmwb3")
|
||||
region = Rect2(128, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_qhukn"]
|
||||
atlas = ExtResource("2_gmwb3")
|
||||
region = Rect2(160, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_afp5d"]
|
||||
atlas = ExtResource("2_gmwb3")
|
||||
region = Rect2(192, 0, 32, 32)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_cpopo"]
|
||||
atlas = ExtResource("2_gmwb3")
|
||||
region = Rect2(224, 0, 32, 32)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_6egyg"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_ltwjd")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_b8hsa")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_1jqx0")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_g2luq")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_yyc14")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_qhukn")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_afp5d")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_cpopo")
|
||||
}],
|
||||
"loop": false,
|
||||
"name": &"default",
|
||||
"speed": 8.0
|
||||
}]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_jxptd"]
|
||||
radius = 17.0
|
||||
|
||||
|
|
@ -79,7 +15,7 @@ Speed = 0.0
|
|||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_6egyg")
|
||||
sprite_frames = ExtResource("2_wng0j")
|
||||
autoplay = "default"
|
||||
frame = 1
|
||||
|
||||
|
|
|
|||
127
Scenes/test.tscn
127
Scenes/test.tscn
File diff suppressed because one or more lines are too long
|
|
@ -98,7 +98,7 @@ public partial class CameraPlayerDetection : PlayerDetection
|
|||
// Perform raycast
|
||||
var spaceState = GetWorld2D().DirectSpaceState;
|
||||
var query = PhysicsRayQueryParameters2D.Create(GlobalPosition, rayEnd);
|
||||
query.Exclude = new Godot.Collections.Array<Rid> { GetRid() };
|
||||
query.Exclude = [GetRid()];
|
||||
query.CollideWithAreas = true;
|
||||
query.CollideWithBodies = true;
|
||||
query.CollisionMask = collisionMask;
|
||||
|
|
@ -114,7 +114,6 @@ public partial class CameraPlayerDetection : PlayerDetection
|
|||
if (colliderNode is InteractionController interactionController && interactionController == _cachedPlayer)
|
||||
{
|
||||
detected = true;
|
||||
// Handle detection logic here
|
||||
}
|
||||
// Adjust debug line to collision point
|
||||
debugLineEnd = (Vector2)result["position"];
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ public partial class Enemy : CharacterBody2D
|
|||
|
||||
[Export] public AiState Ai { get; private set; }
|
||||
|
||||
[Export] public PackedScene CorpseTemplate { get; private set; }
|
||||
|
||||
protected float _currentHealth = 0f;
|
||||
|
||||
private bool _isDestroyed = false;
|
||||
|
|
@ -268,10 +270,18 @@ public partial class Enemy : CharacterBody2D
|
|||
ActivateDefeatScript();
|
||||
}
|
||||
//CreateParticles();
|
||||
//CreateDebris();
|
||||
CreateDebris();
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
private void CreateDebris()
|
||||
{
|
||||
if (CorpseTemplate is not null)
|
||||
{
|
||||
this.CreateSibling<Node2D>(CorpseTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
protected void ActivateDefeatScript()
|
||||
{
|
||||
if (DefeatScript is not IActivable target)
|
||||
|
|
|
|||
BIN
Sprites/Actors/Camera.aseprite
(Stored with Git LFS)
BIN
Sprites/Actors/Camera.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Sprites/Actors/Camera.png
(Stored with Git LFS)
BIN
Sprites/Actors/Camera.png
(Stored with Git LFS)
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue