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

2013/6/9

Force position at a special location

Solringolt Solringolt

2013/6/9

#
How can I force an object to be at a multiple of 16 on X and Y in a 528x528 world size when added anywhere?
bourne bourne

2013/6/9

#
Overwrite the setLocation method for the class.
public void setLocation(int x, int y)
{
    super.setLocation((x / 16) * 16, (y / 16) * 16);
}
Solringolt Solringolt

2013/6/9

#
Thx! I was trying something like that but I was using the setExactLocation where x and y are doubles and that didn't worked.
You need to login to post a reply.