Hi! Any suggestions at how to properly code a game so that an object hits the edge of the world and bounces back? I can't seem to locate anything in my Greenfoot textbook that would be compatible with my game. Thanks! (High School COMPSCI Student)
Hi! Any suggestions at how to properly code a game so that an object hits the edge of the world and bounces back? I can't seem to locate anything in my Greenfoot textbook that would be compatible with my game. Thanks! (High School COMPSCI Student)
What code are you using for the object you want to have bounce off the edges?
I'm trying to have a Ladybug object move about the screen, and when it hits the edge bounce back into the world. I'm pretty new to Java, so sorry if I'm not explaining quite well! @danpost
I'm trying to have a Ladybug object move about the screen, and when it hits the edge bounce back into the world. I'm pretty new to Java, so sorry if I'm not explaining quite well! @danpost
In order to be sure to give a suggestion that is compatible with your game, you will need to post a copy of the code within the Ladybug class.
public void act()
{ move(4);
is atWorldEdge(turn 90);
}
This is what I was thinking...I know it's basic code, but sadly I'm not the most proficient. Thanks for the help! @danpost