if ((o.vPos + (0.5 * o.getHeight()) + (0.5 * snowball.diameter) > 500) && (o.vPos < 500)){
if (((Math.abs(o.hPos) - (0.5 * o.getWidth())) < (0.5 * snowball.diameter)) &&
(Math.abs(o.hPos) - (0.5 * o.getWidth()) > (-0.5 * snowball.diameter))){
//do stuff
o is an obstacle. vPos and hPos stand for vertical and horizontal position. The snowball is located at 500 on the y-axis, and is at what functions as 0 on the x-axis. (in terms of pixels, this is actually 300)
No comments:
Post a Comment