Started work on new enemy system

This commit is contained in:
weedmjac000
2026-01-23 14:26:01 -07:00
parent 6f069b91a4
commit 582d276a00
3 changed files with 200 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
using Godot;
using System;
public partial class IQBasedEnemy : RigidBody2D
{
// Enemy Stats
public int IQ;
public float HP;
public float MaxHP;
// Enemy Conditions
float CurrentYVelocity;
float PreviousYVelocity;
public bool IsGrounded;
// Enemy Abilities
public override void _Ready()
{
IQ = (int)GetMeta("IQ"); // Read IQ
MaxHP = (float)GetMeta("MaxHP"); // Get Max HP
if (IQ >= 100)
MaxHP += 20;
HP = MaxHP;
CurrentYVelocity = 0f;
PreviousYVelocity = 0f;
IsGrounded = true;
}
public override void _Process(double delta)
{
// Ground Detection
CurrentYVelocity = LinearVelocity[1];
if (CurrentYVelocity == 0 && PreviousYVelocity == 0)
IsGrounded = true;
else
IsGrounded = false;
PreviousYVelocity = CurrentYVelocity;
}
}