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

2014/1/8

how to end game

hskaratekid hskaratekid

2014/1/8

#
I was wondering how to end the game when the player hits the enemy any ideas thanks
danpost danpost

2014/1/8

#
What would you like to occur when the game is ended? Be specific.
hskaratekid hskaratekid

2014/1/8

#
just that all movement stop
hskaratekid hskaratekid

2014/1/8

#
so when I hit the enemy that the enemy will stop moving
danpost danpost

2014/1/8

#
As the last line in the act method of the class for the player, add (in pseudo-code):
if (getOneIntersectingObject(EnemyClassName.class) Greenfoot.stop();
hskaratekid hskaratekid

2014/1/8

#
it comes up with a eror that say there should be a ) after (EnemyClassName.class)
hskaratekid hskaratekid

2014/1/8

#
i put a ) where it said to and it said incompatible types
danpost danpost

2014/1/8

#
Sorry, change it to this:
if (getOneIntersectingObject(EnemyClassName.class) != null) Greenfoot.stop();
hskaratekid hskaratekid

2014/1/8

#
thanks
hskaratekid hskaratekid

2014/1/8

#
i already have the if statement but do you know what statement to use to change to a different world
danpost danpost

2014/1/9

#
hskaratekid wrote...
i already have the if statement but do you know what statement to use to change to a different world
Use the Greenfoot class 'setWorld' method -- refer to documentation.
You need to login to post a reply.