Well, you have to stop that bullet from acting, so like, you need to either put the return in the bullet class at a point to stop it from acting, or add code that can stop bullet from accting.
you could try:
public void deleteBullet(Bullet bullet)
{
bullet.performRemove();
}
bullet's performRemove()
{
isRemoved = true; //declare private boolean isRemoved; in the top,
}
and in the bulllet's act()
{
if (isRemoved){
getWorld().removeObject(this);
return; // this will stop bullet's execution code when it is removed.
}
//the rest of bullet's act method.
}
Ah that error. Well, to prevent that from happening,
after removing the bullet, do return; to stop execution of that bullet so that way it won't try to act when it's already out of the world.
public void checkBullet(){
if(canSee(Bulletleft.class)||canSee(Bulletright.class))
{
((Archerworld)getWorld()).deleteGuard(this);
((Archerworld)getWorld()).deleteBullet(getOneIntersectingObject(Bullet.class));
}
}
That will remove one bullet that is currently touching the object that calls that method.
You don't have to cast world to another one I think. getWorld().removeObjects(getWorld().getObjects(arrrow.class)); would be more correct? Just a guess. See if it compiles XD.
It starts to lag when cpu usage gets too high. Like, around when I fill the paths with little people.
(How do you define lag?) Because for me, I define lag as when the framerates look like they're low (and when the movement looks choppy).
Pretty good engine so far.
2009/11/18
Archerman
2009/11/18
Archerman
2009/11/18
Archerman
2009/11/18
Archerman
2009/11/17
SimuPark
2009/11/17
SimuPark
2009/11/17
SimuPark
2009/11/17
SimuPark
2009/11/17
SimuPark