Compare commits

..

3 Commits

Author SHA1 Message Date
Jojackman1
9382d3f3a5 Added Lunge Mechanic 2026-01-29 08:22:48 -07:00
Jojackman1
30f564323a Reorganised filesystem 2026-01-29 07:40:37 -07:00
Jojackman1
1c4f90fa96 Optimized common data 2026-01-29 06:36:26 -07:00
8 changed files with 81 additions and 66 deletions

File diff suppressed because one or more lines are too long

View File

@@ -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"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_41iyt"]
@@ -128,21 +128,22 @@ animations = [{
[sub_resource type="RectangleShape2D" id="RectangleShape2D_bc7hl"]
[node name="IQEnemy" type="CharacterBody2D"]
[node name="IQEnemy" type="CharacterBody2D" unique_id=240625765]
collision_layer = 8
collision_mask = 3
script = ExtResource("1_p53ib")
metadata/IQ = 20
metadata/AbilityRegenerate = true
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)
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)
scale = Vector2(0.99999994, 0.99999994)
sprite_frames = SubResource("SpriteFrames_rqn21")
@@ -150,28 +151,28 @@ autoplay = "default"
frame = 1
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)
scale = Vector2(0.099999994, 0.099999994)
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)
scale = Vector2(0.99999994, 0.99999994)
shape = SubResource("RectangleShape2D_bc7hl")
[node name="LedgeDetector" type="Area2D" parent="VisualsAndHitboxes"]
[node name="LedgeDetector" type="Area2D" parent="VisualsAndHitboxes" unique_id=1421687086]
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)
scale = Vector2(0.1, 0.1)
shape = SubResource("RectangleShape2D_bc7hl")
[node name="WallDetector" type="Area2D" parent="VisualsAndHitboxes"]
[node name="WallDetector" type="Area2D" parent="VisualsAndHitboxes" unique_id=1085104067]
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)
scale = Vector2(0.1, 0.1)
shape = SubResource("RectangleShape2D_bc7hl")

View File

@@ -14,7 +14,7 @@ public partial class CommonData : Node
// Level information
public string CurrentLevel;
// Player information
// Player stats
public float CurrentHealth;
public float MaxHealth = 100;
@@ -33,13 +33,14 @@ public partial class CommonData : Node
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
// Start game by loading the main menu
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/MenusAndLevels/MainMenu.tscn");
scene = GD.Load<PackedScene>("res://Assets/Scenes/DEVSCENES/EnemyTest.tscn");
inst = scene.Instantiate();
GetTree().Root.CallDeferred(Node.MethodName.AddChild, inst);
PlayMusic("MainMenu");
// Load in saved data
//....?
}
public override void _Process(double delta)
@@ -49,28 +50,18 @@ public partial class CommonData : Node
GlobalTimer = NumFramesElapsed / FPS;
GlobalTimer = (float)Convert.ToDouble(GlobalTimer.ToString("0.##")); // Truncates seconds elapsed to hundreds place (0.00)
//GD.Print(GlobalTimer);
if (Input.IsActionJustPressed("quit_game")){GetTree().Quit();}
if (Input.IsActionJustPressed("quit_game")) GetTree().Quit();
if (Input.IsActionJustPressed("mute"))
{
if (Muted)
{
Muted = false;
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = 0;
}
else
{
Muted = true;
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = -80;
}
if (Input.IsActionJustPressed("mute")){
Muted = ! Muted;
GetNode<AudioStreamPlayer>("AudioStreamPlayer").VolumeDb = (Muted) ? -80 : 0;
}
}
// BG Audio Management
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
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Stream = (Godot.AudioStream)GD.Load($"res://Assets/Audio/Music/{AudioName}.mp3");
GetNode<AudioStreamPlayer>("AudioStreamPlayer").Play();

View File

@@ -10,14 +10,14 @@ public partial class IQEnemy : CharacterBody2D
// Enemy Stats
public int IQ;
public float HP;
float MaxHP, RegenerationAmmount, RegenerationInterval, WalkSpeed, JumpHeight, JumpInterval, DetectionRange;
float MaxHP, RegenerationAmmount, RegenerationInterval, WalkSpeed, JumpHeight, JumpInterval, LungeInterval, DetectionRange;
// Enemy Conditions
bool GroundDetected, LedgeDetected, WallDetected, CanJump;
bool GroundDetected, LedgeDetected, WallDetected, CanJump, CanLunge;
String FacingDirection;
// Enemy Abilities
bool AbilityJump, AbilityMove, AbilityAttack, AbilityDash, AbilityCloak, AbilityTeleport, AbilityRegenerate;
bool AbilityJump, AbilityMove, AbilityAttack, AbilityDash, AbilityLunge, AbilityCloak, AbilityTeleport, AbilityRegenerate;
public override void _Ready()
{
@@ -30,6 +30,8 @@ public partial class IQEnemy : CharacterBody2D
else AbilityAttack = true;
if (HasMeta("AbilityDash")) AbilityDash = (bool)GetMeta("AbilityDash");
else AbilityDash = false;
if (HasMeta("AbilityLunge")) AbilityLunge = (bool)GetMeta("AbilityLunge");
else AbilityLunge = false;
if (HasMeta("AbilityCloak")) AbilityCloak = (bool)GetMeta("AbilityCloak");
else AbilityCloak = false;
if (HasMeta("AbilityTeleport")) AbilityTeleport = (bool)GetMeta("AbilityTeleport");
@@ -46,6 +48,8 @@ public partial class IQEnemy : CharacterBody2D
else JumpHeight = 250.0f;
if (HasMeta("JumpInterval")) JumpInterval = (float)GetMeta("JumpInterval");
else JumpInterval = 1.0f;
if (HasMeta("LungeInterval")) LungeInterval = (float)GetMeta("LungeInterval");
else LungeInterval = 1.0f;
if (HasMeta("DetectionRange")) DetectionRange = (float)GetMeta("DetectionRange");
else DetectionRange = 100.0f;
JumpHeight *= -1;
@@ -68,6 +72,7 @@ public partial class IQEnemy : CharacterBody2D
LedgeDetected = false;
WallDetected = false;
CanJump = AbilityJump;
CanLunge = AbilityLunge;
// Apply IQ based permenant modifiers
IQ = (int)GetMeta("IQ"); // Read IQ
@@ -89,6 +94,7 @@ public partial class IQEnemy : CharacterBody2D
// Show current hp for testing purposes
if (HasMeta("CurrentHP")) SetMeta("CurrentHP", HP);
// Cooldowns
// Regenerate Health
if (AbilityRegenerate){
if (GlobalTimer % RegenerationInterval == 0) Regenerate(RegenerationAmmount);
@@ -97,6 +103,10 @@ public partial class IQEnemy : CharacterBody2D
if (AbilityJump){
if (GlobalTimer % JumpInterval == 0) CanJump = true;
}
// Lunge Cooldown
if (AbilityLunge){
if (GlobalTimer % LungeInterval == 0) CanLunge = true;
}
// Movement
// 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(); // 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 > DetectionRange / 2.0f) Lunge(100.0f * VAH.Scale[0]);
} else{ // Patrol
if (WallDetected && GroundDetected && Velocity[1] > 0)Flip(); // Wall too high (flips when it lands on the ground in front of a wall)
}
@@ -174,6 +185,11 @@ public partial class IQEnemy : CharacterBody2D
if (GroundDetected && CanJump) {Velocity = new Vector2(Velocity[0] + xMagnitude, JumpHeight);
CanJump = false;}
}
void Lunge(float xMagnitude){
if (GroundDetected && CanLunge) {Velocity = new Vector2(Velocity[0] + xMagnitude, JumpHeight / 2.0f);
CanLunge = false;}
}
bool DetectsPlayer(){
var CurrentLevel = GetTree().Root.GetChildren();

View File

@@ -1,4 +1,4 @@
<Project Sdk="Godot.NET.Sdk/4.5.1">
<Project Sdk="Godot.NET.Sdk/4.6.0">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net9.0</TargetFramework>

7
fracturepoint.csproj.old Normal file
View 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>

View File

@@ -8,11 +8,15 @@
config_version=5
[animation]
compatibility/default_parent_skeleton_in_mesh_instance_3d=true
[application]
config/name="fracturepoint"
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
config/icon="res://icon.svg"