This site requires JavaScript, please enable it in your browser!
Greenfoot back
Matt
Matt wrote ...

2012/5/13

Ending a game

Matt Matt

2012/5/13

#
I know you can end a game by using Greenfoot.stop(); Is it possible to implement this coding, but specifically after an actor has hit a particular co-ordinate. how would I go about doing this.
SPower SPower

2012/5/13

#
Sure:
if (getX() == theXCoordinate && getY() == theYCoordinate) {
    Greenfoot.stop();
}
Do this in act(). Replace theXCoordinate and theYCoordinate by numbers, which are the coordinates of the location you want to hit.
You need to login to post a reply.