This commit is contained in:
2023-09-06 14:43:12 -07:00
parent f8cca640a6
commit d536aa2014
41 changed files with 2747 additions and 1011 deletions

View File

@@ -1,20 +1,37 @@
[gd_scene load_steps=5 format=3 uid="uid://5ce7ky4o0q2e"]
[gd_scene load_steps=6 format=3 uid="uid://5ce7ky4o0q2e"]
[ext_resource type="Texture2D" uid="uid://dha44dnvwhajo" path="res://Textures/Projectiles/Projectile_Capricorn.png" id="1_bvyt4"]
[ext_resource type="Script" path="res://Player/Capricorn/Attacks/CapricornLaserShot.cs" id="1_nkyy8"]
[ext_resource type="AudioStream" uid="uid://bykwwct1not4e" path="res://Audio/SFX/capricorn laeser.wav" id="2_lofnw"]
[sub_resource type="Curve3D" id="Curve3D_bnc6v"]
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0.008, 1, -5),
"tilts": PackedFloat32Array(0, 0)
}
point_count = 2
[sub_resource type="CylinderShape3D" id="CylinderShape3D_bnunv"]
height = 7.40727
radius = 0.419241
[node name="CapricornLaser" type="Node3D"]
script = ExtResource("1_nkyy8")
Cooldown = 1.0
_soundEffect = ExtResource("2_lofnw")
_projectileSpeed = 3.0
[node name="Forward Shot" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
[node name="Forward Shot" type="Path3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.25)
top_level = true
curve = SubResource("Curve3D_bnc6v")
[node name="PathFollow3D" type="PathFollow3D" parent="Forward Shot"]
transform = Transform3D(-0.999998, 0, 0.00159994, 0, 1, 0, -0.00159994, 0, -0.999998, 0, 1, 0)
loop = false
tilt_enabled = false
[node name="Hitbox" type="RigidBody3D" parent="Forward Shot/PathFollow3D"]
transform = Transform3D(-1, 0, -0.000800046, 0, 1, 0, 0.000800046, 0, -1, 0.000400023, -1, 0.5)
collision_layer = 0
collision_mask = 34
gravity_scale = 0.0
@@ -23,18 +40,28 @@ max_contacts_reported = 1
contact_monitor = true
can_sleep = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="Forward Shot"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Forward Shot/PathFollow3D/Hitbox"]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
shape = SubResource("CylinderShape3D_bnunv")
[node name="Sprite3D2" type="Sprite3D" parent="Forward Shot"]
[node name="Sprite3D2" type="Sprite3D" parent="Forward Shot/PathFollow3D/Hitbox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.33, 0, 0.5)
centered = false
axis = 1
texture = ExtResource("1_bvyt4")
[node name="BackwardShot" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0.5)
[node name="Backward Shot" type="Path3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0.25)
top_level = true
curve = SubResource("Curve3D_bnc6v")
[node name="PathFollow3D" type="PathFollow3D" parent="Backward Shot"]
transform = Transform3D(-0.999998, 0, 0.00159994, 0, 1, 0, -0.00159994, 0, -0.999998, 0, 1, 0)
loop = false
tilt_enabled = false
[node name="Hitbox" type="RigidBody3D" parent="Backward Shot/PathFollow3D"]
transform = Transform3D(-1, 0, -0.000800046, 0, 1, 0, 0.000800046, 0, -1, 0.000400023, -1, 0.5)
collision_layer = 0
collision_mask = 34
gravity_scale = 0.0
@@ -43,12 +70,12 @@ max_contacts_reported = 1
contact_monitor = true
can_sleep = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="BackwardShot"]
transform = Transform3D(-0.5, 0, -4.37114e-08, 0, 0.5, 0, 4.37114e-08, 0, -0.5, 0, -0.5, 0.5)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Backward Shot/PathFollow3D/Hitbox"]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
shape = SubResource("CylinderShape3D_bnunv")
[node name="Sprite3D2" type="Sprite3D" parent="BackwardShot/CollisionShape3D"]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -0.66, 0, 0.965768)
[node name="Sprite3D2" type="Sprite3D" parent="Backward Shot/PathFollow3D/Hitbox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.33, 0, 0.5)
centered = false
axis = 1
texture = ExtResource("1_bvyt4")

View File

@@ -1,21 +1,39 @@
[gd_scene load_steps=5 format=3 uid="uid://cdsc35cj566q1"]
[gd_scene load_steps=6 format=3 uid="uid://cdsc35cj566q1"]
[ext_resource type="Script" path="res://Player/Capricorn/Attacks/CapricornLaserShot.cs" id="1_8lywi"]
[ext_resource type="Texture2D" uid="uid://dha44dnvwhajo" path="res://Textures/Projectiles/Projectile_Capricorn.png" id="2_8osg4"]
[ext_resource type="AudioStream" uid="uid://bykwwct1not4e" path="res://Audio/SFX/capricorn laeser.wav" id="2_jeoco"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_bnunv"]
height = 8.32444
[sub_resource type="Curve3D" id="Curve3D_goxuk"]
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0.008, 1, -5),
"tilts": PackedFloat32Array(0, 0)
}
point_count = 2
[sub_resource type="CylinderShape3D" id="CylinderShape3D_hebl4"]
height = 7.40727
radius = 0.419241
[node name="CapricornLaser" type="Node3D"]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -0.242816, 0, 0)
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
script = ExtResource("1_8lywi")
Cooldown = 1.0
_soundEffect = ExtResource("2_jeoco")
_projectileSpeed = 3.0
[node name="Forward Shot" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.5)
[node name="Forward Shot" type="Path3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.25)
top_level = true
curve = SubResource("Curve3D_goxuk")
[node name="PathFollow3D" type="PathFollow3D" parent="Forward Shot"]
transform = Transform3D(-0.999998, 0, 0.00159994, 0, 1, 0, -0.00159994, 0, -0.999998, 0, 1, 0)
loop = false
tilt_enabled = false
[node name="Hitbox" type="RigidBody3D" parent="Forward Shot/PathFollow3D"]
transform = Transform3D(-1, 0, -0.000800046, 0, 1, 0, 0.000800046, 0, -1, 0.000400023, -1, 0.5)
collision_layer = 34
collision_mask = 34
gravity_scale = 0.0
@@ -24,18 +42,28 @@ max_contacts_reported = 1
contact_monitor = true
can_sleep = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="Forward Shot"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Forward Shot/PathFollow3D/Hitbox"]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
shape = SubResource("CylinderShape3D_bnunv")
shape = SubResource("CylinderShape3D_hebl4")
[node name="Sprite3D2" type="Sprite3D" parent="Forward Shot"]
[node name="Sprite3D2" type="Sprite3D" parent="Forward Shot/PathFollow3D/Hitbox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.33, 0, 0.5)
centered = false
axis = 1
texture = ExtResource("2_8osg4")
[node name="BackwardShot" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0.5)
[node name="Backward Shot" type="Path3D" parent="."]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0.25)
top_level = true
curve = SubResource("Curve3D_goxuk")
[node name="PathFollow3D" type="PathFollow3D" parent="Backward Shot"]
transform = Transform3D(-0.999998, 0, 0.00159994, 0, 1, 0, -0.00159994, 0, -0.999998, 0, 1, 0)
loop = false
tilt_enabled = false
[node name="Hitbox" type="RigidBody3D" parent="Backward Shot/PathFollow3D"]
transform = Transform3D(-1, 0, -0.000800046, 0, 1, 0, 0.000800046, 0, -1, 0.000400023, -1, 0.5)
collision_layer = 34
collision_mask = 34
gravity_scale = 0.0
@@ -44,12 +72,12 @@ max_contacts_reported = 1
contact_monitor = true
can_sleep = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="BackwardShot"]
transform = Transform3D(-0.5, 0, -4.37114e-08, 0, 0.5, 0, 4.37114e-08, 0, -0.5, 0, -0.5, 0.5)
shape = SubResource("CylinderShape3D_bnunv")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Backward Shot/PathFollow3D/Hitbox"]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
shape = SubResource("CylinderShape3D_hebl4")
[node name="Sprite3D2" type="Sprite3D" parent="BackwardShot/CollisionShape3D"]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, -0.66, 0, 0.965768)
[node name="Sprite3D2" type="Sprite3D" parent="Backward Shot/PathFollow3D/Hitbox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.33, 0, 0.5)
centered = false
axis = 1
texture = ExtResource("2_8osg4")

View File

@@ -1,12 +1,35 @@
using Godot;
using Godot.Collections;
using System.Linq;
public partial class CapricornLaserShot : Projectile
{
private Array<Path3D> _paths;
public new float Speed { get; private set; }
public override void _Ready()
{
Speed = _projectileSpeed;
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
sfxPlayer.Stream = _soundEffect;
sfxPlayer.Play();
_paths = new Array<Path3D>(GetChildren().OfType<Path3D>());
}
public override void _PhysicsProcess(double delta)
{
var shots = GetChildren().OfType<RigidBody3D>();
shots.ElementAt(0).Translate(new Vector3(0, 0, Speed * -(float)delta));
shots.ElementAt(1).Translate(new Vector3(0, 0, Speed * (float)delta));
foreach (var paths in _paths)
{
var pathFollow = paths.GetChildren().OfType<PathFollow3D>().Single();
pathFollow.Progress += Speed * (float)delta;
if (Mathf.IsEqualApprox(pathFollow.ProgressRatio, 1.0f))
QueueFree();
}
}
private void OnBulletHitObject(Node node)
{
QueueFree();
}
}

View File

@@ -1,109 +1,109 @@
[gd_scene load_steps=36 format=3 uid="uid://crkon4c8ah1a2"]
[ext_resource type="Script" path="res://Player/Capricorn/CapricornP1Controls.cs" id="1_02lam"]
[ext_resource type="PackedScene" uid="uid://5ce7ky4o0q2e" path="res://Player/Capricorn/Attacks/CapricornLaser.tscn" id="2_5fur4"]
[ext_resource type="Texture2D" uid="uid://s0j0kj4ila8s" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackForward.png" id="2_ebqay"]
[ext_resource type="PackedScene" uid="uid://cdsc35cj566q1" path="res://Player/Capricorn/Attacks/CapricornLaserAltFire.tscn" id="3_7c7sn"]
[ext_resource type="Texture2D" uid="uid://dchysrwcxhfvx" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackBehind.png" id="3_c6jic"]
[ext_resource type="Texture2D" uid="uid://cju5ycxiuwy25" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackSide.png" id="4_ivql6"]
[ext_resource type="Texture2D" uid="uid://utm2g5q7m2b3" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkForward.png" id="5_7h4md"]
[ext_resource type="Texture2D" uid="uid://w444vcu8rvae" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkBehind.png" id="6_go5g3"]
[ext_resource type="Texture2D" uid="uid://c5t256wcykb47" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkSide.png" id="7_3c18n"]
[ext_resource type="Script" path="res://Player/Capricorn/CapricornControls.cs" id="1_aqn5t"]
[ext_resource type="PackedScene" uid="uid://5ce7ky4o0q2e" path="res://Player/Capricorn/Attacks/CapricornLaser.tscn" id="2_e6qos"]
[ext_resource type="Texture2D" uid="uid://s0j0kj4ila8s" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackForward.png" id="2_ichjm"]
[ext_resource type="Texture2D" uid="uid://dchysrwcxhfvx" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackBehind.png" id="3_qnhtc"]
[ext_resource type="PackedScene" uid="uid://cdsc35cj566q1" path="res://Player/Capricorn/Attacks/CapricornLaserAltFire.tscn" id="3_wbhxk"]
[ext_resource type="Texture2D" uid="uid://cju5ycxiuwy25" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackSide.png" id="4_n8euj"]
[ext_resource type="Texture2D" uid="uid://utm2g5q7m2b3" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkForward.png" id="5_coe3k"]
[ext_resource type="Texture2D" uid="uid://w444vcu8rvae" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkBehind.png" id="6_2w4xq"]
[ext_resource type="Texture2D" uid="uid://c5t256wcykb47" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkSide.png" id="7_uiqsg"]
[sub_resource type="AtlasTexture" id="AtlasTexture_njxhk"]
atlas = ExtResource("2_ebqay")
atlas = ExtResource("2_ichjm")
region = Rect2(0, 0, 120, 140)
[sub_resource type="AtlasTexture" id="AtlasTexture_bmuvx"]
atlas = ExtResource("2_ebqay")
atlas = ExtResource("2_ichjm")
region = Rect2(120, 0, 120, 140)
[sub_resource type="AtlasTexture" id="AtlasTexture_14ft5"]
atlas = ExtResource("2_ebqay")
atlas = ExtResource("2_ichjm")
region = Rect2(240, 0, 120, 140)
[sub_resource type="AtlasTexture" id="AtlasTexture_olmdj"]
atlas = ExtResource("2_ebqay")
atlas = ExtResource("2_ichjm")
region = Rect2(360, 0, 120, 140)
[sub_resource type="AtlasTexture" id="AtlasTexture_qaudm"]
atlas = ExtResource("3_c6jic")
atlas = ExtResource("3_qnhtc")
region = Rect2(0, 0, 120, 144)
[sub_resource type="AtlasTexture" id="AtlasTexture_a52sr"]
atlas = ExtResource("3_c6jic")
atlas = ExtResource("3_qnhtc")
region = Rect2(120, 0, 120, 144)
[sub_resource type="AtlasTexture" id="AtlasTexture_qkrgl"]
atlas = ExtResource("3_c6jic")
atlas = ExtResource("3_qnhtc")
region = Rect2(240, 0, 120, 144)
[sub_resource type="AtlasTexture" id="AtlasTexture_k5oj5"]
atlas = ExtResource("3_c6jic")
atlas = ExtResource("3_qnhtc")
region = Rect2(360, 0, 120, 144)
[sub_resource type="AtlasTexture" id="AtlasTexture_6iqcx"]
atlas = ExtResource("4_ivql6")
atlas = ExtResource("4_n8euj")
region = Rect2(0, 0, 113, 142)
[sub_resource type="AtlasTexture" id="AtlasTexture_kiiv3"]
atlas = ExtResource("4_ivql6")
atlas = ExtResource("4_n8euj")
region = Rect2(113, 0, 113, 142)
[sub_resource type="AtlasTexture" id="AtlasTexture_up4ur"]
atlas = ExtResource("4_ivql6")
atlas = ExtResource("4_n8euj")
region = Rect2(226, 0, 113, 142)
[sub_resource type="AtlasTexture" id="AtlasTexture_hvxie"]
atlas = ExtResource("4_ivql6")
atlas = ExtResource("4_n8euj")
region = Rect2(339, 0, 113, 142)
[sub_resource type="AtlasTexture" id="AtlasTexture_vc5hj"]
atlas = ExtResource("5_7h4md")
atlas = ExtResource("5_coe3k")
region = Rect2(0, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_672u0"]
atlas = ExtResource("5_7h4md")
atlas = ExtResource("5_coe3k")
region = Rect2(120, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_po3o8"]
atlas = ExtResource("5_7h4md")
atlas = ExtResource("5_coe3k")
region = Rect2(240, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_v0my0"]
atlas = ExtResource("5_7h4md")
atlas = ExtResource("5_coe3k")
region = Rect2(360, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_fge82"]
atlas = ExtResource("6_go5g3")
atlas = ExtResource("6_2w4xq")
region = Rect2(0, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_v2d05"]
atlas = ExtResource("6_go5g3")
atlas = ExtResource("6_2w4xq")
region = Rect2(120, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_mkdc6"]
atlas = ExtResource("6_go5g3")
atlas = ExtResource("6_2w4xq")
region = Rect2(240, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_0nnnw"]
atlas = ExtResource("6_go5g3")
atlas = ExtResource("6_2w4xq")
region = Rect2(360, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_sjqet"]
atlas = ExtResource("7_3c18n")
atlas = ExtResource("7_uiqsg")
region = Rect2(0, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_l8c3l"]
atlas = ExtResource("7_3c18n")
atlas = ExtResource("7_uiqsg")
region = Rect2(113, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_a72tn"]
atlas = ExtResource("7_3c18n")
atlas = ExtResource("7_uiqsg")
region = Rect2(226, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_s2v14"]
atlas = ExtResource("7_3c18n")
atlas = ExtResource("7_uiqsg")
region = Rect2(339, 0, 113, 130)
[sub_resource type="SpriteFrames" id="SpriteFrames_h2iud"]
@@ -214,14 +214,13 @@ animations = [{
[sub_resource type="BoxShape3D" id="BoxShape3D_r4spg"]
size = Vector3(0.856928, 1.65704, 0.82877)
[node name="CapricornP1" type="CharacterBody3D" groups=["Player"]]
[node name="Capricorn" type="CharacterBody3D" groups=["Player"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.408962, 0)
motion_mode = 1
script = ExtResource("1_02lam")
_fireProjectile = ExtResource("2_5fur4")
_altFireProjectile = ExtResource("3_7c7sn")
_fireProjectile = ExtResource("2_5fur4")
_altFireProjectile = ExtResource("3_7c7sn")
script = ExtResource("1_aqn5t")
_fireProjectile = ExtResource("2_e6qos")
_altFireProjectile = ExtResource("3_wbhxk")
_speed = 1.0
[node name="Pivot" type="Node3D" parent="."]

View File

@@ -1,28 +1,17 @@
using Godot;
public partial class CapricornP1Controls : P1Controls
public partial class CapricornControls : Character
{
private AnimatedSprite3D _sprite;
public override void _Ready()
{
base._Ready();
_sprite = GetNode<AnimatedSprite3D>("Pivot/Sprite");
CanShoot = true;
_gameManager = GetTree().Root.GetNode<GameManager>("Main/GameManager");
}
[Export]
private PackedScene _fireProjectile;
[Export]
private PackedScene _altFireProjectile;
[Export]
private float _speed = 3.0f;
public bool IsShooting = false;
private GameManager _gameManager;
public override void _PhysicsProcess(double delta)
{
Velocity = CalculateCharacterMovement(delta);
@@ -34,17 +23,17 @@ public partial class CapricornP1Controls : P1Controls
if (Input.IsActionJustPressed("exit"))
GetTree().Quit();
if (Input.IsActionJustPressed($"p1_fire") && CanShoot)
Fire();
if (Input.IsActionJustPressed($"p1_altfire") && CanShoot)
AltFire();
if (Input.IsActionJustPressed(_ownerPlayer.PlayerInput.Fire()) && CanShoot)
Fire(_fireProjectile);
if (Input.IsActionJustPressed(_ownerPlayer.PlayerInput.AltFire()) && CanShoot)
Fire(_altFireProjectile);
}
private Vector3 CalculateCharacterMovement(double delta)
{
var velocity = Velocity;
var inputDir = Input.GetVector($"p1_left", $"p1_right", $"p1_up", $"p1_down");
var inputDir = Input.GetVector(_ownerPlayer.PlayerInput.Left(), _ownerPlayer.PlayerInput.Right(), _ownerPlayer.PlayerInput.Up(), _ownerPlayer.PlayerInput.Down());
var direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
if (direction != Vector3.Zero)
{
@@ -91,25 +80,12 @@ public partial class CapricornP1Controls : P1Controls
_sprite.Play("WalkBack");
}
private async void Fire()
private async void Fire(PackedScene projectileScene)
{
IsShooting = true;
CanShoot = false;
await ToSignal(GetTree().CreateTimer(0.8f), "timeout");
var projectile = _fireProjectile.Instantiate<Projectile>();
projectile.Position = Position + new Vector3(0f, 1f, 0f);
projectile.ParentCharacter = this;
GetParent().AddChild(projectile);
CanShoot = true;
IsShooting = false;
}
private async void AltFire()
{
IsShooting = true;
CanShoot = false;
await ToSignal(GetTree().CreateTimer(0.8f), "timeout");
var projectile = _altFireProjectile.Instantiate<Projectile>();
var projectile = projectileScene.Instantiate<Projectile>();
await ToSignal(GetTree().CreateTimer(projectile.Cooldown), "timeout");
projectile.Position = Position + new Vector3(0f, 1f, 0f);
projectile.ParentCharacter = this;
GetParent().AddChild(projectile);
@@ -143,6 +119,6 @@ public partial class CapricornP1Controls : P1Controls
public new void OnHit(Node3D node)
{
if (this != null)
_gameManager.CallDeferred(GameManager.MethodName.RemoveCharacter, this);
_gameManager.CallDeferred(GameManager.MethodName.RemoveCharacter, _ownerPlayer);
}
}

View File

@@ -1,248 +0,0 @@
[gd_scene load_steps=36 format=3 uid="uid://db6xew8wvbcl8"]
[ext_resource type="Script" path="res://Player/Capricorn/CapricornP2Controls.cs" id="1_5dwa3"]
[ext_resource type="Texture2D" uid="uid://s0j0kj4ila8s" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackForward.png" id="2_8qhd4"]
[ext_resource type="PackedScene" uid="uid://5ce7ky4o0q2e" path="res://Player/Capricorn/Attacks/CapricornLaser.tscn" id="2_241c5"]
[ext_resource type="PackedScene" uid="uid://cdsc35cj566q1" path="res://Player/Capricorn/Attacks/CapricornLaserAltFire.tscn" id="3_4gj1h"]
[ext_resource type="Texture2D" uid="uid://dchysrwcxhfvx" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackBehind.png" id="3_qftyj"]
[ext_resource type="Texture2D" uid="uid://cju5ycxiuwy25" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_AttackSide.png" id="4_pwka2"]
[ext_resource type="Texture2D" uid="uid://utm2g5q7m2b3" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkForward.png" id="5_4q5hl"]
[ext_resource type="Texture2D" uid="uid://w444vcu8rvae" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkBehind.png" id="6_x36jg"]
[ext_resource type="Texture2D" uid="uid://c5t256wcykb47" path="res://Player/Capricorn/Sprites/GameJam_DevilCapricorn_WalkSide.png" id="7_03beh"]
[sub_resource type="AtlasTexture" id="AtlasTexture_njxhk"]
atlas = ExtResource("2_8qhd4")
region = Rect2(0, 0, 120, 140)
[sub_resource type="AtlasTexture" id="AtlasTexture_bmuvx"]
atlas = ExtResource("2_8qhd4")
region = Rect2(120, 0, 120, 140)
[sub_resource type="AtlasTexture" id="AtlasTexture_14ft5"]
atlas = ExtResource("2_8qhd4")
region = Rect2(240, 0, 120, 140)
[sub_resource type="AtlasTexture" id="AtlasTexture_olmdj"]
atlas = ExtResource("2_8qhd4")
region = Rect2(360, 0, 120, 140)
[sub_resource type="AtlasTexture" id="AtlasTexture_qaudm"]
atlas = ExtResource("3_qftyj")
region = Rect2(0, 0, 120, 144)
[sub_resource type="AtlasTexture" id="AtlasTexture_a52sr"]
atlas = ExtResource("3_qftyj")
region = Rect2(120, 0, 120, 144)
[sub_resource type="AtlasTexture" id="AtlasTexture_qkrgl"]
atlas = ExtResource("3_qftyj")
region = Rect2(240, 0, 120, 144)
[sub_resource type="AtlasTexture" id="AtlasTexture_k5oj5"]
atlas = ExtResource("3_qftyj")
region = Rect2(360, 0, 120, 144)
[sub_resource type="AtlasTexture" id="AtlasTexture_6iqcx"]
atlas = ExtResource("4_pwka2")
region = Rect2(0, 0, 113, 142)
[sub_resource type="AtlasTexture" id="AtlasTexture_kiiv3"]
atlas = ExtResource("4_pwka2")
region = Rect2(113, 0, 113, 142)
[sub_resource type="AtlasTexture" id="AtlasTexture_up4ur"]
atlas = ExtResource("4_pwka2")
region = Rect2(226, 0, 113, 142)
[sub_resource type="AtlasTexture" id="AtlasTexture_hvxie"]
atlas = ExtResource("4_pwka2")
region = Rect2(339, 0, 113, 142)
[sub_resource type="AtlasTexture" id="AtlasTexture_vc5hj"]
atlas = ExtResource("5_4q5hl")
region = Rect2(0, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_672u0"]
atlas = ExtResource("5_4q5hl")
region = Rect2(120, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_po3o8"]
atlas = ExtResource("5_4q5hl")
region = Rect2(240, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_v0my0"]
atlas = ExtResource("5_4q5hl")
region = Rect2(360, 0, 120, 128)
[sub_resource type="AtlasTexture" id="AtlasTexture_fge82"]
atlas = ExtResource("6_x36jg")
region = Rect2(0, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_v2d05"]
atlas = ExtResource("6_x36jg")
region = Rect2(120, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_mkdc6"]
atlas = ExtResource("6_x36jg")
region = Rect2(240, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_0nnnw"]
atlas = ExtResource("6_x36jg")
region = Rect2(360, 0, 120, 132)
[sub_resource type="AtlasTexture" id="AtlasTexture_sjqet"]
atlas = ExtResource("7_03beh")
region = Rect2(0, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_l8c3l"]
atlas = ExtResource("7_03beh")
region = Rect2(113, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_a72tn"]
atlas = ExtResource("7_03beh")
region = Rect2(226, 0, 113, 130)
[sub_resource type="AtlasTexture" id="AtlasTexture_s2v14"]
atlas = ExtResource("7_03beh")
region = Rect2(339, 0, 113, 130)
[sub_resource type="SpriteFrames" id="SpriteFrames_h2iud"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_njxhk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bmuvx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_14ft5")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_olmdj")
}],
"loop": true,
"name": &"AttackBack",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_qaudm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_a52sr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qkrgl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_k5oj5")
}],
"loop": true,
"name": &"AttackForward",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_6iqcx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kiiv3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_up4ur")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_hvxie")
}],
"loop": true,
"name": &"AttackSide",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_vc5hj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_672u0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_po3o8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_v0my0")
}],
"loop": true,
"name": &"WalkBack",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_fge82")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_v2d05")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mkdc6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0nnnw")
}],
"loop": true,
"name": &"WalkForward",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_sjqet")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_l8c3l")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_a72tn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_s2v14")
}],
"loop": true,
"name": &"WalkSide",
"speed": 5.0
}]
[sub_resource type="BoxShape3D" id="BoxShape3D_r4spg"]
size = Vector3(0.856928, 1.65704, 0.82877)
[node name="CapricornP2" type="CharacterBody3D" groups=["Player"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.704732, 0)
motion_mode = 1
script = ExtResource("1_5dwa3")
_fireProjectile = ExtResource("2_241c5")
_altFireProjectile = ExtResource("3_4gj1h")
_fireProjectile = ExtResource("2_241c5")
_altFireProjectile = ExtResource("3_4gj1h")
[node name="Pivot" type="Node3D" parent="."]
[node name="Sprite" type="AnimatedSprite3D" parent="Pivot"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.51107, 0)
billboard = 1
sprite_frames = SubResource("SpriteFrames_h2iud")
animation = &"WalkSide"
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.41651, 0)
shape = SubResource("BoxShape3D_r4spg")
[node name="Area3D" type="Area3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.75657e-15, 1.43031, 0)
disable_mode = 2
collision_layer = 16
collision_mask = 4100
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
transform = Transform3D(0.999665, -0.0258978, -7.10543e-15, 0.0258978, 0.999665, 0, 0, 0, 1, 0, 0, 0)
shape = SubResource("BoxShape3D_r4spg")
[connection signal="body_entered" from="Area3D" to="." method="OnHit" flags=18]

View File

@@ -1,148 +0,0 @@
using Godot;
public partial class CapricornP2Controls : P2Controls
{
private AnimatedSprite3D _sprite;
public override void _Ready()
{
_sprite = GetNode<AnimatedSprite3D>("Pivot/Sprite");
CanShoot = true;
_gameManager = GetTree().Root.GetNode<GameManager>("Main/GameManager");
}
[Export]
private PackedScene _fireProjectile;
[Export]
private PackedScene _altFireProjectile;
[Export]
private float _speed = 3.0f;
public bool IsShooting = false;
private GameManager _gameManager;
public override void _PhysicsProcess(double delta)
{
Velocity = CalculateCharacterMovement(delta);
MoveAndSlide();
}
public override void _UnhandledInput(InputEvent @event)
{
if (Input.IsActionJustPressed("exit"))
GetTree().Quit();
if (Input.IsActionJustPressed($"p2_fire") && CanShoot)
Fire();
if (Input.IsActionJustPressed($"p2_altfire") && CanShoot)
AltFire();
}
private Vector3 CalculateCharacterMovement(double delta)
{
var velocity = Velocity;
var inputDir = Input.GetVector($"p2_left", $"p2_right", $"p2_up", $"p2_down");
var direction = (Transform.Basis * new Vector3(inputDir.X, 0, inputDir.Y)).Normalized();
if (direction != Vector3.Zero)
{
velocity.X = direction.X * _speed;
velocity.Z = direction.Z * _speed;
}
else
{
velocity.X = Mathf.MoveToward(Velocity.X, 0, _speed);
velocity.Z = Mathf.MoveToward(Velocity.Z, 0, _speed);
}
if (IsShooting)
AttackSprite(direction);
else
WalkSprite(direction);
if (!IsShooting && direction.IsEqualApprox(Vector3.Zero))
{
_sprite.Play("WalkForward");
_sprite.Stop();
}
return velocity;
}
private void WalkSprite(Vector3 direction)
{
var roundedDirection = direction.Round();
if (roundedDirection == Vector3.Right)
{
_sprite.Play("WalkSide");
_sprite.FlipH = false;
}
if (roundedDirection == Vector3.Left)
{
_sprite.Play("WalkSide");
_sprite.FlipH = true;
}
if (roundedDirection == Vector3.Forward)
_sprite.Play("WalkForward");
if (roundedDirection == Vector3.Back)
_sprite.Play("WalkBack");
}
private async void Fire()
{
IsShooting = true;
var projectile = _fireProjectile.Instantiate<Projectile>();
projectile.Position = Position + new Vector3(0f, 1f, 0f);
projectile.ParentCharacter = this;
GetParent().AddChild(projectile);
CanShoot = false;
await ToSignal(GetTree().CreateTimer(2.0f), "timeout");
CanShoot = true;
IsShooting = false;
}
private async void AltFire()
{
IsShooting = true;
var projectile = _altFireProjectile.Instantiate<Projectile>();
projectile.Position = Position + new Vector3(0f, 1f, 0f);
projectile.ParentCharacter = this;
GetParent().AddChild(projectile);
CanShoot = false;
await ToSignal(GetTree().CreateTimer(2.0f), "timeout");
CanShoot = true;
IsShooting = false;
}
private void AttackSprite(Vector3 direction)
{
var roundedDirection = direction.Round();
if (roundedDirection == Vector3.Right)
{
_sprite.Play("AttackSide");
_sprite.FlipH = false;
}
if (roundedDirection == Vector3.Left)
{
_sprite.Play("AttackSide");
_sprite.FlipH = true;
}
if (roundedDirection == Vector3.Forward)
_sprite.Play("AttackForward");
if (roundedDirection == Vector3.Back)
_sprite.Play("AttackBack");
if (direction.IsEqualApprox(Vector3.Zero))
_sprite.Play("AttackForward");
}
public new void OnHit(Node3D node)
{
if (this != null)
_gameManager.CallDeferred(GameManager.MethodName.RemoveCharacter, this);
}
}