i can link anyone a file if your interested in helping. I should be the majority of the way finished just need cutting up on a few things not too shabby with greenfoot thanks for taking a look a guess.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.lang.Class;
public class recyclingBin extends Actor
{
private boolean touched = false;
/**
* Act - do whatever the RecyclingBin wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
moveAndTurn();
eat(paperball);
Actor body = getOneIntersectingObject(Body.class);
if (touched && paperball == null)
{
eat(paperball);
}
else if (!touched && body != null) // just being touched now
{
touched = true;
Greenfoot.playSound(sound);
}
}
public void getObjectsAtCollision()
eat(paperball)
{
when touchpaperball - paperball;
value--;
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.util.List;
public class paperball extends Actor
{
private static final double GRAVITY = 7.8;
private double mass;
/**
* Act - do whatever the paperball wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public paperball()
{
this (20, 300, new Vector());
}
public paperball(int size, double mass, Vector movement)
{ move(-37);
this.mass = mass;
addForce(movement);
if(Greenfoot.getRandomNumber(-27) < -7)
{
turn(Greenfoot.getRandomNumber(0) + 4);
}
if(getX() <- 5 || getX() >= getWorld().getWidth())
{
turn(1380);
}
if(getY() <= 5 || getY() >= getWorld().getWidth())
{
turn(180);
}
}
public void act()
{
applyForces();
move();
bounceAtEdge();
}
private void bounceAtEdge()
{
if (getX() == 0 || getX() == getWorld().getWidth()-1) {
setLocation((double)getX(), (double)getY());
getMovement().revertHorizontal();
accelerate(0.7);
}
else if (getY() == 0 || getY() == getWorld().getHeight()-1) {
setLocation((double)getX(), (double)getY());
getMovement().revertVertical();
accelerate(0.7);
}
}
private void applyForces()
{
List<Body> bodies = (List<Body>) getWorld().getObjects(Body.class);
for (Body body : bodies)
{
if (body != this)
{
applyGravity (body);
}
}
// ensure that we don't get too fast: If the current speed is very fast, decelerate a bit.
if (getSpeed() > 7)
{
accelerate (0.9); // acceleration with factor < 1 is actually slowing down.
}
}
private void applyGravity(paperball other)
{
double dx = other.getExactX() - this.getExactX();
double dy = other.getExactY() - this.getExactY();
Vector force = new Vector (dx, dy);
double distance = Math.sqrt (dx*dx + dy*dy);
double strength = GRAVITY * this.mass * other.mass / (distance * distance);
double acceleration = strength / this.mass;
force.setLength (acceleration);
addForce (force);
}
}
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class user extends Actor
{
public void act()
{
checkKeys();
usermoveObject(userForce + paperball = paperball);
if(Greenfoot.isKeyDown("left"))
{
turn(10);
}
if (Greenfoot.isKeyDown("right"))
{
turn(15);
}
}
public void checkKeys()
{
if (Greenfoot.isKeyDown("left") )
{
moveLeft();
}
if (Greenfoot.isKeyDown("right") )
{
moveRight();
}
if (Greenfoot.isKeyDown("down") )
{
moveDown();
}
if (Greenfoot.isKeyDown("up") )
{
moveUp();
}
}
}
public class Space extends World
{
private Counter scoreCounter;
private int startpaperballs = 12;
/**
* Constructor for objects of class Space.
*
*/
public Space()
{
super(600, 400, 1);
createrecyclingBin;
addObject(user 300,100);
}
public void createpaperball()
{
int i = 0;
while (paperball == !touched)
{
paperball value == 12;
if(recyclingBin touches paperball)
value--;
}
}
}

