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

2016/4/1

remove object after time

Bassusour Bassusour

2016/4/1

#
I have read some threads about this topic, but I can't make it work.
public void tid_metode()
    {
    if (tid >300)
    {
        getWorld().removeObjects(getWorld().getObjects(ND.class));
    }
    }
And in my act method:
tid++;
danpost danpost

2016/4/1

#
If this code is in the ND class, then you only need to remove 'this':
// line 5 would then be
getWorld().removeObject(this);
You need to login to post a reply.