Hello everybody!
When I need to add Sprite to a LayerManager,
the method is .append();
but if I want to remove the Sprite from LayerManager, How should I do?
Thank you for answering my question!
Thank you!
hi. iv read a book (MIDP game programming) that there is a method called ādeleteSpriteā now i dont have that book to look at it again on how to do it⦠i tried it on the layerManager but it is not a method of it⦠but i havent tried yet if it is a method of Sprite class⦠you should try it though⦠if am not busy ill reply to you later to help you⦠HEY GUYS! HELP THIS GUY OUT! ;D
Check the MIDP 2.0 JavaDocs: LayerManager has a method āremoveā to remove a Layer from it (remember that Sprites and TiledLayers are both Layers).
david⦠i tried that method
this is in the javadoc:
layerManager.remove(Layer 1);
Layer 1 means the index of the layer I want to removeā¦
i tried this one a few weeks ago but it failedā¦
layerManager.remove(2);
if my sprite is at layer 2
i dunno. pls check it again⦠IāLL just reply if i have time
No, thatās not a number ā1ā, thatās a letter ālā. I.e. you donāt call:
layerManager.remove(2);
but instead you call:
layerManager.remove(mySprite);
If youāve got Forum Nokiaās āNokia Developer Suite for J2ME 2.2ā, have a look at MIDlet āHawkā in directory midp_2_0_examples (especially see method ātickā of class āHawkCanvasā). Youāll see that fired missiles are added using method āinsertā and removed using method āremoveā. This works for me both in various emulators and in my Nokia 6600.