NAME
Game::Controller - Worm Game Controller with a Worm, Lawn, UI etc.
SYNOPSIS
Nah...
PROPERTIES
oWorm
Game::Object::Worm object controlled by user.
Default: undef
oLawn
Game::Lawn object.
oUI
Game::UI object.
rhTimedObject
Hash ref with (key: object, value: object) with objects that should be timed in the main loop.
Default: {}
METHODS
new($offsetLeft, $offsetTop, $lawnWidth, $lawnHeight)
Create new App with a UI located at $offsetLeft/$offsetTop, with a Lawn with the dimensions $lawnWidth, $lawnHeight.
placeWormOnLawn($oObject)
Place the $oObject on the Lawn and keep track of it.
Return 1 on success, else 0.
placeWormBotOnLawn($oObject)
Place the $oObject on the Lawn and keep track of it.
Return 1 on success, else 0.
placePrizeOnLawn($oObject)
Place the $oObject on the Lawn and keep track of it.
Return 1 on success, else 0.
placeWallOnLawn($oObject)
Place the $oObject on the Lawn and keep track of it.
Return 1 on success, else 0.
placeObjectOnLawn($oObject)
Place the $oObject on the Lawn and keep track of it.
Return 1 on success, else 0.
addTimedObject($oObject)
Add $oObject to the rhTimedObject, to be timed in the main loop.
Return 1 on success, else 0.
removeWormFromLawn($oObject)
Remove the Worm $oObject from the Lawn and the App.
Return 1 on success, else 0.
createWormBotLike([$oObject])
Create a new Worm Bot. If $oObject is passed, clone values from it.
Place the new Bot somewhere on the Lawn.
Return 1 on success, else 0.
run()
Run the main loop.
Return 1 on success, else 0. Die on fatal errors.
prizeWasClaimedBy($oPrize, $oObject)
The $oPrize was just claimed by $oObject and removed from the Lawn.
Update the score display.
Put another Prize on the Lawn
Return 1 on success, else 0.
wormHasCrashed($oObject)
The Worm $oObject just crashed.
If it was a bot, replace it.
#If it was a player, do something...
Return 1 on success, else 0.