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

2022/4/28

how do u make the bullet disappear after hitting the enemy or the end of the world

Beebon Beebon

2022/4/28

#
can someone provide the code pls
Roshan123 Roshan123

2022/4/28

#
//Inside bullet class
if(isAtEdge())//checks whether the bullet is touching the edge of the world
getWorld().removeObject(this);

if(isTouching(Enemy.class))//checks whether it collided with other class or not
getWorld().removeObject(this);
By the way you can see the documentation of all methods by double clicking the “Actor class”
Beebon Beebon

2022/4/28

#
thx
You need to login to post a reply.