I want to resize the grid in gridworld from the default 10x10 to whatever I want. I've been testing it with 15x15 just to see if it works. But I can't seem to figure this out and other sources on the internet say that what I'm doing should work.
The grid stays at 10x10 even though I try and set rowSize
& colSize
, how can I fix this so that it opens the grid to a 15x15 screen?
This class is where I resize the grid
import info.gridworld.actor.*;
import info.gridworld.grid.BoundedGrid;
public class pokeGrid extends ActorWorld{
private static final int rowSize = 15;
private static final int colSize = 15;
public pokeGrid(){
super(new BoundedGrid<Actor>(rowSize, colSize));
}
}
This class is the runner for the actor
public class BeecherBugRunner extends pokeGrid {
private static pokeGrid world = new pokeGrid();
public static void main(String[] args)
{
ActorWorld world = new ActorWorld();
BeecherBug beecher = new BeecherBug(4);
world.add(new Location(7, 8), beecher);
world.show();
}
}
private static pokeGrid world = new pokeGrid();
public static void main(String[] args)
{
ActorWorld world = new ActorWorld();
...
}
The problem here is that the world
variable of base type ActorWorld
declared in main
is shadowing your pokeGrid
member variable world
. The subsequent method calls on world
are thus operating on a default world type, not your customized one.
To fix this, remove the ActorWorld world = ...
declaration from main
. The method calls will then be operating on your customized class.