Methods
Soul:doMovement()
Called every frame from within Soul:update()
if the soul is able to move.
Movement for the soul based on player input should be controlled within this method.
Soul:getExactPosition(x: number, y: number)
Gets the soul's exact position (including the fractional part)
The soul's x
and y
values are truncated so this must be used for the soul's exact position
Arguments:
x: number | |
y: number |
Returns:
exact_x: number | |
exact_y: number |
Soul:move(x: number?, y: number?, speed: number?)
Moves the soul by x
and y
, accounting for collision in the soul's movement path
@param speed
— An optional multiplier to the amount of x
and y
that the soul moves by.
@return moved
— Whether the soul moved from its previous position
@return collided
— Whether the soul collided with something on its movement path
Arguments:
x: number? | |
y: number? | |
speed: number? | An optional multiplier to the amount of |
Returns:
moved: boolean | Whether the soul moved from its previous position |
collided: boolean | Whether the soul collided with something on its movement path |
Soul:moveX(amount: number, move_y: number)
(Used internally) Performs collision abiding movement of the soul along the x-axis
Arguments:
amount: number | |
move_y: number |
Returns:
1: boolean | |
2: boolean? |
Soul:moveXExact(amount: number, move_y: number)
(Used internally) Performs collision abiding movement of the soul on the x-axis
Arguments:
amount: number | |
move_y: number |
Returns:
1: boolean | |
2: Arena|nil |
Soul:moveY(amount: number, move_x: number)
(Used internally) Performs collision abiding movement of the soul along the y-axis
Arguments:
amount: number | |
move_x: number |
Returns:
1: boolean | |
2: boolean? |
Soul:moveYExact(amount: number, move_x: number)
(Used internally) Performs collision abiding movment of the soul on the y-axis
Arguments:
amount: number | |
move_x: number |
Returns:
1: boolean | |
2: Arena|nil |
Soul:onCollide(bullet: Bullet)
(Override) Called when the soul collides with a bullet and before taking damage
By default, this function is responsible for calling the bullet's collision check, Bullet:onCollide()
Arguments:
bullet: Bullet | The class that all Battle bullets in Kristal originate from. |
Soul:onDamage(bullet: Bullet, amount: integer)
(Override) Called when the soul takes damage
Arguments:
bullet: Bullet | The class that all Battle bullets in Kristal originate from. |
amount: integer |
Soul:onGraze(bullet: Bullet, old_graze: boolean)
(Override) Called when the soul grazes something.
Arguments:
bullet: Bullet | The class that all Battle bullets in Kristal originate from. |
old_graze: boolean |
Soul:onRemove(parent: Object)
Arguments:
parent: Object | The base class of all objects in Kristal. |
Soul:onSquished(solid: Solid)
(Override) Called when the soul is squished between two solids
By default, this function is responsible for calling the solid's Solid:onSquished
Arguments:
solid: Solid | An object that can be spawned in waves using |
Soul:onWaveStart()
(Override) Called when waves are started
Soul:setExactPosition(x: number, y: number)
Sets the soul's exact position (including a fractional part)
Arguments:
x: number | |
y: number |
Soul:shatter(count: integer)
Shatters the soul into several shards
The position of the shards are controlled by shard_x_table
and shard_y_table
@param count
— The number of shards that the soul should shatter into.
Arguments:
count: integer | The number of shards that the soul should shatter into. |
Soul:transitionTo(x: number, y: number, should_destroy: boolean?)
@param x
— x-coordinate of the end point of the transition
@param y
— y-coordinate of the end point of the transition
@param should_destroy
— Whether the soul should be removed during this transition
Arguments:
x: number | x-coordinate of the end point of the transition |
y: number | y-coordinate of the end point of the transition |
should_destroy: boolean? | Whether the soul should be removed during this transition |
Fields
Soul.allow_focus: boolean
Whether the player is able to focus with the soul (hold Cancel key for 1/2 speed)
Soul.can_move: boolean
Whether the player is able to move the soul
Soul.collider: CircleCollider
The Soul's collider, defaulting to a circle with an 8 pixel radius
Soul.graze_collider: CircleCollider
The Soul's collider for grazing, defaulting to a circle with a 25 pixel radius (before being altered by graze_size_factor
)
Soul.graze_sprite: GrazeSprite
The Soul's GrazeSprite
object instance
Soul.graze_time_factor: number
A multiplier for the wave time depleted from grazing by the soul (Defaults to 1
, plus the sum of all party members effective graze_time
stats, capped at 3
)
Soul.graze_tp_factor: number
A multiplier for the TP earned from grazing by the soul (Defaults to 1
, plus the sum of all party members effective graze_tp
stats, capped at 3
)
Soul.grze_size_factor: number
A multiplier for the size of the soul's graze hitbox (Defaults to 1
, plus the sum of all party members effective graze_size
stats, capped at 3
)
Soul.height: number
The height of the soul, in pixels
Soul.inv_flash_timer: number
(Used internally) A timer for the flashing of the soul when invulnerable
Soul.inv_timer: number
The remaining invulnerability time for the soul
Soul.last_collided_x: boolean|number
The direction (+/-)
the soul moved and collided with an object last frame on the x-axis (false
when the soul has not moved, 0
when there is no collision)
Soul.last_collided_y: boolean|number
The direction (+/-)
the soul moved and collided with an object last frame on the y-axis (false
when the soul has not moved, 0
when there is no collision)
Soul.moving_x: number
The x
value the soul is moving by
Soul.moving_y: number
The y
value the soul is moving by
Soul.noclip: boolean
Whether the solid has noclip (collision bypass)
Soul.original_x: number?
(Used internally) The x-coordinate of the soul at the start of a transition
Soul.original_y: number?
(Used internally) The y-coordinate of the soul at the start of a transition
Soul.partial_x: number
(Used internally) Stores the fractional part of the soul's x-coordinate
Soul.partial_y: number
(Used internally) Stores the fractional part of the soul's y-coordinate
Soul.slope_correction: boolean
Whether the soul should push up and down slopes when colliding with them
Soul.speed: number
The speed of the soul, in pixels per frame at 30FPS (defaults to 4
)
Soul.sprite: Sprite
The Soul's Sprite
objcet instance
Soul.target_alpha: number?
The target alpha of the soul
Soul.target_x: number?
(Used internally) The x-coordinate the soul is transitioning towards
Soul.target_y: number?
(Used internally) The y-coordinate the soul is transitioning towards
Soul.timer: number
(Used internally) A timer variable for the soul transition
Soul.transition_destroy: boolean
(Used internally) Whether the soul should be removed by an upcoming transition
Soul.transitioning: boolean
Whether the soul is currently in a transition
Soul.width: number
The width of the soul, in pixels