Compare commits
3 Commits
b58f4412f2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9382d3f3a5 | ||
|
|
30f564323a | ||
|
|
1c4f90fa96 |
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=22 format=3 uid="uid://eknn66u8gt26"]
|
[gd_scene format=3 uid="uid://eknn66u8gt26"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cy22d14qd0f48" path="res://Assets/Scenes/DEVSCENES/IQEnemy.cs" id="1_p53ib"]
|
[ext_resource type="Script" uid="uid://cy22d14qd0f48" path="res://Assets/Scripts/EnemyScripts/IQEnemy.cs" id="1_p53ib"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c0pno0ac25r7i" path="res://Assets/Sprites/knight.png" id="2_o0b1e"]
|
[ext_resource type="Texture2D" uid="uid://c0pno0ac25r7i" path="res://Assets/Sprites/knight.png" id="2_o0b1e"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_41iyt"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_41iyt"]
|
||||||
@@ -128,21 +128,22 @@ animations = [{
|
|||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bc7hl"]
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bc7hl"]
|
||||||
|
|
||||||
[node name="IQEnemy" type="CharacterBody2D"]
|
[node name="IQEnemy" type="CharacterBody2D" unique_id=240625765]
|
||||||
collision_layer = 8
|
collision_layer = 8
|
||||||
collision_mask = 3
|
collision_mask = 3
|
||||||
script = ExtResource("1_p53ib")
|
script = ExtResource("1_p53ib")
|
||||||
metadata/IQ = 20
|
metadata/IQ = 20
|
||||||
metadata/AbilityRegenerate = true
|
metadata/AbilityRegenerate = true
|
||||||
metadata/_edit_vertical_guides_ = [-36.0]
|
metadata/_edit_vertical_guides_ = [-36.0]
|
||||||
|
metadata/AbilityLunge = true
|
||||||
|
|
||||||
[node name="Hitbox" type="CollisionShape2D" parent="."]
|
[node name="Hitbox" type="CollisionShape2D" parent="." unique_id=2143062555]
|
||||||
position = Vector2(0, 2)
|
position = Vector2(0, 2)
|
||||||
shape = SubResource("RectangleShape2D_41iyt")
|
shape = SubResource("RectangleShape2D_41iyt")
|
||||||
|
|
||||||
[node name="VisualsAndHitboxes" type="Node2D" parent="."]
|
[node name="VisualsAndHitboxes" type="Node2D" parent="." unique_id=1894404141]
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="VisualsAndHitboxes"]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="VisualsAndHitboxes" unique_id=1301527955]
|
||||||
position = Vector2(9.536743e-07, -1.9999999)
|
position = Vector2(9.536743e-07, -1.9999999)
|
||||||
scale = Vector2(0.99999994, 0.99999994)
|
scale = Vector2(0.99999994, 0.99999994)
|
||||||
sprite_frames = SubResource("SpriteFrames_rqn21")
|
sprite_frames = SubResource("SpriteFrames_rqn21")
|
||||||
@@ -150,28 +151,28 @@ autoplay = "default"
|
|||||||
frame = 1
|
frame = 1
|
||||||
frame_progress = 0.9866207
|
frame_progress = 0.9866207
|
||||||
|
|
||||||
[node name="GroundDetector" type="Area2D" parent="VisualsAndHitboxes"]
|
[node name="GroundDetector" type="Area2D" parent="VisualsAndHitboxes" unique_id=1709439423]
|
||||||
position = Vector2(1.1368684e-13, 11.000001)
|
position = Vector2(1.1368684e-13, 11.000001)
|
||||||
scale = Vector2(0.099999994, 0.099999994)
|
scale = Vector2(0.099999994, 0.099999994)
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="VisualsAndHitboxes/GroundDetector"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="VisualsAndHitboxes/GroundDetector" unique_id=1429561812]
|
||||||
position = Vector2(0, 19.999992)
|
position = Vector2(0, 19.999992)
|
||||||
scale = Vector2(0.99999994, 0.99999994)
|
scale = Vector2(0.99999994, 0.99999994)
|
||||||
shape = SubResource("RectangleShape2D_bc7hl")
|
shape = SubResource("RectangleShape2D_bc7hl")
|
||||||
|
|
||||||
[node name="LedgeDetector" type="Area2D" parent="VisualsAndHitboxes"]
|
[node name="LedgeDetector" type="Area2D" parent="VisualsAndHitboxes" unique_id=1421687086]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="VisualsAndHitboxes/LedgeDetector"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="VisualsAndHitboxes/LedgeDetector" unique_id=1073584572]
|
||||||
position = Vector2(11, 13)
|
position = Vector2(11, 13)
|
||||||
scale = Vector2(0.1, 0.1)
|
scale = Vector2(0.1, 0.1)
|
||||||
shape = SubResource("RectangleShape2D_bc7hl")
|
shape = SubResource("RectangleShape2D_bc7hl")
|
||||||
|
|
||||||
[node name="WallDetector" type="Area2D" parent="VisualsAndHitboxes"]
|
[node name="WallDetector" type="Area2D" parent="VisualsAndHitboxes" unique_id=1085104067]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="VisualsAndHitboxes/WallDetector"]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="VisualsAndHitboxes/WallDetector" unique_id=1699607778]
|
||||||
position = Vector2(11, 9.536743e-07)
|
position = Vector2(11, 9.536743e-07)
|
||||||
scale = Vector2(0.1, 0.1)
|
scale = Vector2(0.1, 0.1)
|
||||||
shape = SubResource("RectangleShape2D_bc7hl")
|
shape = SubResource("RectangleShape2D_bc7hl")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public partial class CommonData : Node
|
|||||||
// Level information
|
// Level information
|
||||||
public string CurrentLevel;
|
public string CurrentLevel;
|
||||||
|
|
||||||
// Player information
|
// Player stats
|
||||||
public float CurrentHealth;
|
public float CurrentHealth;
|
||||||
public float MaxHealth = 100;
|
public float MaxHealth = 100;
|
||||||
|
|
||||||
@@ -33,13 +33,14 @@ public partial class CommonData : Node
|
|||||||
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
|
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
|
||||||
|
|
||||||
// Start game by loading the main menu
|
// Start game by loading the main menu
|
||||||
scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MainMenu.tscn");
|
//scene = GD.Load<PackedScene>("res://Assets/Scenes/MenusAndLevels/MainMenu.tscn");
|
||||||
//scene = GD.Load<PackedScene>("res://Assets/Scenes/DEVSCENES/EnemyTest.tscn");
|
scene = GD.Load<PackedScene>("res://Assets/Scenes/DEVSCENES/EnemyTest.tscn");
|
||||||
inst = scene.Instantiate();
|
inst = scene.Instantiate();
|
||||||
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
|
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
|
||||||
PlayMusic("MainMenu");
|
PlayMusic("MainMenu");
|
||||||
|
|
||||||
// Load in saved data
|
// Load in saved data
|
||||||
|
//....?
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
@@ -49,28 +50,18 @@ public partial class CommonData : Node
|
|||||||
GlobalTimer = NumFramesElapsed / FPS;
|
GlobalTimer = NumFramesElapsed / FPS;
|
||||||
GlobalTimer = (float)Convert.ToDouble(GlobalTimer.ToString("0.##")); // Truncates seconds elapsed to hundreds place (0.00)
|
GlobalTimer = (float)Convert.ToDouble(GlobalTimer.ToString("0.##")); // Truncates seconds elapsed to hundreds place (0.00)
|
||||||
//GD.Print(GlobalTimer);
|
//GD.Print(GlobalTimer);
|
||||||
if (Input.IsActionJustPressed("quit_game")){GetTree().Quit();}
|
if (Input.IsActionJustPressed("quit_game")) GetTree().Quit();
|
||||||
|
|
||||||
if (Input.IsActionJustPressed("mute"))
|
if (Input.IsActionJustPressed("mute")){
|
||||||
{
|
Muted = ! Muted;
|
||||||
if (Muted)
|
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = (Muted) ? -80 : 0;
|
||||||
{
|
|
||||||
Muted = false;
|
|
||||||
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Muted = true;
|
|
||||||
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = -80;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BG Audio Management
|
// BG Audio Management
|
||||||
public void StopMusic(){GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stop();}// Stop whatever audio is playing\
|
public void StopMusic(){GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stop();}// Stop whatever audio is playing\
|
||||||
|
|
||||||
public void PlayMusic(string AudioName)
|
public void PlayMusic(string AudioName){
|
||||||
{
|
|
||||||
// Load target audio and play the audio
|
// Load target audio and play the audio
|
||||||
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stream = (Godot.AudioStream)GD.Load($"res://Assets/Audio/Music/{AudioName}.mp3");
|
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stream = (Godot.AudioStream)GD.Load($"res://Assets/Audio/Music/{AudioName}.mp3");
|
||||||
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Play();
|
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Play();
|
||||||
|
|||||||
@@ -10,14 +10,14 @@ public partial class IQEnemy : CharacterBody2D
|
|||||||
// Enemy Stats
|
// Enemy Stats
|
||||||
public int IQ;
|
public int IQ;
|
||||||
public float HP;
|
public float HP;
|
||||||
float MaxHP, RegenerationAmmount, RegenerationInterval, WalkSpeed, JumpHeight, JumpInterval, DetectionRange;
|
float MaxHP, RegenerationAmmount, RegenerationInterval, WalkSpeed, JumpHeight, JumpInterval, LungeInterval, DetectionRange;
|
||||||
|
|
||||||
// Enemy Conditions
|
// Enemy Conditions
|
||||||
bool GroundDetected, LedgeDetected, WallDetected, CanJump;
|
bool GroundDetected, LedgeDetected, WallDetected, CanJump, CanLunge;
|
||||||
String FacingDirection;
|
String FacingDirection;
|
||||||
|
|
||||||
// Enemy Abilities
|
// Enemy Abilities
|
||||||
bool AbilityJump, AbilityMove, AbilityAttack, AbilityDash, AbilityCloak, AbilityTeleport, AbilityRegenerate;
|
bool AbilityJump, AbilityMove, AbilityAttack, AbilityDash, AbilityLunge, AbilityCloak, AbilityTeleport, AbilityRegenerate;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
@@ -30,6 +30,8 @@ public partial class IQEnemy : CharacterBody2D
|
|||||||
else AbilityAttack = true;
|
else AbilityAttack = true;
|
||||||
if (HasMeta("AbilityDash")) AbilityDash = (bool)GetMeta("AbilityDash");
|
if (HasMeta("AbilityDash")) AbilityDash = (bool)GetMeta("AbilityDash");
|
||||||
else AbilityDash = false;
|
else AbilityDash = false;
|
||||||
|
if (HasMeta("AbilityLunge")) AbilityLunge = (bool)GetMeta("AbilityLunge");
|
||||||
|
else AbilityLunge = false;
|
||||||
if (HasMeta("AbilityCloak")) AbilityCloak = (bool)GetMeta("AbilityCloak");
|
if (HasMeta("AbilityCloak")) AbilityCloak = (bool)GetMeta("AbilityCloak");
|
||||||
else AbilityCloak = false;
|
else AbilityCloak = false;
|
||||||
if (HasMeta("AbilityTeleport")) AbilityTeleport = (bool)GetMeta("AbilityTeleport");
|
if (HasMeta("AbilityTeleport")) AbilityTeleport = (bool)GetMeta("AbilityTeleport");
|
||||||
@@ -46,6 +48,8 @@ public partial class IQEnemy : CharacterBody2D
|
|||||||
else JumpHeight = 250.0f;
|
else JumpHeight = 250.0f;
|
||||||
if (HasMeta("JumpInterval")) JumpInterval = (float)GetMeta("JumpInterval");
|
if (HasMeta("JumpInterval")) JumpInterval = (float)GetMeta("JumpInterval");
|
||||||
else JumpInterval = 1.0f;
|
else JumpInterval = 1.0f;
|
||||||
|
if (HasMeta("LungeInterval")) LungeInterval = (float)GetMeta("LungeInterval");
|
||||||
|
else LungeInterval = 1.0f;
|
||||||
if (HasMeta("DetectionRange")) DetectionRange = (float)GetMeta("DetectionRange");
|
if (HasMeta("DetectionRange")) DetectionRange = (float)GetMeta("DetectionRange");
|
||||||
else DetectionRange = 100.0f;
|
else DetectionRange = 100.0f;
|
||||||
JumpHeight *= -1;
|
JumpHeight *= -1;
|
||||||
@@ -68,6 +72,7 @@ public partial class IQEnemy : CharacterBody2D
|
|||||||
LedgeDetected = false;
|
LedgeDetected = false;
|
||||||
WallDetected = false;
|
WallDetected = false;
|
||||||
CanJump = AbilityJump;
|
CanJump = AbilityJump;
|
||||||
|
CanLunge = AbilityLunge;
|
||||||
|
|
||||||
// Apply IQ based permenant modifiers
|
// Apply IQ based permenant modifiers
|
||||||
IQ = (int)GetMeta("IQ"); // Read IQ
|
IQ = (int)GetMeta("IQ"); // Read IQ
|
||||||
@@ -89,6 +94,7 @@ public partial class IQEnemy : CharacterBody2D
|
|||||||
// Show current hp for testing purposes
|
// Show current hp for testing purposes
|
||||||
if (HasMeta("CurrentHP")) SetMeta("CurrentHP", HP);
|
if (HasMeta("CurrentHP")) SetMeta("CurrentHP", HP);
|
||||||
|
|
||||||
|
// Cooldowns
|
||||||
// Regenerate Health
|
// Regenerate Health
|
||||||
if (AbilityRegenerate){
|
if (AbilityRegenerate){
|
||||||
if (GlobalTimer % RegenerationInterval == 0) Regenerate(RegenerationAmmount);
|
if (GlobalTimer % RegenerationInterval == 0) Regenerate(RegenerationAmmount);
|
||||||
@@ -97,6 +103,10 @@ public partial class IQEnemy : CharacterBody2D
|
|||||||
if (AbilityJump){
|
if (AbilityJump){
|
||||||
if (GlobalTimer % JumpInterval == 0) CanJump = true;
|
if (GlobalTimer % JumpInterval == 0) CanJump = true;
|
||||||
}
|
}
|
||||||
|
// Lunge Cooldown
|
||||||
|
if (AbilityLunge){
|
||||||
|
if (GlobalTimer % LungeInterval == 0) CanLunge = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Movement
|
// Movement
|
||||||
// Add gravity.
|
// Add gravity.
|
||||||
@@ -133,6 +143,7 @@ public partial class IQEnemy : CharacterBody2D
|
|||||||
if (DistanceFromPlayerX > (30.0f / (IQ / 4))) if (VAH.Scale[0] > 0)Flip(); // left of player
|
if (DistanceFromPlayerX > (30.0f / (IQ / 4))) if (VAH.Scale[0] > 0)Flip(); // left of player
|
||||||
if (DistanceFromPlayerX < (-30.0f / (IQ / 4))) if (VAH.Scale[0] < 0)Flip(); // right of player
|
if (DistanceFromPlayerX < (-30.0f / (IQ / 4))) if (VAH.Scale[0] < 0)Flip(); // right of player
|
||||||
if (DistanceFromPlayerX < (-30.0f / (IQ / 4)) && GroundDetected && GlobalPosition[1] > CurrentLevel[2].GetNode<Node2D>("Player").GlobalPosition[1]) Jump(0.0f); // Jump when player is overhead
|
if (DistanceFromPlayerX < (-30.0f / (IQ / 4)) && GroundDetected && GlobalPosition[1] > CurrentLevel[2].GetNode<Node2D>("Player").GlobalPosition[1]) Jump(0.0f); // Jump when player is overhead
|
||||||
|
if (DistanceFromPlayerX > DetectionRange / 2.0f) Lunge(100.0f * VAH.Scale[0]);
|
||||||
} else{ // Patrol
|
} else{ // Patrol
|
||||||
if (WallDetected && GroundDetected && Velocity[1] > 0)Flip(); // Wall too high (flips when it lands on the ground in front of a wall)
|
if (WallDetected && GroundDetected && Velocity[1] > 0)Flip(); // Wall too high (flips when it lands on the ground in front of a wall)
|
||||||
}
|
}
|
||||||
@@ -175,6 +186,11 @@ public partial class IQEnemy : CharacterBody2D
|
|||||||
CanJump = false;}
|
CanJump = false;}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Lunge(float xMagnitude){
|
||||||
|
if (GroundDetected && CanLunge) {Velocity = new Vector2(Velocity[0] + xMagnitude, JumpHeight / 2.0f);
|
||||||
|
CanLunge = false;}
|
||||||
|
}
|
||||||
|
|
||||||
bool DetectsPlayer(){
|
bool DetectsPlayer(){
|
||||||
var CurrentLevel = GetTree().Root.GetChildren();
|
var CurrentLevel = GetTree().Root.GetChildren();
|
||||||
return (GlobalPosition.DistanceTo(CurrentLevel[2].GetNode<Node2D>("Player").GlobalPosition) <= DetectionRange) ? true : false;
|
return (GlobalPosition.DistanceTo(CurrentLevel[2].GetNode<Node2D>("Player").GlobalPosition) <= DetectionRange) ? true : false;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Godot.NET.Sdk/4.5.1">
|
<Project Sdk="Godot.NET.Sdk/4.6.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
|
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
|
||||||
|
|||||||
7
fracturepoint.csproj.old
Normal file
7
fracturepoint.csproj.old
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<Project Sdk="Godot.NET.Sdk/4.5.1">
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>
|
||||||
|
<EnableDynamicLoading>true</EnableDynamicLoading>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
@@ -8,11 +8,15 @@
|
|||||||
|
|
||||||
config_version=5
|
config_version=5
|
||||||
|
|
||||||
|
[animation]
|
||||||
|
|
||||||
|
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="fracturepoint"
|
config/name="fracturepoint"
|
||||||
run/main_scene="uid://bn5opy6atakg"
|
run/main_scene="uid://bn5opy6atakg"
|
||||||
config/features=PackedStringArray("4.5", "C#", "GL Compatibility")
|
config/features=PackedStringArray("4.6", "C#", "GL Compatibility")
|
||||||
run/max_fps=90
|
run/max_fps=90
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user