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

2018/3/27

Actor object only allowed to move within certain x and y axis parameters

fame346 fame346

2018/3/27

#
So in my game I am attempting to have a butterfly net move only so high up and also butterflys above the net will move so far down but i want to make a sort of zone where the butterflys can't move way below the net and so forth for the net with the butterfly's. My guess is that it has something to do with the setLocation getY(). Pointing me in the right direction would be appreciated.
danpost danpost

2018/3/27

#
Example of limiting in one direction (will not be able to go below y = 300):
if (getY() > 300) setLocation(getX(), 300);
fame346 fame346

2018/3/28

#
Got it! I was actually able to figure it out a few hours after this post. Thank you very much!
You need to login to post a reply.