So basically I'm just trying to create an instance of the Bullet class from my Rocket class at position 200. 200. Any help would be appreciated. Here is my whole Rocket class and I can post my bullet class too if you want. Thanks in advanced!
import greenfoot.*;
/**
* Write a description of class Rocket here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Rocket extends Actor
{
int xpos = 303;
/**
* Act - do whatever the Rocket wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
if(Greenfoot.isKeyDown("left"))
{
xpos += -4;
}
if(Greenfoot.isKeyDown("right"))
{
xpos += 4;
}
if(Greenfoot.isKeyDown("space"))
{
Bullet bullet = new Bullet();
World.addObject(bullet, 200, 200);
}
setLocation(xpos, getY());
}
public Rocket()
{
GreenfootImage image = getImage();
image.scale(image.getWidth() - 40, image.getHeight() - 20);
setImage(image);
setRotation(-90);
}
}