Class l2df.class.component.frames

Last updated 2021-05-28 15:24:22

Frames component.

Inherited from l2df.class.Component class.

Info:

Functions

Frames:added(obj[, kwargs]) Component was added to Entity event.
Frames:removed(obj) Component was removed from Entity event.
Frames:add(obj, frame, id) Add new frame with specified id.
Frames:stats(obj) Get statistical information.
Frames:set(obj, id[, counter=0]) Change current frame.
Frames:preupdate(obj, dt) Frames pre-update event handler.

Tables

Frame Table describing <frame> structure.

Fields

Frames.data.counter Current frame's counter (in milliseconds).


Functions

Methods
Frames:added(obj[, kwargs])
Component was added to Entity event. Adds "frames" key to the Entity.C table.

Parameters:

Frames:removed(obj)
Component was removed from Entity event. Removes "frames" key from Entity.C table.

Parameters:

Frames:add(obj, frame, id)
Add new frame with specified id.

Parameters:

Frames:stats(obj)
Get statistical information. Mostly used for debug purposes.

Parameters:

Returns:

  1. number Total frames count.
  2. number Current frame's wait time.
  3. number Current frame's ID.
  4. number or string Next frame's ID / name.
  5. Frames.data.counter Current frame's counter.
Frames:set(obj, id[, counter=0])
Change current frame.

Parameters:

Frames:preupdate(obj, dt)
Frames pre-update event handler.

Parameters:

  • obj l2df.class.entity Entity's instance.
  • dt number Delta-time since last game tick.

Tables

Frame
Table describing <frame> structure.

Fields:

  • id number Frame's main identifier. Should be unique.
  • keyword string Frame's string identifier used for easy and transparent coding process. Should be unique. (optional)
  • next number or string ID / name of the frame to switch to automatically. (optional)
  • wait number Number of the milliseconds to wait for switching to the next frame. (default 0)
  • ... There're may be any amount of the <key:value> pairs. All of them would be copied to the entity's data from the current frame with call to Frames:preupdate().

Fields

Frames.data.counter number
Current frame's counter (in milliseconds). Used for switching frames automatically. To access use Frames:data() function.