Hi,I encountered a few problems with my homework recently. I simulate two movable players playing a ball and tried to make the ball bounce back after hitting a player. I used turn (Greenfoot.getRandomNumber(90)-45) to allow it rebouncing back at a random angle. But the result does not seem like what I expected, the ball didn't always bounce back, it sometimes will go up, down or keep forward. Another problem is that when it hits the player, it will rotate in that place for less than a second.
What should I do to make it more logical?
Thanks!
Actor Player_A = getOneIntersectingObject(PlayerA.class);
if (Player_A!=null)
{
move(10);
turn(Greenfoot.getRandomNumber(90)-45);
}
