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

Texture2D

avatar

String

title

character_type

type

attack_type

attack

float

Hit_Points

float

Walk_Speed

float

Run_Speed

float

Jump_Velocity

float

Attack_Range

float

Acceleration

1000.0

bool

gravity

true

bool

puppet

false

CollisionShape2D

collider

String

ANM_N_Walk

String

ANM_N_Run

String

ANM_N_Jump

String

ANM_N_Hurt

String

ANM_N_Die

Array

ANM_N_auto_pause_movement

AnimatedSprite2D

ANM_P_Animated_Sprite

AnimationPlayer

ANM_P_Animation_Player

AnimationTree

ANM_P_Animation_Tree

AudioStreamPlayer2D

SFX_Spawn

AudioStreamPlayer2D

SFX_Walk

AudioStreamPlayer2D

SFX_Run

AudioStreamPlayer2D

SFX_Jump

AudioStreamPlayer2D

SFX_Hurt

AudioStreamPlayer2D

SFX_Die

bool

show_warnings

true

float

hp

Node2D

RayBox

int

facing

1

bool

force_pause

false

float

move_x

0.0

Methods

void

check_nodes()

void

_ready()

void

_physics_process(delta: float)

void

flip()

bool

pause_movement()

void

quick_pause(duration: float = 0.3)

void

move(x_dir: float, run: bool = false)

void

jump(force: float = Jump_Velocity)

void

kill()

void

damage(amount: float)

void

_die()

bool

anim_exists(animation: String)

bool

check_anim(animation: String)

bool

check_frame(animation: String, frame: int)

bool

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

spawned(Entity: Entity) πŸ”—

Emited when the character is spawned


moved(dir: float, run: bool) πŸ”—

Emited when the character walks or runs


jumped() πŸ”—

Emitted when the character jumps


hurt(amount: float) πŸ”—

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

Texture2D avatar πŸ”—

A Picture of the Character

Useful for creating character cards and HUD icons


String title πŸ”—

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


float Hit_Points πŸ”—

Max HP that the character will have


float Walk_Speed πŸ”—

The walking speed of the character


float Run_Speed πŸ”—

The running speed of the character


float Jump_Velocity πŸ”—

The upwards velocity at which the character jumps


float Attack_Range πŸ”—

The attack range of the character

Useful for creating character cards


float Acceleration = 1000.0 πŸ”—

Rate of change of Velocity


bool gravity = true πŸ”—

A Bool to disable gravity for this character


bool puppet = false πŸ”—

A Bool to disable character’s built-in AI


CollisionShape2D collider πŸ”—

A Reference to the CollisionShape2D of the character


String ANM_N_Walk πŸ”—

Animation Name for Walking


String ANM_N_Run πŸ”—

Anmiation Name for Running


String ANM_N_Jump πŸ”—

Animation Name for Jumping


String ANM_N_Hurt πŸ”—

Animation Name for Hurting


String ANM_N_Die πŸ”—

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


float hp πŸ”—

Current HP of the character


Node2D RayBox πŸ”—

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


int facing = 1 πŸ”—

The direction the character is facing


bool force_pause = false πŸ”—

A Boolean to forcefully pause character movement


float move_x = 0.0 πŸ”—

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


bool pause_movement() πŸ”—

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