Compare commits

...

3 Commits

Author SHA1 Message Date
78a873529a Fix Project 2023-09-02 13:40:50 -07:00
7c077179f9 Player spawn 2023-09-02 13:26:55 -07:00
7f7595b06d war and murder 2023-09-02 11:25:49 -07:00
11 changed files with 174 additions and 50 deletions

View File

@@ -1,9 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://0em7im554tr4"]
[ext_resource type="PackedScene" uid="uid://d3m6e5iduqxhh" path="res://Levels/levelTEST-col.gltf" id="1_fyfwj"]
[node name="2DTest" type="Node2D"]
[node name="levelTEST-col" parent="." instance=ExtResource("1_fyfwj")]
[node name="Camera2D" type="Camera2D" parent="."]

42
Scenes/EnemyBullet.tscn Normal file
View File

@@ -0,0 +1,42 @@
[gd_scene load_steps=6 format=3 uid="uid://rlxnnw4yay7e"]
[ext_resource type="Script" path="res://Scripts/EnemyBullet.cs" id="1_rv13r"]
[ext_resource type="Texture2D" uid="uid://dpln8jwtpqru0" path="res://Textures/Projectiles/fireball.png" id="2_is81v"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_phgri"]
albedo_color = Color(0.584314, 0.0352941, 0.141176, 1)
[sub_resource type="SphereMesh" id="SphereMesh_wuk0e"]
material = SubResource("StandardMaterial3D_phgri")
[sub_resource type="SphereShape3D" id="SphereShape3D_rokeu"]
radius = 0.440093
[node name="TestBullet" type="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.538645, 0)
script = ExtResource("1_rv13r")
_projectileSpeed = 20.0
[node name="RigidBody3D" type="RigidBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.694675, 0)
collision_layer = 4
collision_mask = 0
gravity_scale = 0.0
custom_integrator = true
continuous_cd = true
max_contacts_reported = 10
contact_monitor = true
can_sleep = false
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D"]
visible = false
mesh = SubResource("SphereMesh_wuk0e")
skeleton = NodePath("../..")
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0905764, 0, 0)
shape = SubResource("SphereShape3D_rokeu")
[node name="Sprite3D" type="Sprite3D" parent="RigidBody3D"]
axis = 1
texture = ExtResource("2_is81v")

View File

@@ -1,25 +1,35 @@
[gd_scene load_steps=6 format=3 uid="uid://b38hcomu4tpm5"]
[gd_scene load_steps=5 format=3 uid="uid://b38hcomu4tpm5"]
[ext_resource type="Script" path="res://Scripts/TestCharacter.cs" id="1_hddqi"]
[ext_resource type="PackedScene" uid="uid://bq40xbqibrk1y" path="res://Scenes/ShotgunBullet.tscn" id="3_5h4r7"]
[ext_resource type="PackedScene" uid="uid://si4byubqnng4" path="res://Scenes/TestBullet.tscn" id="3_ojvu2"]
[ext_resource type="PackedScene" uid="uid://yosw0j58nvrf" path="res://Models/Characters/fwitch.gltf" id="4_n3637"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ayco3"]
radius = 0.980738
height = 3.77708
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_fqik1"]
radius = 0.913688
height = 1.82738
radius = 0.704872
height = 1.67894
[node name="Character" type="CharacterBody3D"]
script = ExtResource("1_hddqi")
_speed = 15.0
_fireProjectile = ExtResource("3_ojvu2")
_altFireProjectile = ExtResource("3_5h4r7")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(0.999665, -0.0258978, -7.10543e-15, 0.0258978, 0.999665, 0, 0, 0, 1, 0, 2.10024, -0.247215)
visible = false
shape = SubResource("CapsuleShape3D_fqik1")
[node name="Pivot" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
[node name="fwitch" parent="Pivot" instance=ExtResource("4_n3637")]
[node name="Area3D" type="Area3D" parent="Pivot"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.75657e-15, 0, 0)
collision_layer = 0
collision_mask = 4
[node name="CollisionShape3D" type="CollisionShape3D" parent="Pivot/Area3D"]
transform = Transform3D(0.999665, -0.0258978, -7.10543e-15, 0.0258978, 0.999665, 0, 0, 0, 1, -0.0242356, 2.05297, -0.302385)
shape = SubResource("CapsuleShape3D_ayco3")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.06805, -0.211049)
shape = SubResource("CapsuleShape3D_fqik1")
[connection signal="body_entered" from="Pivot/Area3D" to="." method="OnHit"]

View File

@@ -1,10 +0,0 @@
using Godot;
public partial class TestEnemy : Node3D
{
public void OnHit(Node node)
{
GD.Print("Hit detected");
QueueFree();
}
}

View File

@@ -1,14 +1,15 @@
[gd_scene load_steps=4 format=3 uid="uid://dkjdt7uq3a4j3"]
[gd_scene load_steps=6 format=3 uid="uid://dkjdt7uq3a4j3"]
[ext_resource type="ArrayMesh" uid="uid://d3u564wle888o" path="res://Models/TestModels/Ness/nesspoly.obj" id="1_jhe4l"]
[ext_resource type="Script" path="res://Scenes/TestEnemy.cs" id="1_m03um"]
[ext_resource type="Script" path="res://Scripts/TestEnemy.cs" id="1_m03um"]
[ext_resource type="PackedScene" uid="uid://rlxnnw4yay7e" path="res://Scenes/EnemyBullet.tscn" id="2_h68e2"]
[ext_resource type="Script" path="res://Scripts/FireAtPlayer.cs" id="3_dhmfs"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eb41r"]
radius = 1.0
height = 3.5
[node name="TestEnemy" type="Node3D"]
script = ExtResource("1_m03um")
[node name="RigidBody3D" type="RigidBody3D" parent="."]
collision_layer = 0
@@ -17,6 +18,7 @@ gravity_scale = 0.0
continuous_cd = true
max_contacts_reported = 10
contact_monitor = true
script = ExtResource("1_m03um")
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.51635, 0)
@@ -27,4 +29,13 @@ transform = Transform3D(7, 0, 0, 0, 7, 0, 0, 0, 7, 0, 0, 0)
mesh = ExtResource("1_jhe4l")
skeleton = NodePath("../..")
[connection signal="body_entered" from="RigidBody3D" to="." method="OnHit"]
[node name="Timer" type="Timer" parent="." node_paths=PackedStringArray("_enemy")]
wait_time = 3.0
autostart = true
script = ExtResource("3_dhmfs")
_enemy = NodePath("../RigidBody3D")
_fireProjectile = ExtResource("2_h68e2")
[connection signal="body_entered" from="RigidBody3D" to="RigidBody3D" method="OnHit"]
[connection signal="tree_exiting" from="RigidBody3D" to="Timer" method="OnDied"]
[connection signal="timeout" from="Timer" to="Timer" method="OnFireAtPlayer"]

View File

@@ -1,8 +1,11 @@
[gd_scene load_steps=10 format=3 uid="uid://dy3d4e6qegyjg"]
[gd_scene load_steps=13 format=3 uid="uid://dy3d4e6qegyjg"]
[ext_resource type="Script" path="res://Scripts/TestLevel.cs" id="1_blhn0"]
[ext_resource type="PackedScene" uid="uid://b38hcomu4tpm5" path="res://Scenes/TestCharacter.tscn" id="1_fwf6c"]
[ext_resource type="PackedScene" uid="uid://bckd04543occ5" path="res://Levels/levelTEST.gltf" id="2_afl3s"]
[ext_resource type="PackedScene" uid="uid://dkjdt7uq3a4j3" path="res://Scenes/TestEnemy.tscn" id="3_ds7vi"]
[ext_resource type="PackedScene" uid="uid://si4byubqnng4" path="res://Scenes/TestBullet.tscn" id="3_lmb02"]
[ext_resource type="PackedScene" uid="uid://bq40xbqibrk1y" path="res://Scenes/ShotgunBullet.tscn" id="4_t522c"]
[sub_resource type="BoxShape3D" id="BoxShape3D_iokol"]
size = Vector3(77.2254, 10, 63.5656)
@@ -14,7 +17,8 @@ size = Vector3(37.611, 23.269, 13.2547)
size = Vector3(100, 100, 18.6922)
[sub_resource type="CylinderShape3D" id="CylinderShape3D_lhgew"]
radius = 1.42751
height = 7.44995
radius = 1.45911
[sub_resource type="CylinderShape3D" id="CylinderShape3D_fa41j"]
height = 4.6719
@@ -24,19 +28,22 @@ radius = 2.32337
height = 5.0
radius = 2.06347
[node name="Level" type="Node3D"]
[node name="Level" type="Node3D" node_paths=PackedStringArray("_spawnPoint")]
script = ExtResource("1_blhn0")
_spawnPoint = NodePath("SpawnPoint")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -2.98023e-08, 1, 0, -1, -2.98023e-08, -0.0769171, 95.2611, -32.0601)
transform = Transform3D(1, 0, 0, 0, 0, 1, 0, -1, 0, -0.0769171, 95.2611, -32.0601)
fov = 30.0
[node name="DebugCamera" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.821149, 0.570714, 0, -0.570714, 0.821149, -0.36148, 17.9168, 0.864431)
visible = false
transform = Transform3D(1, 0, 0, 0, 0.821149, 0.570714, 0, -0.570714, 0.821149, -0.36148, 22.6449, 10.8421)
[node name="Fish Witch" parent="." instance=ExtResource("1_fwf6c")]
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 5.26, 5.13104, -7.959)
[node name="Fish Witch" parent="." groups=["Player"] instance=ExtResource("1_fwf6c")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 40.7459)
_speed = 10.0
_fireProjectile = ExtResource("3_lmb02")
_altFireProjectile = ExtResource("4_t522c")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(-0.931845, -0.0850834, 0.35274, -0.0909281, 0.995857, -1.47234e-08, -0.351279, -0.032074, -0.935721, -3.58319, 8.01249, 0.163277)
@@ -66,28 +73,31 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.650528, -0.488932, -78.351
shape = SubResource("BoxShape3D_sjyl3")
[node name="CollisionShape3D6" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 46.5847, -0.977863, -52.3885)
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 46.5847, -0.977863, -37.8814)
shape = SubResource("BoxShape3D_sjyl3")
[node name="CollisionShape3D7" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -48.9058, -1.95573, -5.80381)
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -48.9058, -1.95573, -38.8643)
shape = SubResource("BoxShape3D_sjyl3")
[node name="CollisionShape3D8" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -48.9058, -1.95573, -40.25)
shape = SubResource("BoxShape3D_sjyl3")
[node name="CollisionShape3D9" type="CollisionShape3D" parent="StaticBody3D"]
[node name="Rock1" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.93645, 5.82082, -21.6909)
shape = SubResource("CylinderShape3D_lhgew")
[node name="CollisionShape3D10" type="CollisionShape3D" parent="StaticBody3D"]
[node name="Rock2" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.82773, 6.46042, -40.6232)
shape = SubResource("CylinderShape3D_fa41j")
[node name="CollisionShape3D11" type="CollisionShape3D" parent="StaticBody3D"]
[node name="Rock3" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(0.999841, -0.0178538, 0, 0.0178538, 0.999841, 0, 0, 0, 1, -6.84036, 6.33278, -46.1737)
shape = SubResource("CylinderShape3D_krlem")
[node name="TestEnemy" parent="." instance=ExtResource("3_ds7vi")]
transform = Transform3D(0.998405, 0.0226647, 0.0517184, -0.0544217, 0.630486, 0.77429, -0.0150588, -0.775869, 0.630714, -20.5579, 4.87709, -43.2246)
transform = Transform3D(0.998405, 0.0226647, 0.0517184, -0.0544217, 0.630486, 0.77429, -0.0150588, -0.775869, 0.630714, -20.5579, 5.52246, -43.2246)
[node name="SpawnPoint" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, -0.757998, 6.71652, -10.4768)

11
Scripts/EnemyBullet.cs Normal file
View File

@@ -0,0 +1,11 @@
using Godot;
public partial class EnemyBullet : Projectile
{
public Vector3 Target;
public override void _PhysicsProcess(double delta)
{
Translate(new Vector3(0, 0, -Speed * (float)delta));
}
}

23
Scripts/FireAtPlayer.cs Normal file
View File

@@ -0,0 +1,23 @@
using Godot;
public partial class FireAtPlayer : Timer
{
[Export]
private Node3D _enemy;
[Export]
private PackedScene _fireProjectile;
public void OnFireAtPlayer()
{
GD.Print("Fire at player");
var projectile = _fireProjectile.Instantiate<Projectile>() as EnemyBullet;
projectile.Rotation = _enemy.Rotation;
projectile.Position = _enemy.Position;
GetParent().AddChild(projectile);
}
private void OnDied()
{
Stop();
}
}

View File

@@ -66,4 +66,9 @@ public partial class TestCharacter : CharacterBody3D
await ToSignal(GetTree().CreateTimer(projectile.Cooldown), "timeout");
CanShoot = true;
}
private void OnHit(Node3D node)
{
QueueFree();
}
}

17
Scripts/TestEnemy.cs Normal file
View File

@@ -0,0 +1,17 @@
using Godot;
public partial class TestEnemy : Node3D
{
public override void _Process(double delta)
{
var player = GetTree().GetFirstNodeInGroup("Player") as TestCharacter;
if (player != null)
LookAt(player.Position);
}
public void OnHit(Node node)
{
GD.Print("Hit detected");
QueueFree();
}
}

14
Scripts/TestLevel.cs Normal file
View File

@@ -0,0 +1,14 @@
using Godot;
public partial class TestLevel : Node3D
{
[Export]
private Marker3D _spawnPoint;
public override void _Ready()
{
var players = GetTree().GetNodesInGroup("Player");
foreach (TestCharacter player in players)
player.Transform = _spawnPoint.Transform;
}
}