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

2018/3/27

Pinball game

arthurmadson arthurmadson

2018/3/27

#
hello i have a college's work to do which is a pinball game but my problem is i made the class ball has gravity. code: public class ball extends actor{ int speed; public void act{ speed++; setLocatiton(getX(),getY()+speed); } } that makes gravity for the ball but i don't know how i make to the paddles reflect the ball up can you explain me how to do that, and show one code's sample.
danpost danpost

2018/3/27

#
So far as I can see, the ball only has vertical movement; and even then, that which is unregulated -- there is no implemented collision detection in the class. You will probably need not only to show what codes you currently have in the paddle class but also that of your actor class.
You need to login to post a reply.