So im still new with this thing, basically i have a class named Main,Enemy,MainBullet,SprayBullet and SprayBullet2.
Main class is shooting with MainBullet and Enemy class shooting with SprayBullet.
if the MainBullet touched with SprayBullet, the SprayBullet will dissappear and SprayBullet2 appear.
they all in same extend class (Mover), so i made a method that if those bullet atWorldEdge it will dissappear/removed.
but then comes the error
1.when SprayBullet didnt get hit by MainBullet, it will come to WorldEdge and dissappear but the function to calling SprayBullet2 still there
2.SprayBullet cant disappear when touched by MainBullet
Code for SprayBullet
Code for edge ()
Any solution for this 2 problem ?
public void act()
{
edge();
move(5);
setRotation(90);
if (getX() < 10 || getX() != getWorld().getWidth() - 10) //Checking if SprayBullet still in MyWorld
{
if (getY() < 10 || getY() != getWorld().getHeight() - 10)//Checking if SprayBullet still in MyWorld
{
if(isTouching(MainBullet.class))
{
removeTouching(SprayBullet.class);
SprayBullet2 a = new SprayBullet2();
SprayBullet2 b = new SprayBullet2();
SprayBullet2 c = new SprayBullet2();
SprayBullet2 d = new SprayBullet2();
SprayBullet2 e = new SprayBullet2();
getWorld().addObject(a, this.getX(), 310);
getWorld().addObject(b, this.getX(), 310);
getWorld().addObject(c, this.getX(), 310);
getWorld().addObject(d, this.getX(), 310);
getWorld().addObject(e, this.getX(), 310);
a.setRotation(315);
b.setRotation(45);
c.setRotation(90);
d.setRotation(135);
e.setRotation(225);
}
}
}
}public void edge() {
if(atWorldEdge())
{
getWorld().removeObject(this);
}
}


link for when i set Y to -16 and above

