0

i have started to develope an game app using cocos2d-android game engine, til now had put 4 imageview and a background image to the scene1, now if clicked on 1st imageview it should navigate to the next scene, i googled and youtube for this but did not succeeded, and also there is no more sources for cocos2d android game engine.

samm
  • 482
  • 5
  • 14

2 Answers2

1

Make your image as menuItem and change your scene on the click method of that menuItem as below

    CCMenuItem  menuItem1 = CCMenuItemImage.item("backbtn.png", "backbtn.png", this,
            "onClickMenuItem");

then handle the onClick method of this menuItem as below

    public void onClickMenuItem(Object menuItem) {
    if (menuItem == menuItem1) {
        CCDirector.sharedDirector().popScene();

    } 
}
Rishabh Bhardwaj
  • 832
  • 8
  • 20
0

Use CCMenu and CCMenuItemImage or CCMenuItemSprite. You can set method that will be called on menu item click.

Morion
  • 10,495
  • 1
  • 24
  • 33