Reference Source Test
public class | source

Projectile

Extends:

Entity → Projectile

This os an object type of Entity

Constructor Summary

Public Constructor
public

constructor(id: Number, kind: String, owner: Entity, name: String)

Default constructor

Member Summary

Public Members
public

Angle of the projectile

public

X coordinate destination

public

Y coordinate destination

public

If this is a dynamic projectile

public

Callback function for impact

public

Name of the projectile

public

Owner of this projectile

public

Path of the projectile

public

If this is a special projectile

public

Speed of the projectile

public

X coordinate start position

public

Y coordinate start position

public

If this is a static projectile

Method Summary

Public Methods
public

Return the ID

public

Gets the speed of the projectile

public

Return if this has a path

public

impact()

Check if this has made an impact

public

onImpact(callback: Function)

Set the impact callback

public

Set the projectile destination

public

Set the starting point for the projectile

public

Set the target for the projectile

public

Update the angle of the projectile

public

Update the target location

Inherited Summary

From class Entity
public

Angle of the entity

public

[angled description]

public

Animations for the sprite

public

Timeout function for blinking

public

Count down time

public

Current counter

public

Critical health

public

Current animation the sprite should be playing

public

Set if the entity is dirty

public

Callback for when the entity is dirty

public

Whether or not this is fading

public

Fading time

public

Grid X position

public

Grid Y position

public

Handler for the entity

public

Has a counter

public

Hurt sprite name

public

Entity id

public

Label for the entity

public

Name of the entity

public

Non pathable

public

Normal sprite name

public

Path

public

CAllback function when the entity is ready

public

Rendering data

public

Has a shadow

public

Offset for the shadow on the Y axis

public

Sprite

public

Whether or not to flip the sprite on the X axis

public

Whether or not to flip the sprite on the Y axis

public

Whether or not the sprite has been loaded

public

Stunned status

public

Terror status

public

Wehther or not this entity is visible

public

X coordinate

public

Y coordinate

public

blink(speed: Number)

Tell this entity to start blinking

public

fadeIn(time: Number)

Tell this to fade in given the duration

public

Look for an animtions list for this specific animation given it's name

public

Get the distance from this entity to the given x,y coordinates

public

Get the distance from this entity to another entity

public

Returns the name of the sprite

public

Check if this entity currently has a path

public

Check whether or not this entity has a shadow

public

Returns the instance of the weapon this entity has

public

Figure out if this entity is within the attack radius of the given entity

public

Figure out if this entity is within the extended attack radius of the given entity

public

isPositionAdjacent(x: Number, y: Number, ignoreDiagonals: Boolean): Boolean

Checks to see if the x,y coordinate is adjacent to the entity's current position

public

Check whether or not this entity is visible

public

This is important for when the client is on a mobile screen.

public

onDirty(callback: Function)

When this entity's is dirty (mobile) use this callback

public

onReady(callback: Function)

When this entity's sprite is loaded trigger this callback

public

setAnimation(name: String, speed: Number, count: Number, onEndCount: Number)

Set the animation on this entity

public

Set the count for the count down time

public

Set the x,y position of the entity on the tile grid

public

setName(name: String)

Set the entity's name

public

setPosition(x: Number, y: [type])

Set the x,y position for the entity

public

setSprite(sprite: Sprite)

Set the sprite for this entity

public

setVisible(visible: Boolean)

Set the visibility on this entity

public

Tell the entity to stop blinking and force it to be visible

public

Toggle the current visibility of this entity

Public Constructors

public constructor(id: Number, kind: String, owner: Entity, name: String) source

Default constructor

Override:

Entity#constructor

Params:

NameTypeAttributeDescription
id Number

entity id number

kind String

type of projectile

owner Entity

who owns this projectile

name String

name of the projectile

Public Members

public angle: Number source

Angle of the projectile

Override:

Entity#angle

public destX: Number source

X coordinate destination

public destY: Number source

Y coordinate destination

public dynamic: Boolean source

If this is a dynamic projectile

public impactCallback: Function source

Callback function for impact

public name: String source

Name of the projectile

Override:

Entity#name

public owner: Entity source

Owner of this projectile

public path: Boolean source

Path of the projectile

Override:

Entity#path

public special: Number source

If this is a special projectile

public speed: Number source

Speed of the projectile

public startX: Number source

X coordinate start position

public startY: Number source

Y coordinate start position

public static: Boolean source

If this is a static projectile

Public Methods

public getId(): Number source

Return the ID

Return:

Number

public getSpeed(): Number source

Gets the speed of the projectile

Return:

Number

speed of the projectile

public hasPath(): Boolean source

Return if this has a path

Override:

Entity#hasPath

Return:

Boolean

public impact() source

Check if this has made an impact

public onImpact(callback: Function) source

Set the impact callback

Params:

NameTypeAttributeDescription
callback Function

what happens if the projectile hits

public setDestination(x: Number, y: Number) source

Set the projectile destination

Params:

NameTypeAttributeDescription
x Number

x coordinate

y Number

y coordinate

public setStart(x: Number, y: Number) source

Set the starting point for the projectile

Params:

NameTypeAttributeDescription
x Number

x coordinate

y Number

y coordinate

public setTarget(target: Entity): Boolean source

Set the target for the projectile

Params:

NameTypeAttributeDescription
target Entity

the entity this is trying to hit

Return:

Boolean

public updateAngle() source

Update the angle of the projectile

public updateTarget(x: Number, y: Number) source

Update the target location

Params:

NameTypeAttributeDescription
x Number

x coordinate

y Number

y coordinate