leijunhunter / rokon

Automatically exported from code.google.com/p/rokon
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Scene.clear() and clearLayer doesn't work #134

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
call clear function but no effect,sprites are still on the screen. 

i see the code and find that you only clear the array, you should also call 
layer.getGameObject(index).remove! Then sprites actually be removed.

Original issue reported on code.google.com by rayjun...@gmail.com on 4 Aug 2010 at 10:01

GoogleCodeExporter commented 8 years ago

Original comment by rtaylor205@gmail.com on 8 Aug 2010 at 5:19

GoogleCodeExporter commented 8 years ago
no, it's not fixed.I see you fix code of Layer.clear, but it still doesn't 
work. You should do like this:

public void clear() {
    for(int i = 0; i < gameObjects.getCount(); i++) {
        DrawableObject obj = gameObjects.get(i);
    if(obj != null) {
        obj .remove();
    }
    }
    gameObjects.clear();
} 

Original comment by rayjun...@gmail.com on 9 Aug 2010 at 1:20

GoogleCodeExporter commented 8 years ago
I call scene.clearLayer(0), it doesn't work. But call getLayer(0).clear(), it 
works! How strange it is! 

Original comment by rayjun...@gmail.com on 11 Aug 2010 at 7:09