mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-09 00:25:54 +00:00
Merge branch 'master' of gitlab.com:MaddoScientisto/cirnogodot
This commit is contained in:
commit
237a59055b
16 changed files with 350 additions and 31 deletions
|
|
@ -1,10 +1,49 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://doqmmuuuprl3s"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://doqmmuuuprl3s"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Interactables/Switch.cs" id="1_62csb"]
|
||||
[ext_resource type="Texture2D" uid="uid://dyk2r7qkhdtkp" path="res://Sprites/Props/Computer.png" id="1_bo0p8"]
|
||||
[ext_resource type="Texture2D" uid="uid://dfjdl48v8kt2l" path="res://Sprites/Props/Computer2.png" id="2_tlxq6"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_wv7xi"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_6yfpu"]
|
||||
atlas = ExtResource("2_tlxq6")
|
||||
region = Rect2(0, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jl6l5"]
|
||||
atlas = ExtResource("2_tlxq6")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_jxgtm"]
|
||||
atlas = ExtResource("2_tlxq6")
|
||||
region = Rect2(32, 0, 16, 16)
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_7837l"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_6yfpu")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jl6l5")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"left",
|
||||
"speed": 5.0
|
||||
}, {
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": SubResource("AtlasTexture_jxgtm")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"right",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="Computer" type="Area2D" groups=["Interactable"]]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
|
|
@ -13,5 +52,5 @@ script = ExtResource("1_62csb")
|
|||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_wv7xi")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_bo0p8")
|
||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
||||
sprite_frames = SubResource("SpriteFrames_7837l")
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ size = Vector2(28, 24)
|
|||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vguns"]
|
||||
size = Vector2(26, 22)
|
||||
|
||||
[node name="LargeTank" type="Area2D" groups=["Destroyable"]]
|
||||
[node name="Mainframe" type="Area2D" groups=["Destroyable"]]
|
||||
collision_layer = 64
|
||||
collision_mask = 10
|
||||
script = ExtResource("1_iba8l")
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
[gd_scene load_steps=33 format=3 uid="uid://bghghp5ep4w2j"]
|
||||
[gd_scene load_steps=34 format=3 uid="uid://bghghp5ep4w2j"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/PlayerMovement.cs" id="1_m27vu"]
|
||||
[ext_resource type="Texture2D" uid="uid://la06powu57hu" path="res://Sprites/Cirno_Big.png" id="2_bwf6x"]
|
||||
[ext_resource type="PackedScene" uid="uid://b1qnfiuokpvsr" path="res://Scenes/Weapons/bullet.tscn" id="2_ov36d"]
|
||||
[ext_resource type="PackedScene" uid="uid://chkpk7erlqajg" path="res://Scenes/Selector.tscn" id="3_8wt6s"]
|
||||
[ext_resource type="Texture2D" uid="uid://b2v6j7lsyltrc" path="res://Sprites/Actors/CirnoWings.png" id="3_ul15q"]
|
||||
[ext_resource type="Script" path="res://addons/smoothing/smoothing_2d.gd" id="4_j4xhu"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddwhrlrgj6i00" path="res://Sprites/Actors/Cirno.png" id="5_hq878"]
|
||||
[ext_resource type="PackedScene" uid="uid://cfb3nsay84xdb" path="res://Scenes/Weapons/crosshair.tscn" id="6_l43rf"]
|
||||
|
|
@ -170,6 +171,7 @@ StrafeSpeed = 35
|
|||
CrosshairDistance = 35.0
|
||||
SelectorScene = ExtResource("3_8wt6s")
|
||||
GameOverScene = "res://Scenes/GameOver.tscn"
|
||||
WingsSprite = ExtResource("3_ul15q")
|
||||
Muzzle = NodePath("Muzzle")
|
||||
HitboxSprite = NodePath("Smoothing2D/HitboxSprite")
|
||||
metadata/_edit_group_ = true
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -26,6 +26,8 @@ public partial class Enemy : CharacterBody2D
|
|||
|
||||
[Export] public Weapon EquippedWeapon;
|
||||
[Export] public Node2D DefeatScript;
|
||||
|
||||
[Export] public AiState Ai { get; private set; }
|
||||
|
||||
protected float _currentHealth = 0f;
|
||||
|
||||
|
|
@ -34,6 +36,13 @@ public partial class Enemy : CharacterBody2D
|
|||
private NavigationAgent2D _navigationAgent;
|
||||
|
||||
protected bool _invulnerable = false;
|
||||
|
||||
#region Manual Movement
|
||||
|
||||
private Vector2 _movementDirection { get; set; } = Vector2.Zero;
|
||||
private Vector2 _facingDirection { get; set; } = Vector2.Right;
|
||||
|
||||
#endregion
|
||||
|
||||
private bool IsPlayerInRange => _playerDetection is { IsPlayerInRange: true };
|
||||
|
||||
|
|
@ -50,7 +59,7 @@ public partial class Enemy : CharacterBody2D
|
|||
private AlarmManager _alarmManager;
|
||||
public bool NavigationEnabled
|
||||
{
|
||||
get => _navigationEnabled && _navigationAgent != null;
|
||||
get => Ai is AiState.Enabled && _navigationEnabled && _navigationAgent != null;
|
||||
set => _navigationEnabled = value;
|
||||
}
|
||||
|
||||
|
|
@ -95,23 +104,55 @@ public partial class Enemy : CharacterBody2D
|
|||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
switch (_currentState)
|
||||
// switch (_currentState)
|
||||
// {
|
||||
// case EnemyState.Idle:
|
||||
//
|
||||
// break;
|
||||
// case EnemyState.Alert:
|
||||
// break;
|
||||
//
|
||||
// //case EnemyState.Shooting:
|
||||
// // Shoot
|
||||
// //break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
|
||||
if (Ai is AiState.Controlled && !_isDestroyed)
|
||||
{
|
||||
case EnemyState.Idle:
|
||||
_movementDirection = GetInput();
|
||||
_facingDirection = _movementDirection;
|
||||
}
|
||||
}
|
||||
|
||||
private Vector2 GetInput()
|
||||
{
|
||||
return Input.GetVector("left", "right", "up", "down");
|
||||
}
|
||||
|
||||
break;
|
||||
case EnemyState.Alert:
|
||||
break;
|
||||
|
||||
//case EnemyState.Shooting:
|
||||
// Shoot
|
||||
//break;
|
||||
default:
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
if (_isDestroyed) return;
|
||||
|
||||
switch (Ai)
|
||||
{
|
||||
case AiState.Enabled:
|
||||
HandleAi(delta);
|
||||
return;
|
||||
case AiState.Controlled:
|
||||
HandleManualControl(delta);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
private void HandleManualControl(double delta)
|
||||
{
|
||||
Velocity = _movementDirection * (float)(WalkSpeed * delta);
|
||||
MoveAndSlide();
|
||||
}
|
||||
|
||||
private void HandleAi(double delta)
|
||||
{
|
||||
switch (_currentState)
|
||||
{
|
||||
|
|
@ -261,10 +302,23 @@ public partial class Enemy : CharacterBody2D
|
|||
return _isDestroyed;
|
||||
}
|
||||
|
||||
private enum EnemyState
|
||||
public void AssumeControl()
|
||||
{
|
||||
GD.Print("Assuming direct control");
|
||||
Ai = AiState.Controlled;
|
||||
}
|
||||
|
||||
protected enum EnemyState
|
||||
{
|
||||
Idle,
|
||||
Alert,
|
||||
Patrolling
|
||||
}
|
||||
|
||||
public enum AiState
|
||||
{
|
||||
Enabled,
|
||||
Disabled,
|
||||
Controlled
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
|
||||
[Export]
|
||||
public string GameOverScene { get; set; }
|
||||
|
||||
[Export]
|
||||
public Texture2D WingsSprite { get; set; }
|
||||
|
||||
private Selector _selector;
|
||||
|
||||
|
|
@ -332,7 +335,7 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
|
|||
{
|
||||
if (!_canMove) return;
|
||||
|
||||
Velocity = _movementDirection * (float)( MovementSpeed/* * delta*/);
|
||||
Velocity = _movementDirection * MovementSpeed;
|
||||
|
||||
MoveAndSlide();
|
||||
}
|
||||
|
|
|
|||
50
Scripts/Resources/Events/ControlEnemyEvent.cs
Normal file
50
Scripts/Resources/Events/ControlEnemyEvent.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Resources.Events;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class ControlEnemyEvent : EventResource
|
||||
{
|
||||
[Export]
|
||||
public NodePath Target { get; set; }
|
||||
|
||||
private Node2D _parent;
|
||||
|
||||
private GameManager _gameManager;
|
||||
private bool _isComplete = false;
|
||||
public override bool IsComplete()
|
||||
{
|
||||
return _isComplete;
|
||||
}
|
||||
|
||||
public override void Init(Node2D parent)
|
||||
{
|
||||
_gameManager = parent.GetGameManager();
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
public override void Start(Node2D parentNode)
|
||||
{
|
||||
_isComplete = false;
|
||||
|
||||
if (_parent.GetNode<Node2D>(Target) is Enemy enemy)
|
||||
{
|
||||
_gameManager.CameraTargetObject(enemy);
|
||||
_gameManager.Player.RequestMovementDisable(true);
|
||||
enemy.AssumeControl();
|
||||
if (_gameManager.Player.WingsSprite != null)
|
||||
{
|
||||
var sprite = new Sprite2D();
|
||||
sprite.SetTexture(_gameManager.Player.WingsSprite);
|
||||
//sprite.GlobalPosition = enemy.GlobalPosition;
|
||||
sprite.SetZIndex(1);
|
||||
enemy.CallDeferred("add_child", sprite);
|
||||
}
|
||||
}
|
||||
|
||||
_isComplete = true;
|
||||
}
|
||||
|
||||
public override void UpdateEvent(double delta) { }
|
||||
|
||||
}
|
||||
BIN
Sprites/Actors/CirnoWings.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/CirnoWings.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Actors/CirnoWings.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Actors/CirnoWings.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Actors/CirnoWings.png.import
Normal file
34
Sprites/Actors/CirnoWings.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b2v6j7lsyltrc"
|
||||
path="res://.godot/imported/CirnoWings.png-e2f6353e3a9fef485751400a507180c1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Actors/CirnoWings.png"
|
||||
dest_files=["res://.godot/imported/CirnoWings.png-e2f6353e3a9fef485751400a507180c1.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
|
||||
BIN
Sprites/Props/Computer2.aseprite
(Stored with Git LFS)
Normal file
BIN
Sprites/Props/Computer2.aseprite
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
Sprites/Props/Computer2.png
(Stored with Git LFS)
Normal file
BIN
Sprites/Props/Computer2.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
Sprites/Props/Computer2.png.import
Normal file
34
Sprites/Props/Computer2.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dfjdl48v8kt2l"
|
||||
path="res://.godot/imported/Computer2.png-86379a2b8ecc73bf0f2989bdcc5d591e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Sprites/Props/Computer2.png"
|
||||
dest_files=["res://.godot/imported/Computer2.png-86379a2b8ecc73bf0f2989bdcc5d591e.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
|
||||
BIN
Tilesets/factory.aseprite
(Stored with Git LFS)
BIN
Tilesets/factory.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
Tilesets/factory.png
(Stored with Git LFS)
BIN
Tilesets/factory.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -277,10 +277,27 @@ texture = ExtResource("1_70kxh")
|
|||
5:5/0/terrains_peering_bit/bottom_side = 1
|
||||
5:5/0/terrains_peering_bit/left_side = 1
|
||||
6:5/0 = 0
|
||||
6:5/0/terrain_set = 0
|
||||
6:5/0/terrain = 3
|
||||
6:5/0/terrains_peering_bit/right_side = 3
|
||||
6:5/0/terrains_peering_bit/bottom_right_corner = 3
|
||||
6:5/0/terrains_peering_bit/bottom_side = 3
|
||||
6:5/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_ajuv4")
|
||||
7:5/0 = 0
|
||||
7:5/0/terrain_set = 0
|
||||
7:5/0/terrain = 3
|
||||
7:5/0/terrains_peering_bit/right_side = 3
|
||||
7:5/0/terrains_peering_bit/bottom_right_corner = 3
|
||||
7:5/0/terrains_peering_bit/bottom_side = 3
|
||||
7:5/0/terrains_peering_bit/bottom_left_corner = 3
|
||||
7:5/0/terrains_peering_bit/left_side = 3
|
||||
7:5/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_ajuv4")
|
||||
8:5/0 = 0
|
||||
8:5/0/terrain_set = 0
|
||||
8:5/0/terrain = 3
|
||||
8:5/0/terrains_peering_bit/bottom_side = 3
|
||||
8:5/0/terrains_peering_bit/bottom_left_corner = 3
|
||||
8:5/0/terrains_peering_bit/left_side = 3
|
||||
8:5/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_ajuv4")
|
||||
9:5/0 = 0
|
||||
9:5/0/terrain_set = 0
|
||||
|
|
@ -326,10 +343,34 @@ texture = ExtResource("1_70kxh")
|
|||
5:6/0/terrains_peering_bit/bottom_side = 1
|
||||
5:6/0/terrains_peering_bit/top_side = 1
|
||||
6:6/0 = 0
|
||||
6:6/0/terrain_set = 0
|
||||
6:6/0/terrain = 3
|
||||
6:6/0/terrains_peering_bit/right_side = 3
|
||||
6:6/0/terrains_peering_bit/bottom_right_corner = 3
|
||||
6:6/0/terrains_peering_bit/bottom_side = 3
|
||||
6:6/0/terrains_peering_bit/top_side = 3
|
||||
6:6/0/terrains_peering_bit/top_right_corner = 3
|
||||
6:6/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_3ass8")
|
||||
7:6/0 = 0
|
||||
7:6/0/terrain_set = 0
|
||||
7:6/0/terrain = 3
|
||||
7:6/0/terrains_peering_bit/right_side = 3
|
||||
7:6/0/terrains_peering_bit/bottom_right_corner = 3
|
||||
7:6/0/terrains_peering_bit/bottom_side = 3
|
||||
7:6/0/terrains_peering_bit/bottom_left_corner = 3
|
||||
7:6/0/terrains_peering_bit/left_side = 3
|
||||
7:6/0/terrains_peering_bit/top_left_corner = 3
|
||||
7:6/0/terrains_peering_bit/top_side = 3
|
||||
7:6/0/terrains_peering_bit/top_right_corner = 3
|
||||
7:6/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_vkcfe")
|
||||
8:6/0 = 0
|
||||
8:6/0/terrain_set = 0
|
||||
8:6/0/terrain = 3
|
||||
8:6/0/terrains_peering_bit/bottom_side = 3
|
||||
8:6/0/terrains_peering_bit/bottom_left_corner = 3
|
||||
8:6/0/terrains_peering_bit/left_side = 3
|
||||
8:6/0/terrains_peering_bit/top_left_corner = 3
|
||||
8:6/0/terrains_peering_bit/top_side = 3
|
||||
8:6/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_63d1d")
|
||||
9:6/0 = 0
|
||||
9:6/0/terrain_set = 0
|
||||
|
|
@ -376,10 +417,27 @@ texture = ExtResource("1_70kxh")
|
|||
5:7/0/terrains_peering_bit/left_side = 1
|
||||
5:7/0/terrains_peering_bit/top_side = 1
|
||||
6:7/0 = 0
|
||||
6:7/0/terrain_set = 0
|
||||
6:7/0/terrain = 3
|
||||
6:7/0/terrains_peering_bit/right_side = 3
|
||||
6:7/0/terrains_peering_bit/top_side = 3
|
||||
6:7/0/terrains_peering_bit/top_right_corner = 3
|
||||
6:7/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_2t186")
|
||||
7:7/0 = 0
|
||||
7:7/0/terrain_set = 0
|
||||
7:7/0/terrain = 3
|
||||
7:7/0/terrains_peering_bit/right_side = 3
|
||||
7:7/0/terrains_peering_bit/left_side = 3
|
||||
7:7/0/terrains_peering_bit/top_left_corner = 3
|
||||
7:7/0/terrains_peering_bit/top_side = 3
|
||||
7:7/0/terrains_peering_bit/top_right_corner = 3
|
||||
7:7/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_2t186")
|
||||
8:7/0 = 0
|
||||
8:7/0/terrain_set = 0
|
||||
8:7/0/terrain = 3
|
||||
8:7/0/terrains_peering_bit/left_side = 3
|
||||
8:7/0/terrains_peering_bit/top_left_corner = 3
|
||||
8:7/0/terrains_peering_bit/top_side = 3
|
||||
8:7/0/navigation_layer_0/polygon = SubResource("NavigationPolygon_63d1d")
|
||||
9:7/0 = 0
|
||||
0:8/0 = 0
|
||||
|
|
@ -769,6 +827,8 @@ terrain_set_0/terrain_1/name = "Pipes"
|
|||
terrain_set_0/terrain_1/color = Color(0.5, 0.4375, 0.25, 1)
|
||||
terrain_set_0/terrain_2/name = "Top Walls"
|
||||
terrain_set_0/terrain_2/color = Color(0.46875, 0.5, 0.25, 1)
|
||||
terrain_set_0/terrain_3/name = "Danger"
|
||||
terrain_set_0/terrain_3/color = Color(0.375, 0.5, 0.25, 1)
|
||||
navigation_layer_0/layers = 1
|
||||
sources/0 = SubResource("TileSetAtlasSource_jwf4b")
|
||||
sources/1 = SubResource("TileSetScenesCollectionSource_qg3vu")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue