I'm programming a little Basketball Game. If the Ball is hitting the Hoop he should be thrown back, but nothing happens.
Here is my Ball class:
import greenfoot.*; public class Ball extends Actor { public int deltaX = (Greenfoot.getRandomNumber(5) + 3); public int deltaY = (Greenfoot.getRandomNumber(5) + 3); public void act() { setLocation(getX() + deltaX, getY() + deltaY); wallCollision(); touchingHoop(); } public void wallCollision() { if (getX() < 10 || getX() > 1823) { deltaX = -deltaX; } if (getY() < 10 || getY() > 1090) { deltaY = -deltaY; } } public void touchingHoop() { if (isTouching(Backboard.class)) { deltaX = -deltaX; } } }