Builder Manual Play
Builder Manual / Constants Reference

CONST / Constants Reference

Constants Reference

Named limits, dimensions, scores, timings, and gameplay constants.

Constants Reference


A curated reference for gameplay-facing compile-time constants in the codebase. Some local helper constants live beside their implementation and are intentionally summarized rather than exhaustively duplicated here.


game.h Constants

These are available to every file that #include "game.h".

Window

ConstantValueDescription
WINDOW_TITLE"Super Mango"Text shown in the OS title bar
WINDOW_W800OS window width in physical pixels
WINDOW_H600OS window height in physical pixels

Do not use WINDOW_W / WINDOW_H for game object math. All game objects live in logical space.

Logical Canvas

ConstantValueDescription
GAME_W400Internal canvas width in logical pixels
GAME_H300Internal canvas height in logical pixels

SDL_RenderSetLogicalSize(renderer, GAME_W, GAME_H) makes SDL scale every draw call from 400x300 up to 800x600 automatically, producing a 2x pixel scale (each logical pixel = 2x2 physical pixels).

Timing

ConstantValueDescription
TARGET_FPS60Desired frames per second

Used to compute frame_ms = 1000 / TARGET_FPS (approximately 16 ms), which is the manual frame-cap duration when VSync is unavailable.

Tiles and Floor

ConstantValueExpressionDescription
TILE_SIZE48literalWidth and height of one grass tile (px)
FLOOR_Y252GAME_H - TILE_SIZEY coordinate of the floor’s top edge

The floor is drawn by repeating the active 48x48 floor tile across the full level width at y=FLOOR_Y, with gaps cut out at each floor-gap position.

Physics

ConstantValueTypeDescription
GRAVITY800.0ffloatDownward acceleration in px/s^2
FLOOR_GAP_W32intWidth of each floor gap in logical pixels
MAX_FLOOR_GAPS16intMaximum number of floor gaps per level

Every frame while airborne: player->vy += GRAVITY * dt.

At 60 FPS (dt approximately 0.016s) gravity adds ~12.8 px/s per frame. The jump impulse (-325.0f px/s) produces a moderate arc.

Camera

ConstantValueTypeDescription
WORLD_W1600intTotal logical level width (4 x GAME_W)
CAM_LOOKAHEAD_VX_FACTOR0.20ffloatCamera lookahead pixels per px/s of player horizontal velocity
CAM_LOOKAHEAD_MAX50.0ffloatMaximum lookahead offset in either direction
CAM_SMOOTHING8.0ffloatLerp speed factor (per second); higher = snappier follow
CAM_SNAP_THRESHOLD0.5ffloatSub-pixel distance at which the camera snaps exactly to target

WORLD_W defines the full scrollable level width. The visible canvas is always GAME_W (400 px); the Camera struct tracks the left edge of the viewport in world coordinates.


Player Constants

Frame/hitbox constants live in player_internal.h; movement defaults live in player_lifecycle.c; jump/climb constants live in focused helper files.

ConstantValueDescription
PLAYER_FRAME_W48Width of one sprite frame in the sheet (px)
PLAYER_FRAME_H48Height of one sprite frame in the sheet (px)
PLAYER_FLOOR_SINK16Visual overlap onto the floor tile to prevent floating feet
PLAYER_PHYS_PAD_X15Pixels trimmed from each horizontal side of the frame for the physics box (physics width = 48 - 30 = 18 px)
PLAYER_PHYS_PAD_TOP18Pixels trimmed from the top of the frame
PLAYER_COYOTE_TIME0.10fPost-edge jump grace window

Why PLAYER_FLOOR_SINK?

The player.png sprite sheet has transparent padding at the bottom of each 48x48 frame. Without the sink offset, the physics floor edge (y + h = FLOOR_Y) would leave the character visually floating 16 px above the grass. PLAYER_FLOOR_SINK compensates:

floor_snap = FLOOR_Y - player->h + PLAYER_FLOOR_SINK
           = 252      - 48        + 16
           = 220

The character’s sprite appears to rest naturally on the grass at that Y.


Animation Tables in player_animation.c

Static arrays indexed by AnimState (0 = ANIM_IDLE, 1 = ANIM_WALK, 2 = ANIM_JUMP, 3 = ANIM_FALL, 4 = ANIM_CLIMB):

static const int ANIM_FRAME_COUNT[5] = { 4,   4,   2,   1,   2   };
static const int ANIM_FRAME_MS[5]    = { 150, 100, 150, 200, 100 };
static const int ANIM_FIRST_FRAME[5] = { 0,   4,   8,   12,  16  };
IndexStateFramesms/frameFirst frameSheet row
0ANIM_IDLE41500Row 0
1ANIM_WALK41004Row 1
2ANIM_JUMP21508Row 2
3ANIM_FALL120012Row 3
4ANIM_CLIMB210016Row 4

Movement Defaults in player_lifecycle.c

ConstantValueDescription
WALK_MAX_SPEED100.0fWalking speed cap (px/s)
RUN_MAX_SPEED250.0fRunning speed cap (px/s)
WALK_GROUND_ACCEL750.0fGround walk acceleration (px/s²)
RUN_GROUND_ACCEL600.0fGround run acceleration (px/s²)
GROUND_FRICTION550.0fGround braking with no input (px/s²)
GROUND_COUNTER_ACCEL100.0fExtra braking when reversing (px/s²)
AIR_ACCEL_WALK350.0fAir walk acceleration (px/s²)
AIR_ACCEL_RUN180.0fAir run acceleration (px/s²)
AIR_FRICTION80.0fPassive air drag (px/s²)

Jump / Climb Constants

ConstantValueLocationDescription
JUMP_VY-325.0fplayer_jump.cJump impulse
JUMP_BUFFER_TIME0.10fplayer_jump.cPre-landing jump input buffer
JUMP_CUT_FACTOR0.45fplayer_jump.cJump shortening when input released
CLIMB_SPEED80.0fplayer_input.cVertical climb speed
CLIMB_H_SPEED80.0fplayer_input.cHorizontal climb drift
PLAYER_CLIMB_GRAB_PAD4player_climb.cExtra grab width around climbables

Audio Constants in main.c

ValueDescription
44100Audio sample rate (Hz)
MIX_DEFAULT_FORMAT16-bit signed samples
2Stereo channels
2048Mixer buffer size (samples)
13Music volume (0-128, approximately 10%) set in game_init

Derived Values Quick Reference

ExpressionResultMeaning
WINDOW_W / GAME_W2xHorizontal pixel scale factor
WINDOW_H / GAME_H2xVertical pixel scale factor
1000 / TARGET_FPS~16 msFrame budget
GAME_H - TILE_SIZE252FLOOR_Y
FLOOR_Y - PLAYER_FRAME_H + PLAYER_FLOOR_SINK220Player start / floor snap Y
GAME_W / TILE_SIZE~8.3Tiles needed to fill the floor
WATER_FRAMES x WATER_ART_W128WATER_PERIOD — seamless repeat distance

platform.h Constants

ConstantValueDescription
MAX_PLATFORMS32Maximum platform placements per level

water.h Constants

ConstantValueTypeDescription
WATER_FRAMES8intTotal animation frames in water.png
WATER_FRAME_W48intFull slot width per frame in the sheet (px)
WATER_ART_DX16intLeft offset to visible art within each slot
WATER_ART_W16intWidth of actual art pixels per frame
WATER_ART_Y17intFirst visible row within each frame
WATER_ART_H31intHeight of visible art pixels
WATER_PERIOD128intPattern repeat distance: WATER_FRAMES x WATER_ART_W
WATER_SCROLL_SPEED40.0ffloatRightward scroll speed (px/s)

spider.h Constants

ConstantValueTypeDescription
MAX_SPIDERS16intMaximum spider placements per level
SPIDER_FRAMES3intAnimation frames in spider.png (192/64 = 3)
SPIDER_FRAME_W64intWidth of one frame slot in the sheet (px)
SPIDER_ART_X20intFirst visible col within each frame slot
SPIDER_ART_W25intWidth of visible art (cols 20-44)
SPIDER_ART_Y22intFirst visible row within each frame slot
SPIDER_ART_H10intHeight of visible art (rows 22-31)
SPIDER_SPEED50.0ffloatWalk speed (px/s)
SPIDER_FRAME_MS150intMilliseconds each animation frame is held

fog.h Constants

ConstantValueTypeDescription
MAX_FOG_TEXTURES4intMaximum fog texture paths loaded from fog_layers
FOG_MAX4intMaximum concurrent fog instances

parallax.h Constants

ConstantValueTypeDescription
MAX_BACKGROUND_LAYERS8intMaximum number of background layers the system can hold

coin.h Constants

ConstantValueTypeDescription
MAX_COINS64intMaximum coin placements per level
COIN_DISPLAY_W16intRender width in logical pixels
COIN_DISPLAY_H16intRender height in logical pixels
COIN_SCORE100intScore awarded per coin collected
SCORE_PER_LIFE1000intScore multiple that grants a bonus life

vine.h Constants

ConstantValueTypeDescription
MAX_VINES24intMaximum number of vine instances
VINE_W16intSprite width in logical pixels
VINE_H32intContent height after removing transparent padding
VINE_SRC_Y8intFirst pixel row with content in vine textures
VINE_SRC_H32intHeight of content area in vine textures
VINE_STEP19intVertical spacing between stacked tiles (px)

fish.h Constants

ConstantValueTypeDescription
MAX_FISH16intMaximum fish placements per level
FISH_FRAMES2intHorizontal frames in fish.png (96x48 sheet)
FISH_FRAME_W48intWidth of one frame slot in the sheet (px)
FISH_FRAME_H48intHeight of one frame slot in the sheet (px)
FISH_RENDER_W48intOn-screen render width in logical pixels
FISH_RENDER_H48intOn-screen render height in logical pixels
FISH_SPEED70.0ffloatHorizontal patrol speed (px/s)
FISH_JUMP_VY-280.0ffloatUpward jump impulse (px/s)
FISH_JUMP_MIN1.4ffloatMinimum seconds before next jump
FISH_JUMP_MAX3.0ffloatMaximum seconds before next jump
FISH_HITBOX_PAD_X16intHorizontal inset for fair AABB collision (hitbox width = 16 px)
FISH_HITBOX_PAD_Y13intVertical inset for fair AABB collision (hitbox height = 19 px)
FISH_FRAME_MS120intMilliseconds per swim animation frame

hud.h Constants

ConstantValueTypeDescription
MAX_HEARTS3intMaximum hearts the player can have
DEFAULT_LIVES3intLives the player starts with
HUD_MARGIN4intPixel margin from screen edges
HUD_HEART_SIZE16intDisplay size of each heart icon (px)
HUD_HEART_GAP2intHorizontal gap between heart icons (px)
HUD_ICON_W16intDisplay width of the player icon (px)
HUD_ICON_H13intDisplay height of the player icon (px)
HUD_ROW_H16intRow height for text alignment (font px)
HUD_COIN_ICON_SIZE12intDisplay size of the coin count icon (px)

bouncepad.h Constants

ConstantValueTypeDescription
MAX_BOUNCEPADS4intMaximum simultaneous bouncepad instances
BOUNCEPAD_W48intDisplay width of one bouncepad frame (px)
BOUNCEPAD_H48intDisplay height of one bouncepad frame (px)
BOUNCEPAD_VY_SMALL-380.0ffloatSmall bouncepad launch impulse (px/s)
BOUNCEPAD_VY_MEDIUM-536.25ffloatMedium bouncepad launch impulse (px/s)
BOUNCEPAD_VY_HIGH-700.0ffloatHigh bouncepad launch impulse (px/s)
BOUNCEPAD_VY-536.25ffloatDefault launch impulse (alias for BOUNCEPAD_VY_MEDIUM)
BOUNCEPAD_FRAME_MS80intMilliseconds per animation frame during release
BOUNCEPAD_SRC_Y14intFirst non-transparent row in the frame
BOUNCEPAD_SRC_H18intHeight of the art region (rows 14-31)
BOUNCEPAD_ART_X16intFirst non-transparent col in the frame
BOUNCEPAD_ART_W16intWidth of the art region (cols 16-31)

rail.h Constants

ConstantValueTypeDescription
RAIL_N1 << 0bitmaskTile opens upward
RAIL_E1 << 1bitmaskTile opens rightward
RAIL_S1 << 2bitmaskTile opens downward
RAIL_W1 << 3bitmaskTile opens leftward
RAIL_TILE_W16intWidth of one tile in the sprite sheet (px)
RAIL_TILE_H16intHeight of one tile in the sprite sheet (px)
MAX_RAIL_TILES128intMaximum tiles in a single Rail path
MAX_RAILS16intMaximum Rail instances per level

spike_block.h Constants

ConstantValueTypeDescription
SPIKE_DISPLAY_W24intOn-screen width in logical pixels (16x16 scaled up)
SPIKE_DISPLAY_H24intOn-screen height in logical pixels
SPIKE_SPIN_DEG_PER_SEC360.0ffloatRotation speed — one full turn per second
SPIKE_SPEED_SLOW1.5ffloatRail traversal: 1.5 tiles/s
SPIKE_SPEED_NORMAL3.0ffloatRail traversal: 3.0 tiles/s
SPIKE_SPEED_FAST6.0ffloatRail traversal: 6.0 tiles/s
SPIKE_PUSH_SPEED220.0ffloatHorizontal push impulse magnitude (px/s)
SPIKE_PUSH_VY-150.0ffloatUpward push component on collision (px/s)
MAX_SPIKE_BLOCKS16intMaximum spike block instances per level

debug.h Constants

ConstantValueTypeDescription
DEBUG_LOG_MAX_ENTRIES8intMaximum visible log messages
DEBUG_LOG_MSG_LEN64intMax characters per log message (incl. null)
DEBUG_LOG_DISPLAY_SEC4.0ffloatSeconds each log entry stays visible
DEBUG_FPS_SAMPLE_MS500intMilliseconds between FPS counter refreshes

jumping_spider.h Constants

ConstantValueTypeDescription
MAX_JUMPING_SPIDERS16intMaximum jumping spider placements per level
JSPIDER_FRAMES3intAnimation frames in jumping_spider.png (192/64 = 3)
JSPIDER_FRAME_W64intWidth of one frame slot in the sheet (px)
JSPIDER_ART_X20intFirst visible col within each frame
JSPIDER_ART_W25intWidth of visible art (cols 20-44)
JSPIDER_ART_Y22intFirst visible row within each frame
JSPIDER_ART_H10intHeight of visible art (rows 22-31)
JSPIDER_SPEED55.0ffloatWalk speed (px/s)
JSPIDER_FRAME_MS150intMilliseconds per animation frame
JSPIDER_JUMP_VY-200.0ffloatUpward jump impulse (px/s)
JSPIDER_GRAVITY600.0ffloatDownward acceleration while airborne (px/s^2)

bird.h Constants

ConstantValueTypeDescription
MAX_BIRDS16intMaximum bird placements per level
BIRD_FRAMES3intAnimation frames in bird.png (144/48 = 3)
BIRD_FRAME_W48intWidth of one frame slot in the sheet (px)
BIRD_ART_X17intFirst visible col within each frame
BIRD_ART_W15intWidth of visible art (cols 17-31)
BIRD_ART_Y17intFirst visible row within each frame
BIRD_ART_H14intHeight of visible art (rows 17-30)
BIRD_SPEED45.0ffloatHorizontal flight speed (px/s)
BIRD_FRAME_MS140intMilliseconds per wing animation frame
BIRD_WAVE_AMP20.0ffloatSine-wave amplitude in logical pixels
BIRD_WAVE_FREQ0.015ffloatSine cycles per pixel of horizontal travel

faster_bird.h Constants

ConstantValueTypeDescription
MAX_FASTER_BIRDS16intMaximum faster bird placements per level
FBIRD_FRAMES3intAnimation frames in faster_bird.png (144/48 = 3)
FBIRD_FRAME_W48intWidth of one frame slot in the sheet (px)
FBIRD_ART_X17intFirst visible col within each frame
FBIRD_ART_W15intWidth of visible art (cols 17-31)
FBIRD_ART_Y17intFirst visible row within each frame
FBIRD_ART_H14intHeight of visible art (rows 17-30)
FBIRD_SPEED80.0ffloatHorizontal speed — nearly 2x the slow bird
FBIRD_FRAME_MS90intFaster wing animation (ms per frame)
FBIRD_WAVE_AMP15.0ffloatTighter sine-wave amplitude (px)
FBIRD_WAVE_FREQ0.025ffloatHigher frequency — more erratic curves

float_platform.h Constants

ConstantValueTypeDescription
FLOAT_PLATFORM_PIECE_W16intWidth of each 3-slice piece (px)
FLOAT_PLATFORM_H16intHeight of the platform sprite (px)
MAX_FLOAT_PLATFORMS16intMaximum float platform instances per level
CRUMBLE_STAND_LIMIT0.75ffloatSeconds of standing before crumble-fall starts
CRUMBLE_FALL_GRAVITY250.0ffloatDownward acceleration during crumble fall (px/s^2)
CRUMBLE_FALL_INITIAL_VY20.0ffloatInitial downward velocity on crumble-start (px/s)

bridge.h Constants

ConstantValueTypeDescription
MAX_BRIDGES16intMaximum bridge instances per level
MAX_BRIDGE_BRICKS16intMaximum bricks in a single bridge
BRIDGE_TILE_W16intWidth of one bridge.png tile (px)
BRIDGE_TILE_H16intHeight of one bridge.png tile (px)
BRIDGE_FALL_DELAY0.2ffloatSeconds between touch and first brick falling
BRIDGE_CASCADE_DELAY0.06ffloatExtra seconds between successive bricks cascading outward
BRIDGE_FALL_GRAVITY250.0ffloatDownward acceleration per brick during fall (px/s^2)
BRIDGE_FALL_INITIAL_VY20.0ffloatInitial downward velocity on fall-start (px/s)

star_yellow.h Constants

ConstantValueTypeDescription
MAX_STAR_YELLOWS16intMaximum yellow star instances per level
STAR_YELLOW_DISPLAY_W16intDisplay width (logical px)
STAR_YELLOW_DISPLAY_H16intDisplay height (logical px)

last_star.h Constants

ConstantValueTypeDescription
LAST_STAR_DISPLAY_W24intDisplay width (logical px)
LAST_STAR_DISPLAY_H24intDisplay height (logical px)

axe_trap.h Constants

ConstantValueTypeDescription
AXE_FRAME_W48intSource sprite width (px)
AXE_FRAME_H64intSource sprite height (px)
AXE_DISPLAY_W48intOn-screen display width (logical px)
AXE_DISPLAY_H64intOn-screen display height (logical px)
AXE_SWING_AMPLITUDE60.0ffloatMaximum pendulum angle from vertical (degrees)
AXE_SWING_PERIOD2.0ffloatTime for one full pendulum cycle (s)
AXE_SPIN_SPEED180.0ffloatRotation speed for spin variant (degrees/s)
MAX_AXE_TRAPS16intMaximum axe trap instances per level

circular_saw.h Constants

ConstantValueTypeDescription
SAW_FRAME_W32intSource sprite width (px)
SAW_FRAME_H32intSource sprite height (px)
SAW_DISPLAY_W32intOn-screen display width (logical px)
SAW_DISPLAY_H32intOn-screen display height (logical px)
SAW_SPIN_DEG_PER_SEC720.0ffloatRotation speed (degrees/s)
SAW_PATROL_SPEED180.0ffloatHorizontal patrol speed (px/s)
SAW_PUSH_SPEED220.0ffloatPush impulse magnitude (px/s)
SAW_PUSH_VY-150.0ffloatUpward bounce component on collision (px/s)
MAX_CIRCULAR_SAWS16intMaximum circular saw instances per level

blue_flame.h Constants

ConstantValueTypeDescription
BLUE_FLAME_FRAME_W48intAnimation frame width (px)
BLUE_FLAME_FRAME_H48intAnimation frame height (px)
BLUE_FLAME_DISPLAY_W48intOn-screen display width (logical px)
BLUE_FLAME_DISPLAY_H48intOn-screen display height (logical px)
BLUE_FLAME_FRAME_COUNT2intNumber of animation frames
BLUE_FLAME_ANIM_SPEED0.1ffloatSeconds between frame advances
BLUE_FLAME_LAUNCH_VY-550.0ffloatInitial upward impulse (px/s)
BLUE_FLAME_RISE_DECEL800.0ffloatDeceleration during rise (px/s^2)
BLUE_FLAME_APEX_Y60.0ffloatWorld-space y coordinate at apex (px)
BLUE_FLAME_FLIP_DURATION0.12ffloatTime to rotate 180 degrees at apex (s)
BLUE_FLAME_WAIT_DURATION1.5ffloatTime hidden below floor before next eruption (s)
MAX_BLUE_FLAMES16intMaximum blue flame instances per level
MAX_FIRE_FLAMES16intMaximum fire flame instances per level

faster_fish.h Constants

ConstantValueTypeDescription
MAX_FASTER_FISH16intMaximum faster fish instances per level
FFISH_FRAMES2intNumber of animation frames
FFISH_FRAME_W48intFrame width (px)
FFISH_FRAME_H48intFrame height (px)
FFISH_RENDER_W48intRender width (logical px)
FFISH_RENDER_H48intRender height (logical px)
FFISH_SPEED120.0ffloatPatrol speed (px/s)
FFISH_JUMP_VY-420.0ffloatJump impulse (px/s)
FFISH_JUMP_MIN1.0ffloatMinimum delay between jumps (s)
FFISH_JUMP_MAX2.2ffloatMaximum delay between jumps (s)
FFISH_HITBOX_PAD_X16intHorizontal hitbox inset (px)
FFISH_HITBOX_PAD_Y13intVertical hitbox inset (px)
FFISH_FRAME_MS100intFrame animation duration (ms)

spike.h Constants

ConstantValueTypeDescription
MAX_SPIKE_ROWS16intMaximum spike row instances per level
MAX_SPIKE_TILES16intMaximum tiles in a single spike row
SPIKE_TILE_W16intSpike tile width (px)
SPIKE_TILE_H16intSpike tile height (px)

spike_platform.h Constants

ConstantValueTypeDescription
MAX_SPIKE_PLATFORMS16intMaximum spike platform instances per level
SPIKE_PLAT_PIECE_W16intWidth of one 3-slice piece (px)
SPIKE_PLAT_H16intFull frame height (px)
SPIKE_PLAT_SRC_Y5intFirst content row in each piece (px)
SPIKE_PLAT_SRC_H11intContent height (rows 5-15, px)

ladder.h Constants

ConstantValueTypeDescription
MAX_LADDERS16intMaximum ladder instances per level
LADDER_W16intSprite width (px)
LADDER_H22intContent height after cropping padding (px)
LADDER_SRC_Y13intFirst pixel row with content
LADDER_SRC_H22intHeight of content area (px)
LADDER_STEP8intVertical overlap when tiling (px)

rope.h Constants

ConstantValueTypeDescription
MAX_ROPES16intMaximum rope instances per level
ROPE_W16intDisplay width (full sprite width, px)
ROPE_H36intDisplay height with padding (px)
ROPE_SRC_X0intSource crop x offset (px)
ROPE_SRC_Y6intSource crop y offset (px)
ROPE_SRC_W16intSource crop width (full sprite width, px)
ROPE_SRC_H36intSource crop height (px)
ROPE_STEP23intVertical spacing between stacked tiles (px)

bouncepad_small.h / bouncepad_medium.h / bouncepad_high.h Constants

ConstantValueTypeDescription
MAX_BOUNCEPADS_SMALL16intMaximum small bouncepad instances
MAX_BOUNCEPADS_MEDIUM16intMaximum medium bouncepad instances
MAX_BOUNCEPADS_HIGH16intMaximum high bouncepad instances