This site requires JavaScript, please enable it in your browser!
Greenfoot back

kenshinakh's Comments

Back to kenshinakh's profile

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.
Cool. By the way, I don't see lag anymore i think. But the problem now is that the scenario runs too fast!
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.
Ah I see xD. I'm surprised that you can program with a screen like that.
Well, 16:9 is good, but right now, the screen is a lot smaller than any of that i've seen on computers xD.
Ah I see, so this can be zoomed?