Animation (class)
Jump to navigation
Jump to search
Note: "Effect" class is an ailas of "Animation" in SMBX2 Beta 4 or later.
This class provides fields/functions for managing animations/effects in the current level.
Static functions
| Static Animation Functions | ||
|---|---|---|
| Function | Return values | Description |
| Animation.count() | number | How many effects are in the level. |
| Animation.get() | table of Animation | Returns all running effects. |
| Animation.get(number or table ids) | table of Animation | Returns all running effects with the matching ids. Only running effects with the same id given by ids will be returned. |
| Animation.getIntersecting(number x1, number y1, number x2, number y2) | table of Animation | Returns all effects which are intersecting with an area from x1/y1 to x2/y2. |
| Animation.spawn(number effectID, number x, number y) | Animation | Runs/Starts a new effect.) |
| Animation.spawn(number effectID, number x, number y, number variant) | Animation | Runs/Starts a new effect. variant is choosen effect variant (some effects have various version of a effect). |
| Animation(number index) | Animation | Returns the Animation object at position index in the global Animation table. Use this constructor with caution! Use Animation.get or Animation.getIntersecting instead!! (See above) |
Instance functions
These fields and functions are part of Animation Objects and have to be called for that object. Trying to call them from the static Animation class will result in an error. Example (feel free to copy it into your lua file to see how it works):
function onTick()
for index,myAnimation in ipairs(Animation.get()) do
myAnimation.id = 2
end
end
| Animation class | |||
|---|---|---|---|
| Type | Function/Field | Return values/Value type | Description |
| Function | Animation:mem(int offset, int fieldtype, object value) | nil | Sets a value of the Animation struct at a specific address-offset. |
| Function | Animation:mem(int offset, int fieldtype) | object | Returns a value of the Animation struct at a specific address-offset. |
| Field | Animation.x | double | The x coordinate of the animation. |
| Field | Animation.y | double | The y coordinate of the animation. |
| Field | Animation.speedX | double | The x-speed of the animation. |
| Field | Animation.speedY | double | The y-speed of the animation. |
| Field | Animation.id | int | The animation-id of the animation. |
| Field | Animation.width | int | The width of the animation. |
| Field | Animation.height | int | The height of the animation. |
| Field | Animation.subTimer | int | The sub-timer. Some effects use it in addition to the normal timer. If modifying "Animation.timer" doesn't work you may need to modify this value too. |
| Field | Animation.timer | int | The timer (frames until finished) of the animation. |
| Field | Animation.animationFrame | int | The current animation frame. |
| Field | Animation.npcID | int | The npcID for effects like yoshis egg. |
| Field | Animation.drawOnlyMask | boolean | If true, then only the mask will be drawn. |
Offsets
(Section under construction!)
| Animation Memory (0x__ bytes) | |||
|---|---|---|---|
| Name | Memory address | Memory type | Description |
| Unknown | Animation+0x00 | FIELD_WORD | Unknown |
| Unknown | Animation+0x02 | FIELD_WORD | Unknown |