Constructor


Bullet(x: number, y: number, texture: (string|love.Image)?)

Arguments:

x: number
y: number
texture: (string|love.Image)?




Methods








Bullet:getGrazeTension()

Get the graze tension for this bullet. If this bullet doesn't specify graze tension, it'll use the attacker's default value. If that can't be found either, then it will be the default of 1.6.

@return tension — The tension to gain when this bullet is grazed.

Returns:

tension: number

The tension to gain when this bullet is grazed.





Bullet:isBullet(id: string)

Checks whether this bullet is an instance or extension of a specific bullet type, specified by id.

Arguments:

id: string

Returns:

1: boolean


Bullet:onCollide(soul: Soul)

(Override) Called when the bullet collides with the player's soul, before invulnerability checks.

Arguments:

soul: Soul

The Soul is the object the player controls in battle.
The Soul global stores the default (red) soul. Custom soul types can be created by extending this class in a new global (using a file in scripts/objects/ or scripts/globals/). The soul being used in battle is determined by Encounter:createSoul, and can be altered after the first DEFENDING stage with Battle:swapSoul().



Bullet:onDamage(soul: Soul)

(Override) Called when the bullet hits the player's soul without invulnerability frames.
Not calling super.onDamage() here will stop the normal damage logic from occurring.

Arguments:

soul: Soul

The Soul is the object the player controls in battle.
The Soul global stores the default (red) soul. Custom soul types can be created by extending this class in a new global (using a file in scripts/objects/ or scripts/globals/). The soul being used in battle is determined by Encounter:createSoul, and can be altered after the first DEFENDING stage with Battle:swapSoul().

Returns:

battlers_hit: table<PartyBattler>


Bullet:onGraze(first: boolean)

(Override) Called when the soul grazes a bullet.

@param first — Whether the bullet has been grazed before or not.

Arguments:

first: boolean

Whether the bullet has been grazed before or not.



Bullet:onWaveSpawn(wave: Wave)

Arguments:

wave: Wave

Waves are the bullet patterns that enemies use in battle.
Waves are defined in files in scripts/battle/waves/ and should extend this class.
Each wave is assigned an id that defaults to their filepath starting from scripts/battle/waves, unless an id is specified as an argument to Class().
Wave ids can be placed into an EnemyBattlers waves table, or Waves returned from EnemyBattler:selectWave() or Encounter:getNextWaves() to to be used in battle.
Multiple waves can run in a single defending turn, but if multiple attackers select the same wave only one instance is created; see Wave:getAttackers() for determining how many enemies are using a particular wave.



Bullet:setSprite(texture: (string|love.Image)?, speed: number?, loop: boolean?, on_finished: fun( any)?)

@param texture — The new texture or path to the texture to set on the sprite (Removes the bullet's sprite if undefined)

@param speed — The time between frames of the sprite, in seconds (Defaults to 1/30th second)

@param loop — Whether the sprite should continuously loop. (Defaults to true)

@param on_finished — A function that is called when the animation finishes.

Arguments:

texture: (string|love.Image)?

The new texture or path to the texture to set on the sprite (Removes the bullet's sprite if undefined)

speed: number?

The time between frames of the sprite, in seconds (Defaults to 1/30th second)

loop: boolean?

Whether the sprite should continuously loop. (Defaults to true)

on_finished: fun( any)?

A function that is called when the animation finishes.

Returns:

1: Sprite?





Fields


Bullet.attacker: EnemyBattler

The attacker that owns the wave which created this bullet. Not defined until after Bullet:init().










Bullet.wave: Wave

The wave that this bullet was created by. Not defined until after Bullet:init().



Undocumented



Bullet.can_graze: boolean

Whether you can graze this bullet or not.