Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your next step is to account for a collision with the walls. You will accomplish

ID: 440599 • Letter: Y

Question

Your next step is to account for a collision with the walls. You will accomplish this within a method called turnIfNeeded(),which will be called from the act() method of Orb. The turnIfNeeded()method may call four separate methods, which you write in this step. The four methods are:turnAtLeftWall(), turnAtRightWall(), turnAtFloor(), and turnAtRoof(). The code for one of the four methods, turnAtFloor(),is provided below. Use it as a model to create the three other methods. public void turnAtFloor() { if (getY() + getImage().getHeight()/2 >= getWorld().getHeight()) { vel.reverseY(); } } This method checks the y-coordinate of theOrb, and then subtracts half of theOrb

Explanation / Answer

Refer this, might help you http://cboard.cprogramming.com/game-programming/128020-simple-collision-detection.html http://www.plasmaphysics.org.uk/programs/coll2d_cpp.htm