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

2014/10/4

Bouncing opposite direction when the ball hits the worlds edge.

1
2
danpost danpost

2014/10/4

#
A couple of things you should be aware of are (1) you have a lot of transparency surrounding your Tank object image which will cause the tank to act like it is colliding or reaching set limits prematurely; and (2) because the images are rectangular, you need collision detection when turning or else you will get some unwanted interaction between the two tanks. Notes: in (1) remove all excess edges that are completely transparent from your "Tank.fm.png" image; and in (2) prevent turning if collision is involved (retract the turn if a collision occurs -- this would be similar to how you retract the move when a collision occurs).
Nachfuchs9 Nachfuchs9

2014/10/5

#
http://gyazo.com/c70193b46adf07962685b9f48bb25e9a
iamamprako iamamprako

2015/10/23

#
hi there, im coding a breakout game and im not able to inverse the bounce of the ball collision between the walls. please help public boolean atWorldEdge() { if(getX()<10 || getX() > getWorld().getWidth() - 12) return true; if(getY()<10 || getY() > getWorld().getWidth() - 12) return true; else return false; }
danpost danpost

2015/10/23

#
You should start a new discussion thread -- not continue one that expired over a year ago. Also, your issue deals with movement; but, I do not see any codes related to the movement of the actor. Please read the info linked to the 'Posting code? read this!' link below the reply box before posting any more codes.
You need to login to post a reply.
1
2