Class Fz2D.Entity

Defined in: src/scene/objects/entity.coffee
Inherits: Fz2D.Object

Overview

Public: Entity

Subclasses

Fz2D.Gui.Button, Fz2D.Gui.Checkbox, Fz2D.Gui.Mouse

Instance Method Summary

Inherited Method Summary

Methods inherited from Fz2D.Object

.constructor, .kill, .reset, .show, .hide, .draw, .update

Constructor Details

::constructor(texture, x, y, w, h) Source

Public: Constructor. texture - Fz2D.Texture x - position on the X axis y - position on the Y axis w - width (default: width of Fz2D.Texture h - height (default: height of Fz2D.Texture

Parameters:

  • (Fz2D.Texture) textureFz2D.Texture
  • xposition on the X axis
  • yposition on the Y axis
  • (Fz2D.Texture) wwidth (default: width of Fz2D.Texture
  • (Fz2D.Texture) hheight (default: height of Fz2D.Texture

Instance Method Details

::active() Source

Public: Returns the name of the active animation.

Fz2D.Animation ::addAnimation(tag, texture, count, delay) Source

Public: Adds an animation. tag - name of the animation texture - Fz2D.Texture count - number of frames (default: 1) delay - delay in miliseconds between each frame (default: 1000.0 / count) Returns a Fz2D.Animation.

Parameters:

  • tagname of the animation
  • (Fz2D.Texture) textureFz2D.Texture
  • countnumber of frames (default: 1)
  • delaydelay in miliseconds between each frame (default: 1000.0 / count)

Returns:

::draw(ctx) Source

Public: Draws entity on every frame. ctx - Fz2D.Canvas

Parameters:

::is(tag) Source

Public: Is active animation? tag - name of the animation Returns true if the current animation matches the given tag.

Parameters:

  • tagname of the animation

Returns:

  • Returns true if the current animation matches the given tag.

::isOutOfBounds() Source

Public: Returns true if the entity is out of bounds.

Fz2D.Animation ::play(tag, looped) Source

Public: Plays a given animation. tag - name of the animation looped - loop state (default: false) Returns a Fz2D.Animation.

Parameters:

  • tagname of the animation
  • loopedloop state (default: false)

Returns:

::stop() Source

Public: Stops the active animation. Returns a Fz2D.Animation.

::update(timer, input) Source

Public: Updates entity on every frame. timer - Fz2D.Timer input - Fz2D.Input

Parameters: