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

2024/4/27

New user, need help

ABeeperPerhaps ABeeperPerhaps

2024/4/27

#
Hello, I know this is likely an extremely elementary issue but I can not figure it out for the life of me, I am attempting to create a system to make a sprite loop to the left of the screen when they hit the right side. I will put the code below; assistance is very welcome. Thank you Code: (For context my world is 600x400)) public void act() { move (3); if(atEdge()) { setLocation (0,200); } } public boolean atEdge() { if (getX() < 0) { return true; } if (getX() > 599) { return true; } if (getY() < 0) { return true; } if (getY() > 399) { return true; } return false; } }
ABeeperPerhaps ABeeperPerhaps

2024/4/28

#
nvm i got it :3
You need to login to post a reply.