Skip to content

Accessing Game Data

Tom Sherman edited this page Mar 7, 2017 · 8 revisions

game_state.h

This header provides access to all of the raw game data. There is a global GameState struct declared here - _gameState. To keep this up to date you should call updateGameState every frame (happens internally if using the AI).

_gameState.stage is a Stage struct. It has the following fields:

_gameState.stage.name = StageName
_gameState.stage.side.height = height of side platform
_gameState.stage.side.left = left limit of right side platform
_gameState.stage.side.right = right limit of right side platform
_gameState.top... = same thing but for top platform
_gameState.stage.ledge = x-coordinate of right ledge

_gameState.playerData is an array of pointers to PlayerData structs. The first element is blank so that way access lines up with player number, i.e. _gameState.playerData[1] is player one's data. Remember this is a pointer, e.g. _gameState.playerData[1]->percent is the percent of player 1.

state_check.h

This header provides useful functions for checking certain game states within a logic struct. All arguments are FunctionArg so these functions are compatible with Logic structs.

Clone this wiki locally