0

I am using the Cocos2d-android library

Qus :

Image what I call from CCSprite.sprite("Star.png") , Sometime Appear correctly or Sometime randomly pick an Image from asset foler ?

Basically I am follow the Sample example which is in the library of cocos2d-android.

Now, I have created a GameScene, In which 3 MenuItem like as sample example (Next, restart, previous)

I have created different classes and extends the GameScene, when One class done their functionality after 5 sec I call the next class and previous disappear and new class appear on the same CClayer.

from class A to class B it'll take 5 sec and in this time intervel I call a CCSprite for completing its class A. This Image (CCSPrite ) create problem otherwise all images working fine.

What happen I don't know. Even I cleaup() CCSprite before going into the class B.

If someone face this problem than help me

All Suggestions are welcome.

Akarsh M
  • 1,629
  • 2
  • 24
  • 47

2 Answers2

0

There might be two resources of the same name STAR.png. Check all the drawable folders. Like there are 5 folders in res folder of the project like Drawable HDPI, drawable IDPI and so on. check all the folders for duplicate images.

Sandeep R
  • 2,284
  • 3
  • 25
  • 51
0

if you want to move from one scene to another scene use this line.This will automatically remove your all children.

CCDirector.sharedDirector().replaceScene(gamePlayScene);

if you want to move from one layer to another with in the scene then remove that layer by using

this.removeSelf();
parentlayer.addChild(nextLayer);  
Rama
  • 1,156
  • 1
  • 7
  • 13
  • I a m not changing CCScene. It's like change all the images from the Scene. Have you looked on the cocos2d android test sample. Just like that – Akarsh M Sep 24 '13 at 06:47
  • are u getting random images for particular sprite or the same sprite is showing multiple times? If possible place the code – Rama Sep 24 '13 at 09:01
  • I have CCSprite which I used for 5 sec as I mention above that CCSprite have a smily symbol. when I complete with Class A functionality, it'll appear but sometime this CCSprite shown me the smily symbol and sometime shown the other images like which are in the Asset folder. I cant figure out this problem. the Code is very large right now. If it is possible to me than I reduce the code and will be pasted here. – Akarsh M Sep 24 '13 at 11:03
  • What i can suggest you is: – Rama Sep 24 '13 at 11:50
  • What i can suggest you is: run an action parallel action ((remove all childern of classA and add Loading image in a sequence action.) && and then call classB) – Rama Sep 24 '13 at 11:58
  • have you used a test sample which is included into the cocos2d android . – Akarsh M Sep 24 '13 at 13:14
  • actually I tried all this , but couldnot resolve it , if u used that test sample than suggest me what I add into my code – Akarsh M Sep 24 '13 at 13:16