Skip to main content

BulletDef

Description:

  A record type that specifies the properties and behaviors of a bullet object in the game.

Class Object: Platformer.BulletDef Class.

Inherits from: Object.

tag

Type: Field.

Description:

  The tag for the bullet object.

Signature:

tag: string

endEffect

Type: Field.

Description:

  The effect that occurs when the bullet object ends its life.

Signature:

endEffect: string

lifeTime

Type: Field.

Description:

  The amount of time in seconds that the bullet object remains active.

Signature:

lifeTime: number

damageRadius

Type: Field.

Description:

  The radius of the bullet object's damage area.

Signature:

damageRadius: number

highSpeedFix

Type: Field.

Description:

  Whether the bullet object should be fixed for high speeds.

Signature:

highSpeedFix: boolean

gravity

Type: Field.

Description:

  The gravity vector that applies to the bullet object.

Signature:

gravity: Vec2

face

Type: Field.

Description:

  The visual item of the bullet object.

Signature:

face: Face

bodyDef

Type: Readonly Field.

Description:

  The physics body definition for the bullet object.

Signature:

const bodyDef: BodyDef

velocity

Type: Readonly Field.

Description:

  The velocity vector of the bullet object.

Signature:

const velocity: Vec2

setAsCircle

Type: Function.

Description:

  Sets the bullet object's physics body as a circle.

Signature:

setAsCircle: function(self: BulletDef, radius: number)

Parameters:

ParameterTypeDescription
radiusnumberThe radius of the circle.

setVelocity

Type: Function.

Description:

  Sets the velocity of the bullet object.

Signature:

setVelocity: function(self: BulletDef, angle: number, speed: number)

Parameters:

ParameterTypeDescription
anglenumberThe angle of the velocity in degree.
speednumberThe speed of the velocity.