Player (class)
Jump to navigation
Jump to search
This class provides fields/functions for managing Players in the current level.
| Player class | |||
|---|---|---|---|
| Type | Function/Field | Return values/Value type | Description |
| Constructor | myPlayer = Player() | Player | Construct a new Player-Object. This objects references to the first player. You might want to use the constants player and player2 (for the 2nd player) instead. |
| Constructor | myPlayer = Player(int internalIndex) | Player | Construct a new Player-Object. This object reference to the player given in internalIndex. 1 = first player, 2 = second player |
| function | Player:mem(int offset, int fieldtype, object value) | nil | Sets a value of the Player struct at a specific address-offset. |
| function | Player:mem(int offset, int fieldtype) | object | Returns a value of the Player struct at a specific address-offset. |
| function | Player:kill() | nil | Kills the player. |
| function | Player:harm() | nil | Harms the player. |
| Field | Player.x | double | The x coordinate of the player. |
| Field | Player.y | double | The y coordinate of the player. |
| Field | Player.speedX | double | The x-speed of the player. |
| Field | Player.speedY | double | The y-speed of the player. |
| Field (ro) | Player.screen | RECT | Returns the distances from the player's coordinates to the screen boundaries of player camera. Note that this means width is 'right' + 'left', and not 'right' - 'left', etc. |
| Field (ro) | Player.section | int | Returns the current section number of the player. |
| Field (ro) | Player.sectionObj | Section | Returns the current section object of the player. |
| Field | powerup | int | The current powerup state the player is in. |
| Field | reservePowerup | int | The npc-id in the powerup box of the player. |
| Field (ro) | holdingNPC | NPC or nil | The npc which the player is holding. If the player holds nothing then nil is returned. |
| Field (ro) | isValid | boolean | Checks if the player is acutally valid. With this method you can check if a second player is in the level. |
There are also raw fields. These fields are not maintained and not camel-case affected!