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

2020/6/11

how do i make an object disappear when it gets on the edge of the screen?

lilshopa lilshopa

2020/6/11

#
so i have a bullet that deletes the enemies and when it reaches the edge its stay there and the enemies can no longer spawn
danpost danpost

2020/6/11

#
lilshopa wrote...
so i have a bullet that deletes the enemies and when it reaches the edge its stay there and the enemies can no longer spawn
Have the bullet removing itself from the world when it hits that edge.
lilshopa lilshopa

2020/6/11

#
if(isAtEdge())
im using this right now, how do i make the code to remove itself? i tried Mundo1.removeObject(Bala); but it didnt work Mundo1(myworld) Bala(Bullet)
lilshopa lilshopa

2020/6/11

#
        Actor Bala;
        Bala = getOneIntersectingObject(Bala.class);
       
        
        if(Bala != null)
        {
            World Mundo1;
            Mundo1 = getWorld();
            
            Mundo1.removeObject(Bala);
i did this in the enemy subclass so that the bullet and the enemy when hit each other they both disappear but its still not quite working
lilshopa lilshopa

2020/6/11

#
I did it, thank you so much and sorry for the bothering all the day!
You need to login to post a reply.