public class LogicEngine extends Object
Constructor and Description |
---|
LogicEngine()
creates the logic engine which takes care of game state, intialize with a floor that is 80 by 24
|
LogicEngine(int width,
int height)
creates the logic engine which takes care of game state
|
Modifier and Type | Method and Description |
---|---|
void |
attack(int x,
int y,
int xOrig,
int yOrig)
x and y are the position thats being tested
xOrig and yOrig are the position of the object now
|
void |
consumeItem(int x,
int y) |
void |
createAllObjects()
creates all the monsters and player in the game
|
void |
createItem(int x,
int y,
Item i)
creates specified item at specified location
|
void |
createMonster()
creates monsters at random, some monsters appearing multiple times and some not appearing at all
|
void |
deleteItem(int x,
int y) |
GamePiece[][] |
getFloor() |
boolean |
getGameOver()
getter for boolean gameOver
|
Item |
getItem(int x,
int y) |
int |
getLevel() |
int |
getMaxNumOfMonsters() |
Monster[][] |
getMonsters() |
GamePiece |
getObject(int x,
int y) |
Player |
getPlayer() |
int[] |
getPlayerPosition() |
boolean |
inBounds(int x,
int y) |
boolean |
monsterIsDead(int x,
int y)
check if the monster at position x,y has 0 or less hp
there is a chance of the monster dropping an item when it dies
|
boolean |
movable(int x,
int y,
int xOrig,
int yOrig)
x and y are the position thats being tested
xOrig and yOrig are the position of the object now
|
void |
move(int x,
int y,
int xOrig,
int yOrig)
move GamePiece from (xOrig,yOrig) to (x,y)
x and y are the position thats being tested
xOrig and yOrig are the position of the object now
|
boolean |
playerIsDead()
check if the player has 0 or less hp
|
void |
resetPlayerPosition()
after the level is completed, resets the player to the starting position
|
void |
setGameOver(boolean a)
setter for boolean gameOver
|
void |
setLevel(int level) |
void |
setMaxNumOfMonsters(int max) |
void |
storeMonsters()
update the monster list based on the objects in floor
|
public LogicEngine()
public LogicEngine(int width, int height)
width
- the width of the floorheight
- the height of the floorpublic void setGameOver(boolean a)
a
- boolean to set gameOver to true or falsepublic boolean getGameOver()
public Monster[][] getMonsters()
public GamePiece getObject(int x, int y)
x
- the x position of the objecty
- the y position of the objectpublic Item getItem(int x, int y)
public GamePiece[][] getFloor()
public Player getPlayer()
public int[] getPlayerPosition()
public int getLevel()
public void setLevel(int level)
level
- the level to set topublic int getMaxNumOfMonsters()
public void setMaxNumOfMonsters(int max)
max
- new max number of monsterspublic void move(int x, int y, int xOrig, int yOrig)
x
- is the new x positiony
- is the new y positionxOrig
- is the x position of the object right nowyOrig
- is the y position of the object right nowpublic void attack(int x, int y, int xOrig, int yOrig)
x
- is the x position of the position being testedy
- is the y position of the position being testedxOrig
- is the x position of the object right nowyOrig
- is the y position of the object right now
attacks if the 2 coordinates hold different GamePiecespublic boolean movable(int x, int y, int xOrig, int yOrig)
x
- is the x position of the position being testedy
- is the y position of the position being testedxOrig
- is the x position of the object right nowyOrig
- is the y position of the object right nowpublic boolean inBounds(int x, int y)
public boolean monsterIsDead(int x, int y)
x
- is the x position of the position being testedy
- is the y position of the position being testedpublic boolean playerIsDead()
public void storeMonsters()
public void createAllObjects()
public void createItem(int x, int y, Item i)
x
- x coordinate for new itemy
- y coordinate for new itemi
- reference to new itempublic void consumeItem(int x, int y)
public void deleteItem(int x, int y)
public void resetPlayerPosition()
public void createMonster()