This site requires JavaScript, please enable it in your browser!
Greenfoot
Username
Password
Remember Me?
Sign Up, Lost Password
Activity
About
Documentation
Download
Discuss
Scenarios
shantanu28
wrote ...
2017/11/3
How to restrict character on top of screen while jumping?
shantanu28
2017/11/3
#
I have made a character who has the power to fly. But I am not able to restrict him to the screen. While flying it goes beyond the screen
danpost
2017/11/3
#
shantanu28 wrote...
I have made a character who has the power to fly. But I am not able to restrict him to the screen. While flying it goes beyond the screen
Normally the following alone after the movement code would be enough:
if (getY() < getImage().getHeight()/2) setLocation(getX(), getImage().getHeight()/2);
You need to login to post a reply.
X