client.brickblock.fwimpl
Class BrickBlock

java.lang.Object
  extended by MIDlet
      extended by client.framework.models.AbstractGame
          extended by client.brickblock.fwimpl.BrickBlock

public class BrickBlock
extends AbstractGame

The implementation of the abstract class AbstractGame, which contains the most important data for running a game in the framework framework. In addition to the default features offered by AbstractGame, this class contain support for sending and receiving information about placing and picking up PowerUp objects.

Author:
Martin Jarrett, Eivind Sorteberg

Field Summary
 
Fields inherited from class client.framework.models.AbstractGame
communicator, game, lobby, MOVEMENT_PREDICTION, parser, self, SEP_ACTION, TEAMCOLORS
 
Constructor Summary
BrickBlock()
           
 
Method Summary
protected  GameView createGameView()
          Returns a new GameView instance, which is this game's implementation of the GameView class.
protected  void createSpecialSettings()
          Not implemented.
 void fireForceMove(AbstractPlayer other, int[] movement)
          Called when the local player "force moves" (pushes) another player.
 void firePowerupPickedUp(Powerup powerup)
          Called when the local player picks up a power up.
 BBBoard getGameBoard()
          Returns the active game board used in the game.
 java.lang.String getGameName()
          Returns the name of this game; "BrickBlock".
protected  boolean handleSpecialSettings(boolean init)
          Not implemented.
 AbstractPlayer newPlayer(java.lang.String address, java.lang.String name)
          Returns a new BBPlayer instance, which is this game's implementation of the AbstractPlayer class.
protected  void notifyAboutSpecialActionReceived(AbstractPlayer sender, java.lang.String action, java.lang.String[][] values)
          This method is responsible for parsing the incoming actions that can not be parsed by the notifyAboutMessageReceived() method in AbstractGame.
 void startFramework(java.lang.String name, java.lang.String[] addresses, int packetSize)
          Initialises the framework.
 
Methods inherited from class client.framework.models.AbstractGame
addPlayer, addSetting, destroyApp, fireChangeSettingsSelected, fireHitTrap, fireMessagesChanged, firePlayerListChanged, firePlayerReady, fireReadySelected, fireReturnToGameSelected, fireSelfMoved, fireSessionSelected, fireSettingsUpdated, flashAndVibrate, getNumberOfPlayers, getParser, getPlayer, getPlayerlist, getSelf, getSessions, getSettings, getView, isTeamsEnabled, loadGame, notifyAboutMessageReceived, pauseApp, quit, refreshSessionList, removePlayer, sendPlayerInfo, setView, showAlert, startApp, startGame, stopGame, viewLobby
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BrickBlock

public BrickBlock()
Method Detail

startFramework

public void startFramework(java.lang.String name,
                           java.lang.String[] addresses,
                           int packetSize)
Initialises the framework.

Overrides:
startFramework in class AbstractGame
Parameters:
name - The name of the local player.
addresses - The address(es) of the server(s) to connect to
packetSize - The maximum packet size (when using UDP)

newPlayer

public AbstractPlayer newPlayer(java.lang.String address,
                                java.lang.String name)
Returns a new BBPlayer instance, which is this game's implementation of the AbstractPlayer class.

Specified by:
newPlayer in class AbstractGame
Parameters:
address - The player's address.
name - The player's name.
Returns:
A new BBPlayer instance.
See Also:
AbstractPlayer.AbstractPlayer(String, String, int, int)

createGameView

protected GameView createGameView()
Returns a new GameView instance, which is this game's implementation of the GameView class.

Specified by:
createGameView in class AbstractGame
Returns:
A new BBBoard using this as its model.

getGameBoard

public BBBoard getGameBoard()
Returns the active game board used in the game.

Returns:
The active game board.
See Also:
createGameView()

getGameName

public java.lang.String getGameName()
Returns the name of this game; "BrickBlock".

Specified by:
getGameName in class AbstractGame
Returns:
A String containing "BrickBlock".

firePowerupPickedUp

public void firePowerupPickedUp(Powerup powerup)
Called when the local player picks up a power up. A notification of this is created using the parser and transmitted to the server using the active Communicator object.

Parameters:
powerup - The power up picked up or timed out
See Also:
MessageParser.createMessage(client.framework.network.parser.Action, Object[][]), Communicator.sendMessage(Object, boolean)

fireForceMove

public void fireForceMove(AbstractPlayer other,
                          int[] movement)
Called when the local player "force moves" (pushes) another player. When this occurs, how much the other player is pushed is transmitted to the server using the active parser and communicator objects.

Parameters:
other - The player that is pushed.
movement - How much the player is pushed.
See Also:
MessageParser.createMessage(client.framework.network.parser.Action, Object[][]), Communicator.sendMessage(Object, boolean)

notifyAboutSpecialActionReceived

protected void notifyAboutSpecialActionReceived(AbstractPlayer sender,
                                                java.lang.String action,
                                                java.lang.String[][] values)
This method is responsible for parsing the incoming actions that can not be parsed by the notifyAboutMessageReceived() method in AbstractGame. These actions are related to either positioning power up or trap objects on the board, players picking up power up objects, power ups being deactivated, or one player pushing another on the game board. Dependent of what kind of action is received, different methods are called.

Specified by:
notifyAboutSpecialActionReceived in class AbstractGame
Parameters:
sender - The sender of the action.
action - The action that has been performed.
values - String containing a single value or a composite value.
See Also:
AbstractGame.notifyAboutMessageReceived(String)

createSpecialSettings

protected void createSpecialSettings()
Not implemented.


handleSpecialSettings

protected boolean handleSpecialSettings(boolean init)
Not implemented.

Specified by:
handleSpecialSettings in class AbstractGame
Parameters:
init - Whether the check is performed on game initialisation.
Returns:
Always true.
See Also:
AbstractGame.handleSettings(boolean)