It works if i shoot to the side but if i shoot up the middle they disappear (like there is some sort of barrier blocking them ) I might check my world properties to see if something is screwed up in there
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class GumBlaster here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class GumBlaster extends Actor
{private int points = 0;
public void act()
{
if (Greenfoot.isKeyDown("left"))
{
setRotation (getRotation() - 3);
}
if (Greenfoot.isKeyDown("right"))
{
setRotation (getRotation() + 3);
}
if("space".equals(Greenfoot.getKey()))
{
fire();
}
if (Greenfoot.isKeyDown("z"))
{
snipe();
points--;
}
}
/**
* Fire the GumBlaster.
*/
private void fire()
{
Mover gum = new gum();
getWorld().addObject(gum, getX(), getY());
gum.setRotation(getRotation());
gum.move(6);
}
/**
* Snipe the GumBlaster
*/
private void snipe()
{
Mover longshot = new longshot();
getWorld().addObject(longshot, getX(), getY());
longshot.setRotation(getRotation());
longshot.move(6);
}
}
snipe is the method that shoots longshot