Hi,
this seems to be bugging me. In the world class I would use:
For some reason I find that my Hero does not always respond straight away. I would need to Pause and then Run for the Hero to respond to keyboard commands. Any ideas on what is going on?
The Hero has this in the Act method:
public class Town extends World
{
/**
* Constructor for objects of class Town.
*
*/
public Town()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
Greenfoot.start();
addObject (new Hero(), 300, 200);
}
}if (Greenfoot.isKeyDown("left"))
{
moveLeft();
}
if (Greenfoot.isKeyDown("right"))
{
moveRight();
}
if (Greenfoot.isKeyDown("up"))
{
moveUp();
}
if (Greenfoot.isKeyDown("down"))
{
moveDown();
}
