Enemy follow

This commit is contained in:
2023-09-03 18:23:51 -07:00
parent c8d0eefd7e
commit aa9b5a1793
28 changed files with 27891 additions and 6 deletions

BIN
Audio/BGM/titlemusic.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dbeeph3g2ped8"
path="res://.godot/imported/titlemusic.wav-dfb1259cd0095fafd5f1926f516a0a12.sample"
[deps]
source_file="res://Audio/BGM/titlemusic.wav"
dest_files=["res://.godot/imported/titlemusic.wav-dfb1259cd0095fafd5f1926f516a0a12.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

Binary file not shown.

View File

@@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://cmjk0lv873twh"
path="res://.godot/imported/FBXmeleeenemy.fbx-39d07ae3b54022cb3f8b6fc5b388c1b6.scn"
[deps]
source_file="res://Models/Enemies/FBXmeleeenemy.fbx"
dest_files=["res://.godot/imported/FBXmeleeenemy.fbx-39d07ae3b54022cb3f8b6fc5b388c1b6.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,48 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://hxu85nf6gm3b"
path="res://.godot/imported/meleeenemy.blend-8eccf61141ea355bc9186a38b93c1d84.scn"
[deps]
source_file="res://Models/Enemies/meleeenemy.blend"
dest_files=["res://.godot/imported/meleeenemy.blend-8eccf61141ea355bc9186a38b93c1d84.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1
blender/nodes/visible=0
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dr76w6fde0lqw"
path="res://.godot/imported/meleeenemy.dae-8f3f52592bee6d2abce9846b87baab92.scn"
[deps]
source_file="res://Models/Enemies/meleeenemy.dae"
dest_files=["res://.godot/imported/meleeenemy.dae-8f3f52592bee6d2abce9846b87baab92.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bybcv38cfxn01"
path="res://.godot/imported/meleeenemy1.gltf-5038921943114d8b9556b4a4f0229c76.scn"
[deps]
source_file="res://Models/Enemies/meleeenemy1.gltf"
dest_files=["res://.godot/imported/meleeenemy1.gltf-5038921943114d8b9556b4a4f0229c76.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,32 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://dnqcfnmn1ijj6"
path="res://.godot/imported/meleeenemyloop.glb-5cddba91669024a643af51dd4b166979.scn"
[deps]
source_file="res://Models/Enemies/meleeenemyloop.glb"
dest_files=["res://.godot/imported/meleeenemyloop.glb-5cddba91669024a643af51dd4b166979.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={}
gltf/embedded_image_handling=1

View File

@@ -2,8 +2,8 @@
[ext_resource type="Script" path="res://Scripts/AreaExit.cs" id="1_owv8t"]
[ext_resource type="PackedScene" uid="uid://c0lv8ovqkl3a6" path="res://Levels/Models/STAGE 1.blend" id="1_pwpof"]
[ext_resource type="PackedScene" uid="uid://bt5rolsyjmx55" path="res://Scenes/MeleeEnemyOrb.tscn" id="5_dqbra"]
[ext_resource type="PackedScene" uid="uid://jgf7k1r35km1" path="res://Scenes/ExitPortal.tscn" id="6_gegi6"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="8_43upo"]
[ext_resource type="Script" path="res://Scripts/SpawnPoint.cs" id="9_8v1uu"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_kv6vl"]
@@ -27,10 +27,12 @@ shape = SubResource("CylinderShape3D_kv6vl")
[node name="P1_SpawnPoint" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.28216, 0.123258, 5.51333)
script = ExtResource("8_43upo")
script = ExtResource("9_8v1uu")
[node name="P2_SpawnPoint" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.78123, 0.123258, 5.51333)
script = ExtResource("9_8v1uu")
[node name="MeleeEnemyOrb" parent="." instance=ExtResource("5_dqbra")]
[connection signal="body_entered" from="Area3D2" to="." method="OnExitEntered"]

View File

@@ -24,7 +24,5 @@ offset_bottom = 645.0
text = "Play"
[node name="UIAnimations" parent="." instance=ExtResource("2_erh7e")]
visible = false
[connection signal="IntroAnimationsCompleted" from="." to="." method="OnAllAnimationsFinished"]
[connection signal="pressed" from="NewGame/Button" to="." method="OnStartButtonPressed"]

8
Scenes/MeleeEnemy.tscn Normal file
View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://8hrpjyw4owst"]
[ext_resource type="PackedScene" uid="uid://bg18q3cj6wdie" path="res://Models/Enemies/meleeenemy - Updated.glb" id="1_ug6b2"]
[node name="meleeenemy - Updated" instance=ExtResource("1_ug6b2")]
[node name="AnimationPlayer" parent="." index="10"]
autoplay = "Animation"

18
Scenes/MeleeEnemyOrb.tscn Normal file
View File

@@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=3 uid="uid://bt5rolsyjmx55"]
[ext_resource type="PackedScene" uid="uid://bay1tvgtpfxns" path="res://Scenes/MeleeEnemySchmoove.tscn" id="1_0pxgq"]
[ext_resource type="Script" path="res://Scripts/MeleeEnemy.cs" id="1_50och"]
[sub_resource type="BoxShape3D" id="BoxShape3D_1nq5h"]
size = Vector3(0.470892, 0.604331, 0.423598)
[node name="MeleeEnemyOrb" type="Node3D"]
[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
script = ExtResource("1_50och")
[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.475385, 0.143401)
shape = SubResource("BoxShape3D_1nq5h")
[node name="meleeenemy - Updated" parent="CharacterBody3D" instance=ExtResource("1_0pxgq")]

View File

@@ -0,0 +1,21 @@
[gd_scene load_steps=2 format=3 uid="uid://bay1tvgtpfxns"]
[ext_resource type="PackedScene" uid="uid://bg18q3cj6wdie" path="res://Models/Enemies/meleeenemy - Updated.glb" id="1_7u76h"]
[node name="meleeenemy - Updated" instance=ExtResource("1_7u76h")]
[node name="Circle_004" parent="." index="3"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0868937, 0.567455, 0.186096)
[node name="Text_003" parent="." index="4"]
transform = Transform3D(0.0536953, 0, 0, 0, 0.0536953, 0, 0, 0, 0.0536953, 0.0626427, 0.123465, 0.11049)
[node name="Text_004" parent="." index="6"]
transform = Transform3D(0.0480592, 0, 0, 0, 0.0480592, 0, 0, 0, 0.0480592, 0.0626427, 0.123465, 0.11049)
[node name="Text_005" parent="." index="8"]
transform = Transform3D(0.0438454, 0, 0, 0, 0.0438454, 0, 0, 0, 0.0438454, 0.0626427, 0.123465, 0.11049)
[node name="AnimationPlayer" parent="." index="10"]
autoplay = "Animation"
reset_on_save = false

View File

@@ -13,7 +13,7 @@ height = 3.77708
radius = 0.704872
height = 1.67894
[node name="Pisces" type="CharacterBody3D"]
[node name="Pisces" type="CharacterBody3D" groups=["Player"]]
script = ExtResource("1_tinf8")
_fireProjectile = ExtResource("2_ciujd")
_altFireProjectile = ExtResource("3_0of1i")

View File

@@ -0,0 +1,29 @@
[gd_scene load_steps=2 format=3 uid="uid://bh2xtqtquiplt"]
[ext_resource type="PackedScene" uid="uid://dnqcfnmn1ijj6" path="res://Models/Enemies/meleeenemyloop.glb" id="1_kiqcg"]
[node name="meleeenemyloop" instance=ExtResource("1_kiqcg")]
[node name="Icosphere_001" parent="." index="0"]
transform = Transform3D(0.857174, 0, 0, 0, 0.857174, 0, 0, 0, 0.857174, 0.0805536, 0.463081, 0.158035)
[node name="Circle_001" parent="." index="1"]
transform = Transform3D(1.04984, 0, -0.0183252, 0, 1.05, 0, 0.0183252, 0, 1.04984, 0.0457887, 0.476383, 0.128917)
[node name="Circle_002" parent="." index="2"]
transform = Transform3D(1.1, 0, 0, 0, 1.09983, 0.0191979, 0, -0.0191979, 1.09983, 0.0659095, 0.483551, 0.119628)
[node name="Circle_004" parent="." index="3"]
transform = Transform3D(0.999848, -0.0174526, 0, 0.0174526, 0.999848, 0, 0, 0, 1, 0.0868937, 0.567455, 0.186096)
[node name="Text_003" parent="." index="4"]
transform = Transform3D(0.0536871, 0, -0.000937123, 0, 0.0536953, 0, 0.000937123, 0, 0.0536871, 0.0626427, 0.123465, 0.11049)
[node name="Text_004" parent="." index="6"]
transform = Transform3D(0.0480519, 0, -0.000838759, 0, 0.0480592, 0, 0.000838759, 0, 0.0480519, 0.0626427, 0.123465, 0.11049)
[node name="Text_005" parent="." index="8"]
transform = Transform3D(0.0438387, 0, -0.000765217, 0, 0.0438454, 0, 0.000765217, 0, 0.0438387, 0.0626427, 0.123465, 0.11049)
[node name="AnimationPlayer" parent="." index="10"]
autoplay = "Animation"

View File

@@ -40,6 +40,7 @@ public partial class GameManager : Node
public void OnP1CharacterSelected()
{
GD.Print("Instancing...");
var selectedPlayer = _p1Characters[_p1CharacterIndex].Instantiate();
_p1SelectedCharacter = selectedPlayer as Character;
GetTree().Root.AddChild(_p1SelectedCharacter);

View File

@@ -14,7 +14,7 @@ public partial class MainMenu : Node2D
_player = GetTree().Root.GetNode<AnimationPlayer>("/root/Main/MainMenu/UIAnimations/AnimationPlayer");
_player.Queue("IntroLore");
var bgmPlayer = GetTree().Root.GetNode<BGMPlayer>("BgmPlayer");
bgmPlayer.SetBGMFromFilepath("Audio/BGM/02 MovinOn.mp3");
bgmPlayer.SetBGMFromFilepath("Audio/BGM/titlemusic.wav");
bgmPlayer.PlayBGM();
}

20
Scripts/MeleeEnemy.cs Normal file
View File

@@ -0,0 +1,20 @@
using Godot;
using System.Linq;
public partial class MeleeEnemy : CharacterBody3D
{
private float _speed = 1.0f;
public override void _PhysicsProcess(double delta)
{
var players = GetTree().GetNodesInGroup("Player");
if (players.Any())
{
var convertedPlayers = players.Select(x => (Node3D)x);
var target = convertedPlayers.OrderBy(x => Position.DistanceTo(x.Position)).FirstOrDefault();
GD.Print(Position.DirectionTo(target.Position));
Position = Position.MoveToward(target.Position, _speed * (float)delta);
MoveAndSlide();
}
}
}