Skip to content

ModCS.Player

The ModCS.Player global object represents the player (Also known as My Character/ MYC).

ModCS.Player is userdata. You may access and edit the following values from it:

Value Type Usage
x Pixel Unit The player's X position.
y Pixel Unit The player's Y position.
xm Pixel Unit X velocity of the Player.
ym Pixel Unit Y velocity of the Player.
ani_no Number (Casted to integer) Animation frame value.
ani_wait Number (Casted to integer) Animation timer value.
direct Direction The player's direction.
boost_fuel Number (Casted to integer) The fuel of the Player's Booster.
air Number (Casted to integer) Air value of the player.

ModCS.Player.IsHit()

ModCS.Player.IsHit()

Returns true if the player is being hit. Returns false otherwise.

ModCS.Player.IsLookingDown()

ModCS.Player.IsLookingDown()

Returns true if the player is looking down. Returns false otherwise.

ModCS.Player.IsLookingUp()

ModCS.Player.IsLookingUp()

Returns true if the player is looking up. Returns false otherwise.

ModCS.Player.GetLife()

ModCS.Player.GetLife()

Returns the player's current life points.

ModCS.Player.AddLife()

ModCS.Player.AddLife(life)

Adds life to the player's life points.

ModCS.Player.GetMaxLife()

ModCS.Player.GetMaxLife()

Returns the player's current maximum life points.

ModCS.Player.AddMaxLife()

ModCS.Player.AddMaxLife(life)

Adds life to the player's max life points.

ModCS.Player.Damage()

ModCS.Player.Damage(damage)

Damages the player by damage.

ModCS.Player.SetRect()

ModCS.Player.SetRect(left, top, right, bottom)
ModCS.Player.SetRect(rect)

Sets the Rect of the player to a Rect with left, top, right, bottom.

If a rect is specified, set the Rect of the player to that Rect instead.

ModCS.Player.GetRect()

ModCS.Player.GetRect()

Returns the player's Rect.

ModCS.Player.OffsetRect()

ModCS.Player.OffsetRect(left, top, right, bottom)

Adds left, top, right, bottom to the the left, top, right, bottom values of the Rect of the player.

right and bottom are optional parameters. If they are not specified, left and top will be used in their place instead.

ModCS.Player.SetViewbox()

ModCS.Player.SetViewbox(front, top, back, bottom)
ModCS.Npc.SetViewbox(rangerect)

Sets the sprite offset of the Player to a RangeRect with front, top, back, bottom.

If a rangerect is specified, set the sprite offset of the Player to that RangeRect instead.

ModCS.Player.GetViewbox()

ModCS.Player.GetViewbox()

Returns the sprite offset RangeRect of the player.

ModCS.Player.SetArmsYOffset()

ModCS.Player.SetArmsYOffset(offset)

Sets the vertical sprite offset of the weapon sprite next to the player to offset.