-
Notifications
You must be signed in to change notification settings - Fork 0
glossary need review
RunFiring()
is called every frame while the fire button is held. This method handles ongoing firing logic like charging, burst timing, or continuous effects. It typically calls UseFire()
when ready to shoot.
StopFiring()
is called when the fire button is released or when firing is interrupted. Use this to clean up any firing state, stop continuous effects, or reset charge timers.
ReleaseFire()
is called when the fire button is released, before StopFiring()
. This method is rarely needed but can be useful for weapons that fire on button release or need to track how long the button was held.
UseFire()
triggers a single shot. By default, it cancels melee and calls FireWeapon()
. Override this to add conditions before firing or implement alternate fire modes.
Note: This is typically called by RunFiring()
, not directly by input.
FireWeapon()
creates the actual projectile or attack effect. The parameters provide the spawn position and initial velocity.
Parameters:
-
x, y
- World position to spawn the projectile (accounts for gun position) -
xSpeed, ySpeed
- Initial velocity for the projectile
Override this to spawn custom projectiles, create special patterns, or implement entirely different attack types.
RunGun()
is called every frame to handle gun sprite animations. Use this for muzzle flashes, charging effects, or weapon switching animations. The base game uses gunFrame to track animation progress.
SetGunPosition()
adjusts where the gun sprite appears relative to your bro. The offsets are added to the base position. This is called automatically by the game during rendering.
SetGunSprite()
changes which gun sprite is displayed. Most bros set this.gunSprite
directly instead of overriding this method.
Parameters:
-
spriteFrame
- Animation frame to display -
spriteRow
- Gun sprite row to use
ActivateGun()
and DeactivateGun()
show or hide the gun sprite. Override these when you need to control gun visibility, such as for melee weapons that only appear during attacks.
The melee system follows this pattern:
- Player presses melee →
SetMeleeType()
determines melee type -
StartCustomMelee()
initializes the melee attack - During melee →
AnimateCustomMelee()
andRunCustomMeleeMovement()
run each frame -
AnimateCustomMelee()
calls →PerformCustomMeleeAttack()
at the damage frame - Melee ends naturally or →
CancelMelee()
if interrupted
StartCustomMelee()
is called when the melee button is pressed. Use this to initialize your melee attack, set the melee type, and configure damage values. You can implement different melee attacks based on your bro's current state or equipment.
Note: For custom melee to work properly, you need to set this.meleeType
in Start()
to something other than MeleeType.Knife
.
SetMeleeType()
is called before starting melee to determine the melee type based on your bro's state (standing, jumping, dashing). Override this if you need different melee behaviors in different states.
AnimateCustomMelee()
is called every frame during melee to handle animations. Use this to progress through animation frames and call PerformCustomMeleeAttack()
at the appropriate frame to deal damage.
RunCustomMeleeMovement()
is called every frame during melee to control movement. Use this to add dashing attacks, limit movement, or apply special physics during melee.
CancelMelee()
is called when melee is interrupted by other actions. Use this to clean up any melee state, stop sounds, or reset visual effects.
ThrowBackMook()
is called when your bro throws an enemy. Override this to add special effects or behaviors to thrown enemies.
The special ability system follows this pattern:
- Player presses special →
PressSpecial()
called (sets usingSpecial = true) -
UseSpecial()
is called to consume ammo and trigger the effect -
AnimateSpecial()
handles the animation frames - Player releases special →
ReleaseSpecial()
called (rarely used)
PressSpecial()
is called when the special button is first pressed. Use this to start charging abilities, trigger instant effects, or set up special states. The default behavior sets usingSpecial = true
.
UseSpecial()
consumes special ammo and executes the special ability. By default, this throws a grenade. Override to implement custom abilities like spawning objects, transforming, or applying buffs.
AnimateSpecial()
handles the animation frames for special abilities. Use this to animate throwing motions, transformations, or charging effects.
ReleaseSpecial()
is called when the special button is released. In the base game, this is mostly unused, other than BroLander who uses it to allow holding down special to continuously use specials. Most custom bros won't need to override this.
Jump()
is called when a jump is initiated. The wallJump
parameter indicates if this is a wall jump. Override this to modify jump behavior, cancel states, or add effects.
AirJump()
handles double jumps or other mid-air jump abilities. Override this to add special mechanics during air jumps.
AirDashLeft()
and AirDashRight()
are called to initiate directional air dashes. Override these to implement custom dash attacks or movement abilities.
RunAirDashing()
is called every frame during an air dash. Use this to maintain dash effects or update dash physics.
RunLeftAirDash()
and RunRightAirDash()
handle the physics and damage for directional air dashes. Override to customize dash behavior and effects.
ApplyFallingGravity()
is called every frame when the bro is falling. Override this to modify gravity, implement gliding mechanics, or disable gravity during special abilities.
CalculateMovement()
is called every frame to determine movement velocity based on player input. Override to modify movement speed or restrict movement during special states.
RunMovement()
is called every frame to apply movement and update the bro's position. Override to implement custom movement mechanics or update attached objects.
AddSpeedLeft()
and AddSpeedRight()
add horizontal velocity to the bro. Override these to limit or modify speed during special moves or abilities.
Land()
is called when the bro touches ground after falling. Override to handle landing effects, reset air abilities, or implement special landing mechanics.
ChangeFrame()
is called when the animation frame updates. Use this to handle frame-specific logic, cancel abilities during certain animations, or prevent animation conflicts.
SetGestureAnimation()
is called when the bro performs gestures like flexing. Override to handle gesture-specific behavior or cancel ongoing abilities.
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. Override to enable ceiling mechanics.
AttachToZipline()
is called when the bro grabs a zipline. The parameters specify the zipline position. Override to handle cleanup or state changes when attaching.
StartPilotingUnit()
is called when the bro enters a vehicle. Override to handle cleanup or state changes when entering vehicles.
public override void Damage(int damage, DamageType damageType, float xI, float yI, int direction, MonoBehaviour damageSender, float hitX, float hitY)
Damage()
is called when the bro takes damage. 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. Override to handle 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). Override for special gibbing effects or alternate death animations.
CheckInput()
processes player input. Override to detect custom input patterns or implement special controls.
CheckFacingDirection()
updates which direction the bro faces based on input. Override to lock facing direction during certain abilities.
PressHighFiveMelee()
is called when the high-five button is pressed. Override to trigger special abilities or handle detachment from surfaces.
AlertNearbyMooks()
is called when the bro makes noise that should alert enemies. Override to disable alerts during stealth abilities or modify alert behavior.
If you have questions or need help with creating custom bros, you can join the Free Lives Discord Server and post your questions in the bf-mods channel.