jjPLAYER class JJ2+
A player in the level
Script view of one player: position and speed, health, lives, score, ammo and powerups, the current character, pressed keys, camera, timer and many state counters, plus actions such as warping, morphing or hurting. Positions are in pixels and durations in ticks, 70 ticks per second. Scripts get players from jjP, jjPlayers or jjLocalPlayers. The level script loader owns one instance per player and wraps the game's own player actor with it.
Functions
- bool activateBoss(bool activate = true)
- Activates the bosses of the level
- void cameraFreeze(float xPixel, float yPixel, bool centered, bool instant)
- Fixes the camera at the given position
- void cameraFreeze(bool xUnfreeze, float yPixel, bool centered, bool instant)
- Fixes the camera vertically
- void cameraFreeze(float xPixel, bool yUnfreeze, bool centered, bool instant)
- Fixes the camera horizontally
- void cameraFreeze(bool xUnfreeze, bool yUnfreeze, bool centered, bool instant)
- Releases or keeps each axis of the camera
- void cameraUnfreeze(bool instant = true)
- Lets the camera follow the player again
- bool doesCollide(const jjOBJ@ object, bool always = false) const partially supported
- Checks whether an object's sprite overlaps the player
- int extendInvincibility(int duration) partially supported
- Extends the player's invincibility
- int fireBullet(uint8 gun = 0, bool depleteAmmo = true, bool requireAmmo = true, DIRECTION::Dir direction = DIRECTION::CURRENT) partially supported
- Makes the player fire in a direction
- int fireBullet(uint8 gun, bool depleteAmmo, bool requireAmmo, float angle) partially supported
- Makes the player fire at an angle
- void freeze(bool frozen = true)
- Freezes or unfreezes the player
- void furGet(uint8&out a, uint8&out b, uint8&out c, uint8&out d) const
- Reads the player's four fur colors
- void furSet(uint8 a, uint8 b, uint8 c, uint8 d)
- Changes the player's four fur colors
- int getObjectHitForce(const jjOBJ@ target = null) const
- Tells whether the player is currently able to harm objects
- bool hasPrivilege(const string&in privilege, uint moduleID = ::jjScriptModuleID) const partially supported
- Returns whether the player has the given administrator privilege
- bool hurt(int8 damage = 1, bool forceHurt = false, jjPLAYER@ attacker = null) partially supported
- Hurts the player
- bool isEnemy(const jjPLAYER&in victim) const partially supported
- Whether the player's attacks can hurt another player under the rules of the current game mode
- void kill() C++
- Kills the player at once
- bool limitXScroll(uint16 left, uint16 width)
- Limits horizontal scrolling of the camera
- CHAR::Char morph(bool rabbitsOnly = false, bool morphEffect = true)
- Changes the player into the next character
- CHAR::Char morphTo(CHAR::Char charNew, bool morphEffect = true)
- Changes the player into the given character
- bool objectHit(jjOBJ@ target, int force, HANDLING::Player playerHandling) partially supported
- Makes the player collide with an object
- bool offsetPosition(int xPixels, int yPixels)
- Moves the player by the given offset at once
- void poleSpin(float xSpeed, float ySpeed, uint delay = 70) partially supported
- Swings the player around a pole and launches it
- uint8 resetLight()
- Resets the ambient light to the level's default
- CHAR::Char revertMorph(bool morphEffect = true)
- Changes the player back into its original character
- bool setName(const string&in name) partially supported
- Changes the player's name
- int setScore(int score)
- Sets the player's score
- void showText(string&in text, STRING::Size size = STRING::SMALL) partially supported
- Shows text on the screen
- void showText(uint textID, uint offset, STRING::Size size = STRING::SMALL) partially supported
- Shows one of the level's text strings on the screen
- void spring(float xSpeed, float ySpeed, bool keepZeroSpeeds, bool sample)
- Bounces the player as if touching a spring
- bool startSugarRush(int time = 1400)
- Gives the player a sugar rush
- void suckerTube(int xSpeed, int ySpeed, bool center, bool noclip = false, bool trigSample = false) partially supported
- Moves the player as if touching a sucker tube event
- bool testForCoins(int numberOfCoins)
- Spends coins if the player has enough
- bool testForGems(int numberOfGems, GEM::Color type)
- Spends gems of one color if the player has enough
- void timerFunction(const string functionName)
- Sets the function called when the player's timer runs out, by its name
- void timerFunction(jjVOIDFUNC@ function)
- Sets the function called when the player's timer runs out
- void timerFunction(jjVOIDFUNCPLAYER@ function)
- Sets the function called when the player's timer runs out
- TIMER::State timerPause()
- Pauses the player's timer
- TIMER::State timerResume()
- Resumes the player's paused timer
- TIMER::State timerStart(int ticks, bool startPaused = false)
- Starts the player's timer
- TIMER::State timerStop()
- Stops the player's timer
- bool warpToID(uint8 warpID, bool fast = false)
- Warps the player to the warp target with the given ID
- bool warpToTile(int xTile, int yTile, bool fast = false)
- Warps the player to the center of the given tile
Properties
- bool alreadyDoubleJumped deprecated
- Whether the player already used the double jump in the air
- int ammo[uint8]
- How much ammo the player has of the given weapon
- bool antiGrav partially supported
- Whether gravity is turned off for the player
- int ballTime
- How many more ticks the player stays rolled up in a ball
- int blink
- How many more ticks the player blinks
- int boss
- Object ID of the boss whose health the boss meter shows
- bool bossActivated
- Whether a boss fight is active
- int buttstomp partially supported
- Buttstomp phase of the player
- float cameraX read-only
- The left edge of the player's view of the level
- float cameraY read-only
- The top edge of the player's view of the level
- CHAR::Char charCurr read-only
- The player's current character
- CHAR::Char charOrig
- The character the player started the level as
- const int clientID partially supported
- ID of the game client controlling the player
- int coins C++
- How many coins the player has
- uint16 curAnim read-only
- The animation currently shown for the player, an index of jjAnimations
- uint curFrame read-only
- The frame currently shown for the player, an index of jjAnimFrames
- int currTile read-only
- The tile the player is in, packed into one number
- uint8 currWeapon
- The selected weapon
- int deaths read-only partially supported
- How many times the player died in a competitive game
- int8 direction
- The direction the player faces
- int doubleJumpCount
- How many double jumps the player made in the air
- int fastfire
- The delay between shots in ticks
- const int flag partially supported
- Object ID of the flag the player carries
- FLIGHT::Mode fly
- How the player is flying
- int food
- How much food the player has eaten
- uint8 frameID read-only
- The index of the frame currently shown for the player within jjPLAYER::curAnim
- int8 frozen
- How many more ticks the player stays frozen
- uint32 fur
- The player's fur colors packed into one number
- int gems[GEM::Color]
- How many gems of the given color the player has
- int8 health C++
- How many hearts the player has left
- int helicopter
- How many more ticks the helicopter ears last
- int helicopterElapsed partially supported
- Ticks spent using helicopter ears since the last jump
- int idle
- How many ticks the player has been idle
- int invincibility partially supported
- The remaining invincibility in ticks
- bool invisibility C++
- Whether the player is invisible, it isn't drawn then
- const bool isActive
- Whether the handle stands for a player in the level
- bool isAdmin read-only partially supported
- Whether the player is logged in as a server administrator
- bool isConnecting read-only partially supported
- Whether the player is still joining an online server
- bool isIdle read-only partially supported
- Whether the player is an idle server that isn't in the level
- bool isInGame read-only
- Whether the player actually takes part in the game
- bool isJailed read-only partially supported
- Whether the player is in jail in Jailbreak
- const bool isLocal partially supported
- Whether the player is controlled on this machine
- bool isOut read-only partially supported
- Whether the player is out of a last-rabbit-standing game
- bool isSpectating read-only partially supported
- Whether the player is spectating by choice
- bool isZombie read-only partially supported
- Whether the player is a zombie in Pestilence
- float jumpStrength partially supported
- Vertical speed the player gains by jumping
- bool keyDown
- Whether the down key is held
- bool keyFire
- Whether the fire key is held
- bool keyJump
- Whether the jump key is held
- bool keyLeft
- Whether the left key is held
- bool keyRight
- Whether the right key is held
- bool keyRun
- Whether the run key is held
- bool keySelect
- Whether the weapon select key is held
- bool keyUp
- Whether the up key is held
- int laps read-only partially supported
- How many laps the player finished in a race
- int lapTimeBest read-only partially supported
- The time of the player's fastest lap in ticks
- int lapTimeCurrent read-only partially supported
- How many ticks the current lap has lasted
- int lapTimes[uint] read-only partially supported
- The time of one of the last laps in ticks
- int8 light partially supported
- The intensity of the light the player emits
- uint8 lighting
- The ambient light level of the player's view
- LIGHT::Type lightType partially supported
- The kind of light the player emits
- int lives C++
- How many lives the player has left
- int localPlayerID read-only partially supported
- The index of the player among local players
- int lrsLives read-only partially supported
- The lives left in last-rabbit-standing game modes
- string name read-only partially supported
- The player's name, including color codes
- string nameUnformatted read-only partially supported
- The player's name without color codes
- bool noclipMode
- Whether the player passes through walls
- bool noFire C++
- Whether the player is prevented from firing
- int platform
- Object ID of the object the player stands on, or pushes (see jjOBJ::beSolid())
- int8 playerID read-only partially supported
- The index of the player
- bool powerup[uint8]
- Whether the given weapon is powered up
- int roasts read-only partially supported
- How many players this player roasted
- bool running
- Whether the player is running
- int score C++
- The player's score
- int scoreDisplayed partially supported
- The score shown on the HUD
- ANIM::Set setID read-only
- The animation set the player takes animations from
- int shieldTime
- How many more ticks the shield lasts
- int shieldType
- The shield the player has
- int specialMove partially supported
- Special move the player is performing
- SPRITE::Mode spriteMode partially supported
- The sprite mode the player is drawn with
- uint8 spriteParam partially supported
- The parameter of the sprite mode
- int stoned
- How many more ticks the player stays dizzy
- int subscreenX read-only
- The left edge of the player's part of the screen
- int subscreenY read-only
- The top edge of the player's part of the screen
- TEAM::Color team read-only
- The team the player belongs to
- bool teamRed read-only
- Whether the player isn't on the blue team
- bool timerPersists
- Whether the player's timer keeps running when the player dies
- TIMER::State timerState read-only
- The state of the player's timer
- int timerTime C++
- How many ticks are left on the player's timer
- const int warpID partially supported
- Warp the player is currently going through
- float xAcc
- The horizontal acceleration
- float xOrg
- The horizontal respawn position in pixels
- float xPos
- The horizontal position in pixels
- float xSpeed
- The horizontal speed in pixels per tick
- float yAcc
- The vertical acceleration
- float yOrg
- The vertical respawn position in pixels
- float yPos
- The vertical position in pixels
- float ySpeed
- The vertical speed in pixels per tick
Function documentation
bool jjPLAYER:: activateBoss(bool activate = true)
Activates the bosses of the level
| Parameters | |
|---|---|
| activate | Whether to activate the bosses or end the boss fight of the player |
| Returns | Always true |
Works like the player touching an Activate Boss event. With activate false only the player's bossActivated is cleared, which hides the boss meter, the bosses go on.
void jjPLAYER:: cameraFreeze(float xPixel,
float yPixel,
bool centered,
bool instant)
Fixes the camera at the given position
| Parameters | |
|---|---|
| xPixel | Horizontal position in pixels |
| yPixel | Vertical position in pixels |
| centered | If true, the position is the center of the view, otherwise its top left corner |
| instant | If true, the camera jumps there, otherwise it scrolls there smoothly |
The camera stays there until cameraUnfreeze() is called.
void jjPLAYER:: cameraFreeze(bool xUnfreeze,
float yPixel,
bool centered,
bool instant)
Fixes the camera vertically
| Parameters | |
|---|---|
| xUnfreeze | If true, the camera follows the player horizontally again, otherwise the horizontal axis stays as it is |
| yPixel | Vertical position in pixels |
| centered | If true, the position is the center of the view, otherwise its top edge |
| instant | If true, the camera jumps there, otherwise it scrolls there smoothly |
void jjPLAYER:: cameraFreeze(float xPixel,
bool yUnfreeze,
bool centered,
bool instant)
Fixes the camera horizontally
| Parameters | |
|---|---|
| xPixel | Horizontal position in pixels |
| yUnfreeze | If true, the camera follows the player vertically again, otherwise the vertical axis stays as it is |
| centered | If true, the position is the center of the view, otherwise its left edge |
| instant | If true, the camera jumps there, otherwise it scrolls there smoothly |
void jjPLAYER:: cameraFreeze(bool xUnfreeze,
bool yUnfreeze,
bool centered,
bool instant)
Releases or keeps each axis of the camera
| Parameters | |
|---|---|
| xUnfreeze | If true, the camera follows the player horizontally again |
| yUnfreeze | If true, the camera follows the player vertically again |
| centered | Has no effect with this overload |
| instant | If true, the camera jumps back to the player, otherwise it scrolls there smoothly |
Passing true for both axes is the same as cameraUnfreeze().
void jjPLAYER:: cameraUnfreeze(bool instant = true)
Lets the camera follow the player again
| Parameters | |
|---|---|
| instant | If true, the camera jumps back to the player, otherwise it scrolls there smoothly |
bool jjPLAYER:: doesCollide(const jjOBJ@ object,
bool always = false) const
Checks whether an object's sprite overlaps the player
| Parameters | |
|---|---|
| object | Object to test against |
| always | Currently ignored |
Compares the pixels of the object's current frame with the hitbox of the player. Handling settings aren't taken into account.
int jjPLAYER:: extendInvincibility(int duration)
Extends the player's invincibility
| Parameters | |
|---|---|
| duration | Ticks to add, a negative value shortens it but never below 0 |
| Returns | The remaining invincibility in ticks |
int jjPLAYER:: fireBullet(uint8 gun = 0,
bool depleteAmmo = true,
bool requireAmmo = true,
DIRECTION::Dir direction = DIRECTION::CURRENT)
Makes the player fire in a direction
int jjPLAYER:: getObjectHitForce(const jjOBJ@ target = null) const
Tells whether the player is currently able to harm objects
The value has the same meaning as the force argument of jjPLAYER::objectHit().
bool jjPLAYER:: hasPrivilege(const string&in privilege,
uint moduleID = ::jjScriptModuleID) const
Returns whether the player has the given administrator privilege
bool jjPLAYER:: hurt(int8 damage = 1,
bool forceHurt = false,
jjPLAYER@ attacker = null)
Hurts the player
| Parameters | |
|---|---|
| damage | Number of hearts to take away |
| forceHurt | If true, any invincibility or blinking ends first, so it doesn't block the hit |
| attacker | Currently ignored |
| Returns | Whether the player lost health |
bool jjPLAYER:: isEnemy(const jjPLAYER&in victim) const
Whether the player's attacks can hurt another player under the rules of the current game mode
Always false in single player and cooperation. Otherwise the rules of the game mode apply, for example nobody but the ring holder and the bottom feeder in Roast Tag, or nobody in jail in Jailbreak.
bool jjPLAYER:: limitXScroll(uint16 left,
uint16 width)
Limits horizontal scrolling of the camera
| Parameters | |
|---|---|
| left | Left edge in tiles |
| width | Width in tiles |
| Returns | Always true |
Works like a Limit X Scroll event.
CHAR::Char jjPLAYER:: morph(bool rabbitsOnly = false,
bool morphEffect = true)
Changes the player into the next character
| Parameters | |
|---|---|
| rabbitsOnly | Whether to cycle only through the rabbits |
| morphEffect | Whether to show the morphing effect |
| Returns | The player's character afterwards |
Cycles through Jazz, Spaz, Lori (TSF only), the bird and the frog, skipping characters whose sprites aren't available.
CHAR::Char jjPLAYER:: morphTo(CHAR::Char charNew,
bool morphEffect = true)
Changes the player into the given character
| Parameters | |
|---|---|
| charNew | The new character |
| morphEffect | Whether to show the morphing effect |
| Returns | The player's character afterwards |
The player stays as it is if the sprites of that character aren't available.
bool jjPLAYER:: objectHit(jjOBJ@ target,
int force,
HANDLING::Player playerHandling)
Makes the player collide with an object
| Parameters | |
|---|---|
| target | Object to collide with |
| force | How hard the player hits: 0 for a plain touch, 1 for a buttstomp or sugar rush, -1 for a special move, -101 for running fast into a frozen object |
| playerHandling | Currently ignored |
| Returns | Whether the object was affected |
The collision is resolved as if the two really touched, wherever they are, and the object's jjOBJ::energy is updated afterward. For an object with jjOBJ::scriptedCollisions set, its onObjectHit() decides the result instead of the game.
bool jjPLAYER:: offsetPosition(int xPixels,
int yPixels)
Moves the player by the given offset at once
| Parameters | |
|---|---|
| xPixels | Pixels to move to the right |
| yPixels | Pixels to move down |
| Returns | Always true |
The move skips the warp effect, which makes it suitable for levels that loop seamlessly.
uint8 jjPLAYER:: resetLight()
Resets the ambient light to the level's default
| Returns | The new ambient light level |
|---|
CHAR::Char jjPLAYER:: revertMorph(bool morphEffect = true)
Changes the player back into its original character
| Parameters | |
|---|---|
| morphEffect | Whether to show the morphing effect |
| Returns | The player's character afterwards |
Works like the Revert Morph event, the player becomes charOrig.
void jjPLAYER:: showText(string&in text,
STRING::Size size = STRING::SMALL)
Shows text on the screen
| Parameters | |
|---|---|
| text | Text to show |
| size | STRING::Size of the text |
The text appears the way a Text event shows it.
void jjPLAYER:: showText(uint textID,
uint offset,
STRING::Size size = STRING::SMALL)
Shows one of the level's text strings on the screen
| Parameters | |
|---|---|
| textID | Index of the text string in the level |
| offset | Which part of the string to show, when it is split into parts by | characters |
| size | STRING::Size of the text |
Works like a Text event.
void jjPLAYER:: spring(float xSpeed,
float ySpeed,
bool keepZeroSpeeds,
bool sample)
Bounces the player as if touching a spring
| Parameters | |
|---|---|
| xSpeed | Horizontal speed |
| ySpeed | Vertical speed |
| keepZeroSpeeds | If true, an axis with zero speed keeps the player's current speed instead of stopping it |
| sample | Whether to play the spring sound |
Speeds use the scale of springs in the original game, 16 for red, 24 for green and 32 for blue, so an upward red spring is spring(0, -16, ...). Nothing happens if both speeds are 0.
bool jjPLAYER:: startSugarRush(int time = 1400)
Gives the player a sugar rush
| Parameters | |
|---|---|
| time | Duration in ticks |
| Returns | False without starting it while a boss fight is active or the game mode doesn't allow it, true otherwise |
void jjPLAYER:: suckerTube(int xSpeed,
int ySpeed,
bool center,
bool noclip = false,
bool trigSample = false)
Moves the player as if touching a sucker tube event
| Parameters | |
|---|---|
| xSpeed | Horizontal speed |
| ySpeed | Vertical speed |
| center | Whether to center the player in its tile on the axis it doesn't move along, moving diagonally with it every tick can get the player stuck |
| noclip | Whether the player passes through walls while in the tube |
| trigSample | Currently ignored |
bool jjPLAYER:: testForCoins(int numberOfCoins)
Spends coins if the player has enough
| Returns | True if the player had at least numberOfCoins coins, which are then taken away, false otherwise with the coins left untouched |
|---|
Works like a coin warp whose outcome the script decides.
bool jjPLAYER:: testForGems(int numberOfGems,
GEM::Color type)
Spends gems of one color if the player has enough
| Parameters | |
|---|---|
| numberOfGems | Number of gems to take away |
| type | GEM::Color of the gems |
| Returns | True if the player had enough gems, which are then taken away, false otherwise with the gems left untouched |
void jjPLAYER:: timerFunction(const string functionName)
Sets the function called when the player's timer runs out, by its name
The function is called only when the timer reaches zero by itself. Without one, onPlayerTimerEnd() is called. Passing the function itself instead of its name is preferred.
void jjPLAYER:: timerFunction(jjVOIDFUNC@ function)
Sets the function called when the player's timer runs out
The function is called only when the timer reaches zero by itself.
void jjPLAYER:: timerFunction(jjVOIDFUNCPLAYER@ function)
Sets the function called when the player's timer runs out
The function is called only when the timer reaches zero by itself, with the player whose timer ran out.
TIMER::State jjPLAYER:: timerPause()
Pauses the player's timer
| Returns | The timer state afterwards |
|---|
Only a running timer is paused, a stopped one stays stopped.
TIMER::State jjPLAYER:: timerResume()
Resumes the player's paused timer
| Returns | The timer state afterwards |
|---|
TIMER::State jjPLAYER:: timerStart(int ticks,
bool startPaused = false)
Starts the player's timer
| Parameters | |
|---|---|
| ticks | Time on the timer in ticks |
| startPaused | Whether the timer starts paused |
| Returns | TIMER::PAUSED if startPaused is true, TIMER::STARTED otherwise |
The HUD shows the time left at the top of the view, unless onDrawPlayerTimer() draws it.
TIMER::State jjPLAYER:: timerStop()
Stops the player's timer
| Returns | TIMER::STOPPED |
|---|
The timer function isn't called.
bool jjPLAYER:: warpToTile(int xTile,
int yTile,
bool fast = false)
Warps the player to the center of the given tile
| Parameters | |
|---|---|
| xTile | Horizontal tile coordinate |
| yTile | Vertical tile coordinate |
| fast | If true, the player moves at once instead of using the warp effect |
| Returns | Always true |
Property documentation
bool jjPLAYER:: alreadyDoubleJumped
Whether the player already used the double jump in the air
Older form of doubleJumpCount, which should be used instead.
int jjPLAYER:: ammo[uint8]
How much ammo the player has of the given weapon
Indexed by a 1-based WEAPON::Weapon number, in whole rounds, WEAPON::CURRENT is the selected weapon. Other indices that aren't a weapon read as 0 and ignore writes. For a weapon with jjWEAPON::infinite set, assigning a positive value gives the player unlimited ammo of it.
int jjPLAYER:: boss
Object ID of the boss whose health the boss meter shows
While bossActivated is true, the meter shows the energy of that object as a share of the energy of its entry in jjObjectPresets. 0 if there's no boss. The game fills it in while one of its own bosses is active, otherwise it keeps what the script assigned.
bool jjPLAYER:: bossActivated
Whether a boss fight is active
Set by the Activate Boss event or activateBoss(). The game keeps it in line with its own bosses, but a value the script assigns stays until the game's own boss state changes.
CHAR::Char jjPLAYER:: charCurr read-only
The player's current character
A CHAR::Char value, which is also the index of the animation set the character uses. Change it with morphTo() or revertMorph().
CHAR::Char jjPLAYER:: charOrig
The character the player started the level as
The character revertMorph() and the Revert Morph event change the player back into. Only CHAR::JAZZ, CHAR::SPAZ and CHAR::LORI are accepted when assigning it, other values are ignored.
uint16 jjPLAYER:: curAnim read-only
The animation currently shown for the player, an index of jjAnimations
An index into jjAnimations, 0 if the animation shown has no counterpart there.
uint jjPLAYER:: curFrame read-only
The frame currently shown for the player, an index of jjAnimFrames
Equals the first frame of jjPLAYER::curAnim plus jjPLAYER::frameID.
uint8 jjPLAYER:: currWeapon
The selected weapon
A 1-based WEAPON::Weapon number. Assigning a number that isn't a weapon is ignored.
int jjPLAYER:: doubleJumpCount
How many double jumps the player made in the air
Counted since the player last stood on the ground. Once it reaches jjCHARACTER::doubleJumpCountMax of the character, no other double jump is allowed until then.
FLIGHT::Mode jjPLAYER:: fly
How the player is flying
FLIGHT::FLYCARROT while using a copter, FLIGHT::AIRBOARD while on an airboard, FLIGHT::NONE otherwise. Assigning one of these values starts or ends flying accordingly.
int jjPLAYER:: food
How much food the player has eaten
Assigning it only changes the counter, use startSugarRush() to start a sugar rush.
uint8 jjPLAYER:: frameID read-only
The index of the frame currently shown for the player within jjPLAYER::curAnim
0 is the first frame of curAnim.
int jjPLAYER:: gems[GEM::Color]
How many gems of the given color the player has
Indexed by GEM::Color. Other indices read as 0 and ignore writes.
int jjPLAYER:: helicopter
How many more ticks the helicopter ears last
0 when the player isn't using them.
int jjPLAYER:: helicopterElapsed
Ticks spent using helicopter ears since the last jump
int jjPLAYER:: invincibility
The remaining invincibility in ticks
Assigning a positive value makes the player invincible for that long, 0 or less ends it.
bool jjPLAYER:: isConnecting read-only
Whether the player is still joining an online server
bool jjPLAYER:: isSpectating read-only
Whether the player is spectating by choice
float jjPLAYER:: jumpStrength
Vertical speed the player gains by jumping
int jjPLAYER:: lapTimeBest read-only
The time of the player's fastest lap in ticks
int jjPLAYER:: lapTimeCurrent read-only
How many ticks the current lap has lasted
LIGHT::Type jjPLAYER:: lightType
The kind of light the player emits
Only whether the player has a light at all is supported, so this is either LIGHT::NONE or LIGHT::PLAYER.
int jjPLAYER:: localPlayerID read-only
The index of the player among local players
0 to 3 in a splitscreen game.
string jjPLAYER:: nameUnformatted read-only
The player's name without color codes
bool jjPLAYER:: noclipMode
Whether the player passes through walls
While true, the player also ignores gravity and keeps its current speed. Turning it on can trap the player if the level isn't built for it.
int jjPLAYER:: platform
Object ID of the object the player stands on, or pushes (see jjOBJ::beSolid())
0 when the player isn't standing on an object scripts can see. The game refreshes it, so assigning it has no lasting effect.
bool jjPLAYER:: powerup[uint8]
Whether the given weapon is powered up
Indexed by a 1-based WEAPON::Weapon number, WEAPON::CURRENT is the selected weapon. Other indices that aren't a weapon read as false and ignore writes.
int jjPLAYER:: scoreDisplayed
The score shown on the HUD
ANIM::Set jjPLAYER:: setID read-only
The animation set the player takes animations from
A CHAR::Char value, which is also the index of the animation set the character uses. Change it with morphTo() or revertMorph().
int jjPLAYER:: shieldType
The shield the player has
A SHIELD::Shield value. Assigning a value that isn't a known shield is ignored.
int jjPLAYER:: specialMove
Special move the player is performing
0 when there's none. The game refreshes it, so assigning it has no lasting effect.
SPRITE::Mode jjPLAYER:: spriteMode
The sprite mode the player is drawn with
A SPRITE::Mode value. Other modes are kept, but the player is drawn as usual.
uint8 jjPLAYER:: spriteParam
The parameter of the sprite mode
int jjPLAYER:: subscreenX read-only
The left edge of the player's part of the screen
In pixels from the left edge of the window, 0 unless the screen is split.
int jjPLAYER:: subscreenY read-only
The top edge of the player's part of the screen
In pixels from the top edge of the window, 0 unless the screen is split.
TEAM::Color jjPLAYER:: team read-only
The team the player belongs to
A TEAM::Color value, TEAM::BLUE outside of team-based game modes.
bool jjPLAYER:: timerPersists
Whether the player's timer keeps running when the player dies
If false, dying stops the timer.
TIMER::State jjPLAYER:: timerState read-only
The state of the player's timer
A TIMER::State value. Change it with timerStart(), timerPause(), timerResume() and timerStop().