Classes

Concepts

Libraries

advertisement »

ambientSounds »

bitser »

contentPoints »

eventBoxText »

factValidity »

frameBuffer »

officeBuildingInserter »

priorityRenderer »

randomEvents »

scaling »

spritesheetParser »

statusIcons »

test3 »

util »

Objects

addState

Description

Add a state to process.

Arguments

1 table gameState

the game state object to process.

Example

-- taken straight from game/main_state.lua, which does all the necessary calls to all the necessary systems make the game work


local mainState = {}

function mainState:update(dt)
	camera:update(dt)
	timer:process(dt)
	particleSystem.manager:update(dt)
	
	if not game.savingGame then
		game.worldObject:update(dt)
		lightingManager:updateMain()
		game.update(dt)

		if not mapEditor.active then
			timeline:progress(dt)
			local progress = timeline.realProgressTime
			
			pedestrianController:update(progress)
			ambientSounds:update(dt)
			
			for key, object in ipairs(game.dynamicObjects) do
				object:update(dt, progress)
			end
			
			motivationalSpeeches:update(dt)
			autosave:update(dt)
		else
			mapEditor:update(dt)
		end
	end
end

-- now we add this state to the gameStateService (done elsewhere outside of this file)

gameStateService:addState(mainState)