android - Why are the onTouchEvent listeners in my buttonSprite Array returning all the same values? -
i've created array of spritebuttons touch listeners follows:
attackcursor.movetofirst(); while (attackcursor.isafterlast() == false) { attackbuttons[attackbuttonscounter] = new buttonsprite(0, 0, playermenu.getplayermenuattacktr(), engine.getvertexbufferobjectmanager()) { @override public boolean onareatouched(touchevent pscenetouchevent, float ptoucharealocalx, float ptoucharealocaly) { if (pscenetouchevent.isactiondown()) { beep.play(); attacktype = cursor.getint(0); } return true; } }; attackbuttonscounter++; }
when run way error message touch events. if replace cursor.getint(0) theattackbuttonscounter makes buttons have data of last run of loop. there problem inserting code onareatouch() when generated loop? know don't have @override above touch method. not cause sure. i'd appreciate pointers in right direction
Comments
Post a Comment