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

2021/2/1

hello, I need help with my breakout project. It always shows that its an incomplete ending.

emmv.h emmv.h

2021/2/1

#
public void showTextGameOver() { removeObject(new GreenfootImage); ballIsOut(); score = 0; }
danpost danpost

2021/2/1

#
emmv.h wrote...
public void showTextGameOver() { removeObject(new GreenfootImage); ballIsOut(); score = 0; }
"new GreenfootImage" is not an Actor object and, therefore, cannot be used as an argument for removeObject. What are you trying to remove from the world? What class is this code in?
emmv.h emmv.h

2021/2/1

#
Thanks. I want to remove the text "Game Over" when the ball gets out of the board and then set my score back to 0. I tried to write it in the world class because my techer has told me so.
danpost danpost

2021/2/1

#
emmv.h wrote...
I want to remove the text "Game Over" when the ball gets out of the board and then set my score back to 0. I tried to write it in the world class because my techer has told me so.
I am a bit confused. Maybe you mean "show" and not "remove". I cannot see the ball and game over text being in the world at the same time (as what you wrote would suggest).
emmv.h emmv.h

2021/2/1

#
Yeah thats right. The ball is out of the world, than the Game Over text appears. But then it stays and you can keep on playing when you press space. But I want it to go away when you try again and set the score I mad back to 0. I hope its now a little less confusing
danpost danpost

2021/2/1

#
emmv.h wrote...
I want it to go away when you try again and set the score I mad back to 0. I hope its now a little less confusing
You can just create and set a new world active when "space" is pressed.
emmv.h emmv.h

2021/2/1

#
ok thanks
You need to login to post a reply.