问题描述
哪位大哥看看这段代码哪错了,为什么坦克旋转不同方向,子弹一直向上发射?列出子弹部分//初始化子弹for(inti=0;i<bullets.length;i++){bullets[i]=newSprite(BitmapFactory.decodeResource(res,R.drawable.bullet),6,6);bullets[i].setFrameSequence(newint[]{i});}//绘制子弹的移动for(inti=0;i<bullets.length;i++){bullets[i].paint(c);if(bullets[i].getX()<0||bullets[i].getX()>320||bullets[i].getY()<0||bullets[i].getY()>300){bullets[i].setVisible(false);}else{//移动子弹switch(bullets[i].getTransform()){caseSprite.TRANS_NONE:bullets[i].move(0,-8);break;caseSprite.TRANS_ROT90:bullets[i].move(8,0);break;caseSprite.TRANS_ROT180:bullets[i].move(0,-8);break;caseSprite.TRANS_ROT270:bullets[i].move(-8,0);break;}caseKeyEvent.KEYCODE_DPAD_CENTER:for(inti=0;i<bullets.length;i++){if(bullets[i].isVisible()==false){bullets[i].setVisible(true);bullets[i].setTransform(transform);switch(transform){caseSprite.TRANS_NONE:bullets[i].setPosition(player.getX(),player.getY());break;caseSprite.TRANS_ROT90:bullets[i].setPosition(player.getX(),player.getY());break;caseSprite.TRANS_ROT180:bullets[i].setPosition(player.getX(),player.getY());break;caseSprite.TRANS_ROT270:bullets[i].setPosition(player.getX(),player.getY());break;}break;