Apologies for posting again so soon, but I am now wondering how do you most effectively end a Project with the Greenfoot.stop() function? I have a moving object that when colliding with an obstacle is supposed to stop all movement and accept no further inputs from pressed keys, as you would expect.
But the only way I've managed to achieve this is by adding the stop function onto the end of each and every keyPress act, which produces the desired result but I feel is perhaps unnecessary. Is there no way I can have a single act on its own that ends everything? For instance, I tried simply using this for when the obstacle is detected:
but it does nothing?
Thank you
private void stop()
{
if (barrier_detector()==true)
{
Greenfoot.stop();
}
}