So I am having trouble with trying to detect if an actor is intersecting another one of itself in the world class. If you see on the code I am making several of them with respects to I. The only problem is that I am getting the error can not find sym
bol method getoneintersectingobject. I do not understand what is wrong.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | public AnimalWorld() { super ( 600 , 400 , 1 ); for ( int i = 0 ; i < 30 ; i++) { xPosition = Greenfoot.getRandomNumber( 580 ) + 10 ; yPosition = Greenfoot.getRandomNumber( 360 ) + 10 ; if (i== 0 ) { Actor animal = new Animal(); addObject(animal, xPosition, yPosition); } else if (i > 0 && i < 15 ) { Actor leaf = new Leaf(); addObject(leaf, xPosition, yPosition); } else if (i > 15 && i < 25 ) { Actor obstacle = new Obstacle(); addObject(obstacle, xPosition, yPosition); Greenfoot.getOneIntersectingObjects(Obstacle. class ); if (getOneInterectingObject == null ) { } else { getWorld().removeObject( this ); getworld().addObject(obstacle, xPosition, yPosition); } } else { Actor bomb = new Bomb(); addObject(bomb, xPosition, yPosition); } } } |