Entityο
Inherits: CharacterBody2D < PhysicsBody2D < CollisionObject2D < Node2D < CanvasItem < Node < Object
Inherited By: DynamicEntity
Base Class for all 2D Entities. It contains character stats and meta data.
Handles core logic including:
Gravity
Face Direction (and a fixed Container for RayCasts)
Hitpoints
Movement
Animation Control
Basic Audio
Propertiesο
|
||
|
||
|
||
|
||
|
||
|
||
|
Methodsο
void |
|
void |
_ready() |
void |
_physics_process(delta: float) |
void |
flip() |
void |
quick_pause(duration: float = 0.3) |
void |
|
void |
|
void |
kill() |
void |
|
void |
_die() |
anim_exists(animation: String) |
|
check_anim(animation: String) |
|
check_frame(animation: String, frame: int) |
|
check_anim_end(animation: String) |
|
void |
await_frame(animation: String, frame: int) |
void |
await_anim_end(animation: String) |
void |
start_anim(animation: String, force: bool = false) |
void |
force_anim(animation: String) |
Signalsο
Emited when the character is spawned
moved(dir: float, run: bool) π
Emited when the character walks or runs
jumped() π
Emitted when the character jumps
Emitted when the character is damaged
died() π
Emitted when the character dies
Enumerationsο
enum character_type: π
character_type Hero = 0
Hero Character
character_type Ally = 1
Ally of the Hero Character
character_type Civillian = 2
Neutral Character
character_type Enemy = 3
Minions of the Enemy Boss
character_type Boss = 4
Enemy Boss
enum attack_type: π
attack_type None = 0
Cannot Attack
attack_type Melee = 1
Uses Melee attacks mainly
attack_type Projectile = 2
Uses Projectile attacks mainly
Property Descriptionsο
A Picture of the Character
Useful for creating character cards and HUD icons
Name of the Character
Useful for creating character cards, HUD and character selector
character_type type π
Type of Entity the character is
Useful for creating character cards
attack_type attack π
Type of Attack the character mainly uses
Useful for creating character cards
Max HP that the character will have
The walking speed of the character
The running speed of the character
The upwards velocity at which the character jumps
The attack range of the character
Useful for creating character cards
float Acceleration = 1000.0 π
Rate of change of Velocity
A Bool to disable gravity for this character
A Bool to disable characterβs built-in AI
CollisionShape2D collider π
A Reference to the CollisionShape2D of the character
Animation Name for Walking
Anmiation Name for Running
Animation Name for Jumping
Animation Name for Hurting
Animation Name for Dying
Array ANM_N_auto_pause_movement π
A list of names of all animations that will automatically pause the characters movement
AnimatedSprite2D ANM_P_Animated_Sprite π
A Reference to the AnimatedSprite2D of the character
AnimationPlayer ANM_P_Animation_Player π
A Reference to the AnimationPlayer of the character
AnimationTree ANM_P_Animation_Tree π
A Reference to the AnimationTree of the character
AudioStreamPlayer2D SFX_Spawn π
A Reference to the AudioStreamPlayer2D to play when the character spawns
AudioStreamPlayer2D SFX_Walk π
A Reference to the AudioStreamPlayer2D to play when the character walks
AudioStreamPlayer2D SFX_Run π
A Reference to the AudioStreamPlayer2D to play when the character runs
AudioStreamPlayer2D SFX_Jump π
A Reference to the AudioStreamPlayer2D to play when the character jumps
AudioStreamPlayer2D SFX_Hurt π
A Reference to the AudioStreamPlayer2D to play when the character is hurt
AudioStreamPlayer2D SFX_Die π
A Reference to the AudioStreamPlayer2D to play when the character dies
bool show_warnings = true π
Enable/Disable Warnings for missing Nodes
Current HP of the character
A Node2D which always faces right regardless of the characterβs position or rotation
This is intended to be used as a container for RayCasts which need to be independant
The direction the character is facing
A Boolean to forcefully pause character movement
A float to store the velocity applied due to move()
Method Descriptionsο
void check_nodes() π
Checks for missing node references/paths
void _ready() π
There is currently no description for this method. Please help us by contributing one!
void _physics_process(delta: float) π
There is currently no description for this method. Please help us by contributing one!
void flip() π
Changes the direction the character is currently facing
Checks whether or not movement should be paused at the current moment
void quick_pause(duration: float = 0.3) π
Temporarily forces a pause on character movement
void move(x_dir: float, run: bool = false) π
Used to move the character by making it walk/run
void jump(force: float = Jump_Velocity) π
Makes the character jump
void kill() π
Instantly kills the characters
void damage(amount: float) π
Applies damage to the character
void _die() π
Procedure for when the character dies
bool anim_exists(animation: String) π
Checks if an animation is available
bool check_anim(animation: String) π
Checks if an animation is currently playing
bool check_frame(animation: String, frame: int) π
Checks if a certain frame is currently playing
bool check_anim_end(animation: String) π
Checks if an animation is currently at itβs last frame
void await_frame(animation: String, frame: int) π
Waits until a certain frame starts playing
void await_anim_end(animation: String) π
Waits until a certain animation ends
void start_anim(animation: String, force: bool = false) π
Triggers a travel to an animation or forcefully jumps to it
void force_anim(animation: String) π
Forcefully starts an animation and waits till the end