Player

GameObjecthitme__PlayerParentPlayer

This is the player! When making these yourself, you'll want to specify the index, like so:

instance_create(mouse_x, mouse_y, Player, { index: 0 });

If you don't, the game will get the index from KeyCont.playid++ and may violently implode if the index gets beyond the expected numbers.

Variables:

from hitme
from hitme

Object: hitme

nexthurt: number
team: number

Default team for players is 2

size: number

"bigger" entities are harder to push around Unclear whether used for players at all

maxhealth: number

Maximum health Current maximum health (as in UI)

spr_shadow: sprite

Shadow sprite (if any)

spr_shadow_x: number

Shadow X offset

spr_shadow_y: number

Shadow Y offset

my_health

Current health Current health

spr_idle: sprite

Played if (speed == 0)

spr_walk: sprite

Played if (speed != 0)

spr_hurt: sprite

3-frame sprite for taking damage

spr_dead: sprite

Death+corpse sprite

snd_hurt: sound

Played upon hit

snd_dead: sound

Played upon death

from Player
from Player
index: int

Player index (P1 is 0, P2 is 1, etc.)

raddrop: number

Used only if you're getting hit by a Horror bullet

gunangle: number

Current aiming direction (degrees)

aimDirection: number
aotDirection: number

Non-sync aiming direction! Only for use in drawing

joyx: number

Raw gamepad X aim axis value (-1..1)

joyy: number
joyaimx: number

Actual gamepad X aim axis value (with autoaim/smoothing in mind)

joyaimy: number
race: string

Race code (e.g. "fish" or "myrace")

wep

Current primary weapon

bwep

Current secondary weapon
From hereafter, anything with b prefix means that it's same as unprefixed but for the secondary weapon.

calc_reload_speed()

Called to calculate reload speed (with race/skill modifiers but without timescale)

calc_pickup_attract_distance()
calc_rad_attract_distance()
grant_ammo(type, amount, slot, source)
grant_health(amount, source)
ammo: array<number>

An array with ammo per weapon type. Order is: melee (unused), bullets, shells, bolts, explosives, energy.

nearwep

Nearest weapon (that would get picked up when pressing the button)

curse: number

Curse level for primary weapon (0 for no curse, un-cursing subtracts 1)

bcurse: number
reload: number

Cooldown for primary weapon

breload: number
reloadspeed: number

Weapon reload speed multiplier (default is 1)

clicked: number
angle: number

Fish's roll angle

sprite_angle: number

Can be set to rotate the sprite without rotating the hitbox

wepangle: number

Flips on weapon swing, generally -120, 120, or 0

bwepangle: number
wepflip: number

Melee weapons flip this after a swing (when reload reaches 0)

bwepflip: number
wkick: number

Displayed weapon offset
For ranged weapons, is just how far weapon moves backwards/forwards.
For melee weapons, also affects weapon angle.

bwkick: number
can_shoot: number

Indicates whether a player could shoot something.
Is set to 0 upon firing a weapon and 1 when the weapon is reloaded.
Used very occasionally (e.g. for IDPD logic).

bcan_shoot: number
specfiring: bool

Is set to true when firing via active ability (Y.V., Skeleton)
Can only be used inside weapon mod's weapon_fire script.

lasthit: number

Last damage source (to be shown on Game Over screen). Allowed values are as following:

  • -1: Unknown cause
  • 0..105: Built-in death causes
  • 106+: Sprite index (sprite name is used as mouseover text)
  • [<sprite>, <text>]: Custom death cause (a 2-element array)

So, for example, you could do

with (Player) {
    lasthit = [spr_idle, "Incompetence"];
    my_health = 0;
}
hammerhead: number

Remaining HammerHead charges (measured in wall blocks)

hammering: number

Hammerhead timer variable (walls are broken at >=12)

canspirit: number

Whether the player has Strong Spirit

spiriteffect: number

Strong Spirit timer, prevents the player from falling under 1 health

footstep: number

Counter for playing footstep sounds at correct animation frames

footkind: number

What kind of footstep noises do we make?
0: None (floating like Y.V. B or custom logic)
1: Organic (like the most characters)
2: Leafy (like Plant)
3: Shoes (like Y.V. A, Rebel)
4: Metal (like Robot)

footextra: number

Counter for Extra Feet's dust particles

bleed: number

Chicken's bleed timer. Death comes when it reaches 120

safeheadloss: number

Is set to 2 when reviving players to prevent max health loss

chickendeaths: number

How many points are missing off max health

chickencorpse: Corpse

Chicken head to remove when getting health back

horrorcharge: number

Horror's beam charge (grows during use)

horrornorad: number

Frames until radiation can be attracted to player again

horrorstopsnd: number

Frames until Horror's beam sounds should be stopped

rogueammo: number

Currently available portal strikes for Rogue

canrogue: number

Whether Rogue's passive can trigger

swapmove: number

Does a 1-frame UI "bump" when changing weapons

back: number

Whether currently aiming upwards (for weapon display)

Whether currently facing right

wepright: number

Recalculated on draw to flip weapons when facing left

frogcharge: number

Grows while holding Frog's active

wave: number

Used for a variety of subtle visual effects

smoke: number

Counter for emitting smoke after touch an explosion with Boiling Veins

interfacepop: number

Is set to 2/4/6 when using Y.V.'s active to pop out more shells upon reloading

binterfacepop: number
usespec: bool

If set, assumes that ability button is held down

candie: bool

Whether the player can die

canfire: bool

Whether the player can fire normally

canspec: bool

Whether the player can use their ability

canwalk: bool

Whether the player can move normally

canpick: bool

Whether the player can pick up weapons

canswap: bool

Whether the player can swap weapons

canscope: bool

Whether the aiming laser should be shown

canfeet: bool

Whether the player is affected by Extra Feet

canaim: bool

Whether the player can aim normally (otherwise gunangle is used)

notoxic: bool

Whether the player is immune to toxic gas

drawempty: number

Timer for "low ammo" / "empty" warning

drawemptyb: number
drawlowhp: number

Timer for "low health" warning

showhp: number

Legacy debug - shows HP+rads above enemies

roll: number

Whether currently rolling (as Fish)

infammo: number

If set to non-zero, ammo is not spent when shooting.
Values above 0 act as countdown in frames and display the effect.
Values below 0 are non-expiring infinite ammo and don't show the effect.

gunshine: number

Determines the gun's "shine" frame. Trigger Fingers sets this to 7.
Setting it to 1 + current_time_scale would lock the gun in the "flash" frame.

bskin

0 for A-skin, 1 for B-skin, string for custom

dogammo: number

Remaining shots for Big Dog's spin attack

turn

Turn direction for Big Dog's spin attack

maxspeed: number

Peak movement speed

accuracy: number

Affects spread on various weapons.

boilcap: number

Boiling Veins minimum health

spr_fire: sprite

Only used for Big Dog

lsthealth

Previously reported health
This is what determines the width of the "ghostly" healthbar.
Some effects (Rogue's passive, Sharp Teeth) check this to detect taking damage.
Once the player finishes playing the "hurt" animation, approaches health at rate of 0.5/frame.

prepareScoreGet: number

Unused in NTT

stream_submit: number

Stores stream key request ID

stuckfor: number
from scrRaces
from scrRaces

Once upon a time this script used to fill out all sorts of character information, but all of that is in global variables now.

racemax
from scrWeapons
from scrPlayerSetRace

Alarms:

  • alarm[2]: Big Dog spin attack
  • alarm[3]: Frog gas release
  • alarm[8]: Stream key related
  • alarm[9]: Stops Horror beam sound
  • alarm[10]: Kills off-level enemies unless they have sfmt("canfly") set to true.