API Docs for: 0.1.1
Show:

flatworld.objects.ObjectSpriteUnit Class

Extends ObjectSprite

Map unit like infantry or worker, usually something with actions or movable. Usually these are extended, depending on the map type. For example you might want to add some click area for these (e.g. hexagon)

Constructor

flatworld.objects.ObjectSpriteUnit

(
  • coords
  • data
)

Parameters:

  • coords Object

    Coordinates for the object relative to it's parent

    • x Integer

      X coordinate

    • y Integer

      Y coordinate

  • data Object

    This units data

Methods

addActionType

(
  • type
)

Add certain action type. @todo THIS HAS NOT BEEN IMPLEMENTED YET!

Parameters:

addCallbackToAction

(
  • type
  • cb
)

Attach callback for the certain action type. @todo THIS HAS NOT BEEN IMPLEMENTED YET!

Parameters:

doAction

(
  • type
)

Execute action on units (move, attack etc.). @todo THIS HAS NOT BEEN IMPLEMENTED YET!

Parameters:

dropShadow

()

Attributes

[name]

This is abstract method and needs to be implemented with a plugin. Core module has an implementation for this and if you don't implement your own, I suggest you use it. You can attach any method to object if you wish. Like attack, siege, greet, talk.

Fires event [name]Change

Fires when the value for the configuration attribute [name] is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.

actions

Object

actions bound to this object. @todo THIS HAS NOT BEEN IMPLEMENTED YET!

Fires event actionsChange

Fires when the value for the configuration attribute actions is changed. You can listen for the event using the on method if you wish to be notified before the attribute's value has changed, or using the after method if you wish to be notified after the attribute's value has changed.

Parameters:

  • e EventFacade
    An Event Facade object with the following attribute-specific properties added:
    • prevVal Any
      The value of the attribute, prior to it being set.
    • newVal Any
      The value the attribute is to be set to.
    • attrName String
      The name of the attribute being set.
    • subAttrName String
      If setting a property within the attribute's value, the name of the sub-attribute property being set.