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

2012/4/11

On added to world.

Razzo Razzo

2012/4/11

#
How would I use this code everytime something that extends blah
setLocation(getX()-getX()%50, getY()-getY()%50);
Thanks :D
ttamasu ttamasu

2012/4/11

#
You can write a subclass of Actor say MyActor and define or overwrite an new definition of setLocation. Then you have all your actors become subclass of MyActor (which has the new definition of setLocation. For example inside MyActor you can write this setLocation method public class MyActor extends Actor { public void setLocation(){ super.setLocation(getX()-getX()%50, getY() -getY()%50); } }
Razzo Razzo

2012/4/11

#
That will do perfectly :D Thankyou :D
You need to login to post a reply.