I wanted to make my ball bounce off the walls, bricks, and the paddle, but I have no idea how to do it.I have only used Greenfoot for 3 days and I don't know how.
this is my code:
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class ball here. * * @author (your name) * @version (a version number or a date) */ public class ball extends Actor { /** * Act - do whatever the ball wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ private int delaytime = 150; public void act() { turn(-45); move(1); turn(45); } }