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

2012/2/12

end of board?

programmer22 programmer22

2012/2/12

#
ok so ive tried alot of ideas lately on my game and i want my "Crab" to go through one side of the game board and come out the other side like pacman. Any ideas ? ty for all your suggestion and replys By the way
danpost danpost

2012/2/12

#
int w = getWorld().getWidth();
int h = getWorld().getHeight();
setLocation((w + getX() + dX) % w, (h + getY() + dY) % h);
dX and dY are the amount you want them to move in the x and y directions.
programmer22 programmer22

2012/2/12

#
thanks man taken care of =)
You need to login to post a reply.