i want to make my space invaders have more "HP" so the last row takes 3 shots to kill and the 2nd row 2 shots and so on but i cant seem to get it no matter what i try plz help
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Space here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Space extends World
{
/**
* Constructor for objects of class Space.
*
*/
public Space()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1000, 600, 1);
Rocket myrocket;
myrocket = new Rocket();
invader myinvader;
myinvader = new invader();
invader myinvader1;
myinvader1 = new invader();
invader myinvader2;
myinvader2 = new invader();
invader myinvader3;
myinvader3 = new invader();
invader myinvader4;
myinvader4 = new invader();
invader myinvader5;
myinvader5 = new invader();
invader myinvader6;
myinvader6 = new invader();
invader myinvader7;
myinvader7 = new invader();
invader myinvader8;
myinvader8 = new invader();
addObject(myrocket, 55 , 300);
addObject(myinvader, 980 , 50);
addObject(myinvader2, 980 , 115);
addObject(myinvader3, 980 , 180);
addObject(myinvader4, 980 , 240);
addObject(myinvader5, 980 , 300);
addObject(myinvader6, 980 , 360);
addObject(myinvader7, 980 , 420);
addObject(myinvader8, 980 , 480);
addObject(myinvader1, 980 , 540);
}
}int acts = 0;
if (acts%10 == 0) setLocation(getX()-1, getY()); acts = (acts+1)%10; // cycles act counter from 0 through 9
int acts = 0;
if (acts%10 == 0) setLocation(getX()-1, getY()); acts = (acts+1)%10; // cycles act counter from 0 through 9
public class invader extends Actor
{
/**
* Act - do whatever the invader wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
int acts = 0;
int count = 3;
public void act()
{
if (acts%10 == 0)
{
setLocation(getX()-1, getY());
acts = (acts+1)%50; // cycles act counter from 0 through 9
}
Actor a = getOneIntersectingObject(bullet.class);
if (a != null)
{
count = count -1;
getWorld().removeObject(a);
}
if (count == 0)
{
getWorld().removeObject(a);
getWorld().removeObject(this);
return;
}
if (getX() < 1)
{
getWorld().removeObject(this);
Greenfoot.stop();
}
}
}