I coded the bomb class but it won't compile for some reason. Could someone help me out, thanks.
Here's my code
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Bomb here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Bomb extends PowerUps
{
/**
* Act - do whatever the Bomb wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
Player1Collision();
Player2Collision();
}
public void Player1Collision()
{
if (getWorld() != null)
{
Player1 collision = (Player1) getOneIntersectingObject(Player1.class);
if (collision != null)
{
SpaceWorld space = (SpaceWorld)getWorld(); //gets the space world
space.removeObject(collision);
getWorld().removeObject(Enemies.class);
}
}
}
public void Player2Collision()
{
if (getWorld() != null)
{
Player2 collision = (Player2) getOneIntersectingObject(Player2.class);
if (collision != null)
{
SpaceWorld space = (SpaceWorld)getWorld(); //gets the space world
space.removeObject(this);
getWorld().removeObject(Enemies.class);
}
}
}
}
