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

2018/4/22

My game is not ending correctly... Help?

IlikeThePrequels IlikeThePrequels

2018/4/22

#
My game is programmed to end when my enemy touches the beehive. For some reason, it only ends sometimes. Other times my enemies touch the beehive and go to the spot where the beehive was. Help?
danpost danpost

2018/4/22

#
IlikeThePrequels wrote...
My game is programmed to end when my enemy touches the beehive. For some reason, it only ends sometimes. Other times my enemies touch the beehive and go to the spot where the beehive was. Help?
Cannot fix invisible code.
IlikeThePrequels IlikeThePrequels

2018/4/22

#
danpost wrote...
IlikeThePrequels wrote...
My game is programmed to end when my enemy touches the beehive. For some reason, it only ends sometimes. Other times my enemies touch the beehive and go to the spot where the beehive was. Help?
Cannot fix invisible code.
private void lookForBeehive() { if (isTouching(Beehive.class)) { Greenfoot.playSound("munch.mp3"); removeTouching(Beehive.class); Greenfoot.setWorld(new GameOverScreen()); Greenfoot.stop(); } } It only works sometimes when it touches the beehive it ends the game. Other times it does not.
danpost danpost

2018/4/22

#
IlikeThePrequels wrote...
<< Code Omitted >> It only works sometimes when it touches the beehive it ends the game. Other times it does not.
And where is this method being called (show act method).
IlikeThePrequels IlikeThePrequels

2018/4/22

#
danpost wrote...
IlikeThePrequels wrote...
<< Code Omitted >> It only works sometimes when it touches the beehive it ends the game. Other times it does not.
And where is this method being called (show act method).
public void act() { followBeehive(); lookForBeehive(); switchImage(); }
danpost danpost

2018/4/22

#
I presume what you gave so far was in the Enemy class. Now, what do you have in the Beehive class?
IlikeThePrequels IlikeThePrequels

2018/4/22

#
danpost wrote...
I presume what you gave so far was in the Enemy class. Now, what do you have in the Beehive class?
There is no code in the beehive class. All of my code is in the bee2 class that partains to the beehive.
danpost danpost

2018/4/22

#
IlikeThePrequels wrote...
There is no code in the beehive class. All of my code is in the bee2 class that partains to the beehive.
What code do you have in the followBeehive method?
IlikeThePrequels IlikeThePrequels

2018/4/22

#
danpost wrote...
IlikeThePrequels wrote...
There is no code in the beehive class. All of my code is in the bee2 class that partains to the beehive.
What code do you have in the followBeehive method?
I fixed the game. I do need help with my bullets pausing my game. I have an active form of it up right now.
You need to login to post a reply.