|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGameCanvas
client.framework.views.GameView
client.brickblock.fwimpl.BBBoard
public class BBBoard
This class is the implementation of the
abstract class GameView
.
It is responsible for displaying the game
board with all its objects.
When a player is pushed (or moves himself) into
the trap, he receives -1 points. Power up objects
are used; if a player picks up one such, he
receives a temporary bonus by getting bigger,
faster or stronger.
Field Summary |
---|
Fields inherited from class client.framework.views.GameView |
---|
background, boardHeight, boardWidth, layerManager, model |
Constructor Summary | |
---|---|
BBBoard(AbstractGame model)
Constructor. |
Method Summary | |
---|---|
void |
addObject(Sprite object)
Adds an object to the board. |
protected void |
clean()
Empties all the class' object lists. |
Image |
createBackgroundImage()
Creates a background image that covers the entire game board. |
java.lang.Object |
detectObjectCollision(AbstractPlayer player,
int[] movement)
Called whenever the local player moves, to check whether the move causes a collision with one of the game objects. |
Powerup |
findPowerup(java.lang.String name,
int posX,
int posY)
Removes a PowerUp object from the board at
the specified position. |
void |
handleObjectCollision(java.lang.Object collidesWith,
int[] movement)
Called if a collision is detected with a game object ( PowerUp or Trap ). |
protected void |
handlePlayerCollision(AbstractPlayer collidesWith,
int[] movement)
Called if a collision is detected with another player. |
void |
handleSelfPushed(int[] movement)
Method that is called whenever the server has notified that the local player has been pushed. |
void |
removePowerup(Powerup powerup)
Removes the specified PowerUp object
from the game board. |
protected void |
specialCheck()
Called continously the game from the check()
method in GameView . |
Methods inherited from class client.framework.views.GameView |
---|
check, checkInput, commandAction, detectPlayerCollision, detectWallCollision, drawBoard, fireBoardChanged, getSize, initPlayers, isRunning, notifyAboutPlayerAdded, removePlayer, startGame, stopGame |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BBBoard(AbstractGame model)
model
- The game's underlying model.Method Detail |
---|
public void addObject(Sprite object)
object
- The object added to the board.public Powerup findPowerup(java.lang.String name, int posX, int posY)
PowerUp
object from the board at
the specified position. This method is called when a
power up times out, or when it is picked up by one of
the remote players.
name
- The name of the power up to remove.posX
- The x-position of the power up.posY
- The y-position of the power up.
public Image createBackgroundImage()
createBackgroundImage
in class GameView
protected void handlePlayerCollision(AbstractPlayer collidesWith, int[] movement)
handlePlayerCollision
in class GameView
collidesWith
- The player with whom a collision is detected.movement
- The move that leads to the collision.GameView.detectPlayerCollision(client.framework.models.AbstractPlayer, int[])
,
GameView.check()
public void handleObjectCollision(java.lang.Object collidesWith, int[] movement)
PowerUp
or Trap
). If such a collision
is detected, the server is notified.
handleObjectCollision
in class GameView
collidesWith
- The object with which the player collides.movement
- The move that leads to the collision.GameView.detectObjectCollision(client.framework.models.AbstractPlayer, int[])
,
GameView.check()
protected void specialCheck()
check()
method in GameView
.
In this implementation, nothing is performed in this method,
as all necessary client checks are performed in the default
check()
method.
specialCheck
in class GameView
GameView.check()
public java.lang.Object detectObjectCollision(AbstractPlayer player, int[] movement)
handleObjectCollision()
method
is called, and appropriate actions are taken. If no
collision is detected, the method returns null.
detectObjectCollision
in class GameView
player
- The player trying to movemovement
- The movement to take place.
handleObjectCollision(Object, int[])
,
GameView.check()
protected void clean()
clean
in class GameView
public void removePowerup(Powerup powerup)
PowerUp
object
from the game board. The object is removed from
both the displayed screen, as well as the list
of game objects.
powerup
- The power up to remove.public void handleSelfPushed(int[] movement)
movement
- The movement with which the local player has been pushed.BrickBlock.fireForcePushed(String[])
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |