Skip to content

glossary need review

Alex Neargarder edited this page Jul 5, 2025 · 8 revisions

Core Firing Methods

The primary fire system follows this call hierarchy:

  1. Player presses fire button → StartFiring() called once
  2. While holding fire → RunFiring() called every update
  3. RunFiring() calls → UseFire() when fireCounter >= fireRate
  4. UseFire() calls → FireWeapon() to spawn projectile
  5. Player releases fire → StopFiring() called once

Additionally:

  • RunGun() runs every update to handle gun sprite animations
  • SetGunPosition() is called each frame to position the gun sprite

StartFiring() is called once when the fire button is first pressed. It sets fireCounter to fireRate if fireRate < 0.3f, otherwise sets it to 0. Override this to initialize firing states, start charge effects, or set up burst fire modes.


RunFiring() is called every update while the fire button is held. It increments fireCounter by delta time and calls UseFire() when fireCounter >= fireRate. Override this to implement charging weapons, continuous beams, or custom firing timing.


StopFiring() is called when the fire button is released. Override this to stop continuous effects, release charged shots, or clean up firing states.


ReleaseFire() is called when the fire button is released. This method is rarely overridden - use StopFiring() instead unless you specifically need to handle the release event separately.


UseFire() executes a single attack. It cancels any active melee, calls FireWeapon() with standard parameters, plays attack sounds, and disturbs wildlife. Override this to modify firing behavior, add ammo consumption, or implement alternate fire modes.

Note: Called automatically by RunFiring() when fireCounter >= fireRate.


FireWeapon() creates the actual projectile. It sets gun animation frame, creates muzzle flash, and spawns the projectile. Override this to spawn custom projectiles, create multiple shots, or implement non-projectile attacks.

Parameters:

  • x, y - World position to spawn the projectile
  • xSpeed, ySpeed - Initial velocity (base uses 400 horizontal, random -20 to 20 vertical)

Gun Animation and Positioning

RunGun() is called every update to handle gun sprite animations. It decrements gunFrame over time when > 0, calling SetGunSprite() to update the sprite. Override this to implement custom gun animations, muzzle flashes, or weapon state visuals.


SetGunPosition() positions the gun sprite relative to your bro. Override this to adjust gun placement for different animations or weapon types. Called automatically during rendering.

Parameters:

  • xOffset, yOffset - Offset from the bro's position

SetGunSprite() updates the gun sprite's texture coordinates. It handles different positions for hanging, ladder climbing, and zipline states. Override this only if you need custom sprite positioning logic.

Parameters:

  • spriteFrame - Horizontal frame index in the sprite sheet
  • spriteRow - Vertical row index in the sprite sheet

ActivateGun() and DeactivateGun() control gun sprite visibility. Override these to show/hide weapons at specific times, such as holstering during melee or special abilities.


Melee Methods

The melee system follows this pattern:

  1. Player presses melee → SetMeleeType() determines melee type
  2. StartCustomMelee() initializes the melee attack
  3. During melee → AnimateCustomMelee() and RunCustomMeleeMovement() run each frame
  4. AnimateCustomMelee() calls → PerformCustomMeleeAttack() at the damage frame
  5. Melee ends naturally or → CancelMelee() if interrupted

StartCustomMelee() is called when the melee button is pressed and meleeType is not MeleeType.Knife. It initializes the melee attack animation and sets up dashing movement. Override this to implement custom melee initialization, damage setup, or special melee states.

Note: For custom melee to work, set this.meleeType in Start() to something other than MeleeType.Knife.


SetMeleeType() is called before starting melee to determine whether it's a standing, jumping, or dashing melee based on the bro's current state. Override this to implement context-sensitive melee attacks or custom melee types.


AnimateCustomMelee() is called every frame change during custom melee attacks. It defaults to calling AnimateKnifeMelee(). Override this to handle custom melee animations and call attack methods at the appropriate animation frames.


RunCustomMeleeMovement() is called every update during custom melee attacks to control movement. It defaults to calling RunKnifeMeleeMovement(). Override this to implement custom movement patterns, dashing attacks, or special physics during melee.


CancelMelee() is called when melee is interrupted by other actions. It resets all melee flags and returns to the appropriate action state. Override this to clean up custom melee states, stop effects, or handle interruption logic.


ThrowBackMook() is called when your bro throws an enemy during melee. Override this to add special throw effects, modify throw physics, or implement custom throw behaviors.

Parameters:

  • mook - The enemy unit being thrown

Special Methods

The special ability system follows this pattern:

  1. Player presses special → PressSpecial() called (sets usingSpecial = true)
  2. UseSpecial() is called to consume ammo and trigger the effect
  3. AnimateSpecial() handles the animation frames
  4. Player releases special → ReleaseSpecial() called (rarely used)

PressSpecial() is called when the special button is first pressed. It sets usingSpecial = true and resets the animation frame. Override this to start charging abilities, trigger instant effects, or set up special states.


UseSpecial() consumes special ammo and executes the special ability. It spawns a grenade projectile with different trajectories based on whether you're ducking. Override to implement custom abilities like spawning objects, transforming, or applying buffs.


AnimateSpecial() handles the animation for special abilities. It plays throwing animation frames and calls UseSpecial() at the appropriate frame. Override this to implement custom special animations or multi-stage abilities.


ReleaseSpecial() is called when the special button is released. This method is rarely used - most specials activate on button press. Override this only for abilities that need to track button hold duration or activate on release.


Movement and Physics Methods

Jumping and Air Movement

Jump() is called when a jump is initiated. Override this to modify jump behavior, add jump effects, or implement special jump mechanics.

Parameters:

  • wallJump - True if this is a wall jump, false for regular jumps

AirJump() handles double jumps or other mid-air jump abilities. Override this to implement special air jump mechanics or effects.

AirDashLeft() and AirDashRight() initiate directional air dashes. They set up the dash state and direction. Override these to implement custom dash attacks or movement abilities.


RunAirDashing() is called every update during an air dash. It manages dash timing and calls the appropriate directional dash method. Override this to customize dash behavior or add effects.

RunLeftAirDash() and RunRightAirDash() handle the movement physics for directional air dashes. They set velocity and create dash effects after the initial delay. Override to customize dash speed, effects, or damage.


ApplyFallingGravity() is called every update when the bro is falling. It applies different gravity based on parachute, quicksand, or normal states. Override this to modify gravity, implement gliding mechanics, or disable gravity during special abilities.


Ground Movement

CalculateMovement() is called every update to determine movement velocity based on player input. It handles different movement speeds for various states like ducking, ladder climbing, and normal movement. Override to modify movement speed or restrict movement during special states.


RunMovement() is called every update to apply movement and update the bro's position. It handles collision detection, position updates, and special movement states. Override to implement custom movement mechanics or update attached objects.

AddSpeedLeft() and AddSpeedRight() add horizontal velocity to the bro based on input. Override these to limit acceleration, modify speed curves, or disable movement during special states.


Land() is called when the bro touches ground after falling. It resets jump-related states and plays landing effects. Override to handle custom landing effects, reset air abilities, or implement special landing mechanics.


Animation Methods

ChangeFrame() is called when the animation frame needs to update based on the current action state. It determines which animation method to call (running, jumping, melee, etc.). Override this to handle custom animation states or frame-specific logic.


SetGestureAnimation() is called when the bro performs gestures like flexing. Override to handle gesture-specific behavior or cancel ongoing abilities.

Parameters:

  • gestureElement - The gesture being performed

AnimateInseminationFrames() handles special victory animations after boss defeats. This method is rarely overridden.


AnimateWallAnticipation() is called before the bro grabs a wall. Override to cancel abilities or prepare for wall grab animations.


AnimateWallDrag() is called while the bro slides down walls. Override to enable special actions or animations during wall slides.


CanCheckClimbAlongCeiling() determines if the bro can grab and climb along ceilings. Returns false by default. Override to enable ceiling climbing mechanics.


AttachToZipline() is called when the bro grabs a zipline. Override to handle cleanup or state changes when attaching.

Parameters:

  • x, y - The zipline attachment position

StartPilotingUnit() is called when the bro enters a vehicle. Override to handle cleanup or state changes when entering vehicles.

Parameters:

  • unitToPilot - The vehicle being entered

Damage and Health Methods

Damage() is called when the bro takes damage. It handles invulnerability, damage application, and death. Override to implement damage resistance, trigger transformations, or create special reactions to specific damage types.

Parameters:

  • damage - Amount of damage to apply
  • damageType - Type of damage (Bullet, Fire, Crush, etc.)
  • xI, yI - Knockback force
  • direction - Direction of impact (-1 left, 1 right)
  • damageSender - The object that caused the damage
  • hitX, hitY - World position of impact

Death() is called when the bro dies. It handles death animations, scoring, and cleanup. Override to implement special death behavior, release held objects, or trigger transformations instead of dying.

Parameters:

  • xI, yI - Death knockback velocity
  • damage - The damage object that killed the bro

Gib() is called when the bro is violently killed (exploded). It creates gore effects and destroys the bro. Override for special gibbing effects or alternate death animations.


Input and Control Methods

CheckInput() processes player input each update. It reads controller/keyboard input and sets the appropriate input flags. Override to detect custom input patterns or implement special controls.


CheckFacingDirection() updates which direction the bro faces based on input. It sets the transform's scale to flip the sprite. Override to lock facing direction during certain abilities or implement custom facing logic.


PressHighFiveMelee() is called when the high-five/melee button is pressed. It handles switches, pickups, high-fives, and melee attacks based on context. Override to add custom interactions or abilities.

Parameters:

  • forceHighFive - If true, forces a high-five attempt

Misc Methods

AlertNearbyMooks() is called when the bro makes noise that should alert enemies. It notifies nearby enemies of the bro's presence. Override to disable alerts during stealth abilities or modify alert behavior.


Clone this wiki locally