Omstrukturerer litt mens det fortsatt er enkelt

Forbedrer tester
Bytter navn på noen metoder og variabler
Bytter noen tall til relevante konstanter
Stokker om på rekkefølgen i konstruksjonsmetodene til DrawableObject
This commit is contained in:
2020-02-05 05:14:35 +01:00
parent e4784246bf
commit 4eb5b42755
5 changed files with 54 additions and 43 deletions

View File

@ -27,17 +27,16 @@ public class Game implements IDrawableGame {
}
@Override
public List<IDrawableObject> objectsToRender() {
public List<IDrawableObject> getObjectsToDraw() {
List<IDrawableObject> list = new ArrayList<>();
for (int i = 0; i < 12; i++) {
for (int j = 0; j < 12; j++) {
DrawableObject tileObj = new DrawableObject(i * 64, j * 64, GameTexture.TILE);
list.add(tileObj);
for (int i = 0; i < TILE_NUMBER; i++) {
for (int j = 0; j < TILE_NUMBER; j++) {
DrawableObject tile = new DrawableObject(GameTexture.TILE, i * TILE_SIZE, j * TILE_SIZE);
list.add(tile);
}
}
DrawableObject roboObj = new DrawableObject(128,128, GameTexture.ROBOT);
list.add(roboObj);
DrawableObject robot = new DrawableObject(GameTexture.ROBOT, TILE_SIZE, TILE_SIZE);
list.add(robot);
return list;
}
}

View File

@ -22,9 +22,9 @@ public interface IDrawableGame {
int getHeight();
/**
* Gets a list of objects which are to be rendered
* Gets a list of objects which are to be drawn
* @return A list of drawable objects in the order they are to be drawn
*/
List<IDrawableObject> objectsToRender();
List<IDrawableObject> getObjectsToDraw();
}