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

2013/1/9

Is it possible to have a smaller world on top of a larger one?

camsterb camsterb

2013/1/9

#
I am having problems with an ice-hockey game. I have boundaries for players to collide with to keep them within an arena, but they frequently break free/escape the boundaries. I have posted before but haven't received any feedback about this issue.
Entity1037 Entity1037

2013/1/10

#
This is an easy. if (getX()>= getWorld().getWidth()-){ setLocation(getX()-,getY()); } The best way to do this is to have two variables for x and y movement. Example: xmove=0; ymove=0;. Then you should at the end of the script do setLocation(getX()+xmove,getY()+ymove);. For the left you would do if (getX()<= getWorld().getWidth()-). For Y, you must do if (getY() >= getWorld().getHeight()-) You get the Idea now, right? Not difficult at all. If you do this, you should have no problems with anyone going past the boundary.
You need to login to post a reply.