GameObject ➜ hitme ➜ __PlayerParent ➜ Player
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
Object: hitme
Default team for players is 2
"bigger" entities are harder to push around
Unclear whether used for players at all
Maximum health
Current maximum health (as in UI)
Current health
Current health
3-frame sprite for taking damage
from Player
Player index (P1 is 0, P2 is 1, etc.)
Used only if you're getting hit by a Horror bullet
Current aiming direction (degrees)
Non-sync aiming direction! Only for use in drawing
Raw gamepad X aim axis value (-1..1)
Actual gamepad X aim axis value (with autoaim/smoothing in mind)
Race code (e.g. "fish" or "myrace")
Current secondary weapon
From hereafter, anything with b
prefix means that it's same as unprefixed but for the secondary weapon.
Called to calculate reload speed (with race/skill modifiers but without timescale)
An array with ammo per weapon type.
Order is: melee (unused), bullets, shells, bolts, explosives, energy.
Nearest weapon (that would get picked up when pressing the button)
Curse level for primary weapon (0 for no curse, un-cursing subtracts 1)
Cooldown for primary weapon
Weapon reload speed multiplier (default is 1)
Can be set to rotate the sprite without rotating the hitbox
Flips on weapon swing, generally -120, 120, or 0
Melee weapons flip this after a swing (when reload
reaches 0)
Displayed weapon offset
For ranged weapons, is just how far weapon moves backwards/forwards.
For melee weapons, also affects weapon angle.
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).
Is set to true when firing via active ability (Y.V., Skeleton)
Can only be used inside weapon mod's weapon_fire
script.
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;
}
Remaining HammerHead charges (measured in wall blocks)
Hammerhead timer variable (walls are broken at >=12)
Whether the player has Strong Spirit
Strong Spirit timer, prevents the player from falling under 1 health
Counter for playing footstep sounds at correct animation frames
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)
Counter for Extra Feet's dust particles
Chicken's bleed timer. Death comes when it reaches 120
Is set to 2 when reviving players to prevent max health loss
How many points are missing off max health
Chicken head to remove when getting health back
Horror's beam charge (grows during use)
Frames until radiation can be attracted to player again
Frames until Horror's beam sounds should be stopped
Currently available portal strikes for Rogue
Whether Rogue's passive can trigger
Does a 1-frame UI "bump" when changing weapons
Whether currently aiming upwards (for weapon display)
Whether currently facing right
Recalculated on draw to flip weapons when facing left
Grows while holding Frog's active
Used for a variety of subtle visual effects
Counter for emitting smoke after touch an explosion with Boiling Veins
Is set to 2/4/6 when using Y.V.'s active to pop out more shells upon reloading
If set, assumes that ability button is held down
Whether the player can die
Whether the player can fire normally
Whether the player can use their ability
Whether the player can move normally
Whether the player can pick up weapons
Whether the player can swap weapons
Whether the aiming laser should be shown
Whether the player is affected by Extra Feet
Whether the player can aim normally (otherwise gunangle is used)
Whether the player is immune to toxic gas
Timer for "low ammo" / "empty" warning
Timer for "low health" warning
Legacy debug - shows HP+rads above enemies
Whether currently rolling (as Fish)
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.
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.
0 for A-skin, 1 for B-skin, string for custom
Remaining shots for Big Dog's spin attack
Turn direction for Big Dog's spin attack
Affects spread on various weapons.
Boiling Veins minimum health
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.
Stores stream key request ID
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.
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.