Class Field

java.lang.Object
  |
  +--javax.microedition.lcdui.game.Layer
        |
        +--javax.microedition.lcdui.game.TiledLayer
              |
              +--Field

public class Field
extends javax.microedition.lcdui.game.TiledLayer

Field is a TiledLayer which looks after the lowest layer of the game.

Title: Monkey Madness

Description: Player must run around field, destroying and avoiding bombs, droids and boss!

Copyright: Copyright (c) 2005

Company: Pistachio Monkey


Method Summary
 void beat()
          beat method animates the flames in the corners
 void buildField()
          builds the tiled layer out of the different game tile arrays
 boolean containsStartZone(int x, int y, int width, int height)
          sees if the field is a startzone tile (blue)
 int getBossStartX()
          returns a start X position for the boss
 int getBossStartY()
          returns a start Y position for the boss
 int getFieldCell(int row, int column)
          gets the cell value for the loaction
 int getPlayerStartX(int i)
          returns start X postion for a player
 int getPlayerStartY(int i)
          returns start Y postion for a player
 int getStartOffset()
          returns an offset start position, used for removing the boss instance frokm the gaming field
 boolean inZone(int x, int y, int width, int height)
          returns true if every pixel of the sprite is in the zone square
 int[] locatorDefined(int x, int y, int width, int height)
          defines a single cell to be location of the sprite
 int[] locatorVaried(int x, int y, int width, int height, int blend)
          retruns an array of the possible field postions the sprite could be within
 boolean noGo(int x, int y, int width, int height)
          returns true if the player hits a wall!
 
Methods inherited from class javax.microedition.lcdui.game.TiledLayer
createAnimatedTile, fillCells, getAnimatedTile, getCell, getCellHeight, getCellWidth, getColumns, getRows, paint, setAnimatedTile, setCell, setStaticTileSet
 
Methods inherited from class javax.microedition.lcdui.game.Layer
getHeight, getWidth, getX, getY, isVisible, move, setPosition, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

buildField

public void buildField()
builds the tiled layer out of the different game tile arrays


getPlayerStartX

public int getPlayerStartX(int i)
returns start X postion for a player

Parameters:
i - the position value for the player number
Returns:
int location

getPlayerStartY

public int getPlayerStartY(int i)
returns start Y postion for a player

Parameters:
i - the position value for the player number
Returns:
int location

getBossStartX

public int getBossStartX()
returns a start X position for the boss

Returns:
int location

getBossStartY

public int getBossStartY()
returns a start Y position for the boss

Returns:
int location

getStartOffset

public int getStartOffset()
returns an offset start position, used for removing the boss instance frokm the gaming field

Returns:
int location

beat

public void beat()
beat method animates the flames in the corners


noGo

public boolean noGo(int x,
                    int y,
                    int width,
                    int height)
returns true if the player hits a wall!

Parameters:
x - x position
y - y position
width - width of the sprite
height - height of the sprite
Returns:
boolean

inZone

public boolean inZone(int x,
                      int y,
                      int width,
                      int height)
returns true if every pixel of the sprite is in the zone square

Parameters:
x - x position
y - y position
width - width of the sprite
height - height of the sprite
Returns:
boolean

locatorVaried

public int[] locatorVaried(int x,
                           int y,
                           int width,
                           int height,
                           int blend)
retruns an array of the possible field postions the sprite could be within

Parameters:
x - x position
y - y position
width - width of the sprite
height - height of the sprite
blend - used to add futher variation to the loaction
Returns:
int[] rowMin, rowMax, columnMin, columnMax

locatorDefined

public int[] locatorDefined(int x,
                            int y,
                            int width,
                            int height)
defines a single cell to be location of the sprite

Parameters:
x - x position
y - y position
width - width of the player sprite
height - height of the player sprite
Returns:
int[] row, column, cell

containsStartZone

public boolean containsStartZone(int x,
                                 int y,
                                 int width,
                                 int height)
sees if the field is a startzone tile (blue)

Parameters:
x - x position
y - y position
width - width of the player sprite
height - height of the player sprite
Returns:
boolean

getFieldCell

public int getFieldCell(int row,
                        int column)
gets the cell value for the loaction

Parameters:
row - number
column - number
Returns:
cell number