hello,
I don't know why Greenfoot shows an incompatible types error at the Brackets of the greenfoot-method "getOneObjectAtRange" when I want to compile it:
The same comes up with "getOneObjectAtOffset"
And the Barrier.class exists.
Does anyone know the problem? Thanks
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Bullet extends Actor
{
private int Speed;
public Bullet(){
Speed = 3;
}
public void act()
{
setLocation(getX()+Speed,getY());
}
public void switchDirection(){
if(this.getObjectsInRange(5, Barrier.class)){
if(Speed>0){
Speed = -3;
}
if(Speed<0){
Speed = +3;
}
}
}
}
