J2ME 2D小游戏入门之旅(一)游戏的框架

作者:favoyang 文章来源:J2ME开发网

   前几天看到tony在csdn上发布自己的学习作品“是男人就坚持60s”,觉得创意虽然简单但是却很耐玩,是学习手机游戏制作的入门经典,于是一时兴起,clone了一下,图片依然使用的是tony的图片,纯粹学习之用。如果大家对这个游戏感兴趣可以与tony联系或访问他的blog。

     从发展趋势上说midp2.0是趋势,最便宜的midp2.0手机如ot735i,已经1700元左右;而西门子一年前的高端机cx65,现在也只有2500左右;并且2500-3000这个价位的midp2.0手机有多种选择,西门子、se、N机都有。我个人挺喜欢cx65,如果将来手机制造商成本不断降低,相信1500元的midp将不是梦…当然还要看应用是否丰富了。

    言归正传,我们将使用midp 2.0 来开发我们的游戏,代号fly。开发工具jbulider。等文章全写完了,会提供src下载。

目录:

一、游戏的框架

二、完善周边工具类(图象、GameObject、Font)

三、控制飞机的移动

四、加入子弹群,实现碰撞运算

五、实现爆炸效果、并加入道具导弹

六、不足多多,你认为呢?

七、源码

一、游戏的框架

    我们的游戏需要一个通用的游戏框架,也方便以后的开发,但实现一个引擎是复杂的。作为初学者如果要你考虑太多的问题,恐怕会让你偏离主线,这里只给出canvas的代码,不理解可以参看本站的另外一篇系列文章《使用MIDP2.0开发游戏》。

    使用singlon实现,因为每个gamecanvas都需要很多的内存空间。另外对我们来说,只要改写gameInit(),gameMain(),一次性初始化的代码写在构造函数中。

public class MyGameCanvas extends GameCanvas
implements Runnable, CommandListener{
  private static MyGameCanvas instance;
  Graphics g;
  boolean running;
  Thread t;
  Command startcmd,exitcmd,restartcmd;
  int keystate;
  boolean keyevent;
  boolean key_up,key_down,key_left,key_right,key_fire;
  private boolean allowinput;
  public int screenwidth;
  public int screenheight;
  boolean gameover;
  //define your variable here
  //define your variable end


  protected MyGameCanvas() {
    super(true);
    g=getGraphics();
    running=false;
    t=null;
    addCommand(startcmd=new Command("start",Command.OK,1));
    addCommand(exitcmd=new Command("exit",Command.EXIT,1));
    setCommandListener(this);
    screenwidth=getWidth();
    screenheight=getHeight();

    //put your init once code here
    //put your init once code end
  }
  
  synchronized public static MyGameCanvas getInstance() {
    if (instance == null) {
      instance = new MyGameCanvas();
      System.out.println("new MyGameCanvas");
    }
    return instance;
  }

  public void run(){
    System.out.println("MyGameCanvas run start");
    long st=0,et=0,diff=0;
    int rate=50;//16-17 frame per second
    while(running){
      st=System.currentTimeMillis();
      gameinput();
      gameMain();
      et=System.currentTimeMillis();
      diff=et-st;
      if(diff<rate){
        //System.out.println("Sleep "+(rate-diff));
        try {
          Thread.sleep(rate - diff);
        }
        catch (InterruptedException ex) {}
      }else{
        //System.out.println("rush , and the frame using time: á"+diff);
      }
    }
    System.out.println("MyGameCanvas run end");
  }

  public void start(){
      if(!running){
        running=true;
        t=new Thread(this);
        t.start();
      }
  }

  private void gameMain() {
    g.setColor(0,0,0);//clear screen
    g.fillRect(0,0,getWidth(),getHeight());

    background.paint(g);//draw background
    //g.setColor(255,255,255);
    //g.drawString("hello",1,1,g.TOP|g.LEFT);
    flushGraphics();
  }

  private void gameInit() {
    gameover=false;
    gametime=0;
    gametimeoffset=System.currentTimeMillis();
    allowinput=true;
    key_up=key_down=key_left=key_right=key_fire=false;
  }

  public void stop(){
    if(running){
      running = false;
    }
  }

  public void commandAction(Command c, Displayable d) {
    String cmdstr=c.getLabel();
    if(cmdstr.equals("start")){
       gameInit();
       start();
       removeCommand(startcmd);
       addCommand(restartcmd=new Command("restart",Command.OK,1));
    }else if(cmdstr.equals("restart")){
      stop();
      while(t.isAlive());
      gameInit();
      start();
    }else if(cmdstr.equals("exit")){
      stop();
      Navigate.midlet.destroyApp(false);
      Navigate.midlet.notifyDestroyed();
    }
  }

  private void gameinput() {
    if(allowinput){
      keystate=getKeyStates();
      keyevent=false;
      if((keystate & UP_PRESSED)!=0){//up
        key_up=true;keyevent=true;
        //deal your unstop job code here
        //System.out.println("up press");
        //deal your unstop job code end
      }else if((keystate & UP_PRESSED)==0){//release key
        if(key_up==true){
          key_up=false;
          //deal your one press-one job code here
          //System.out.println("up release");
          //deal your one press-one job code end
        }
      }

      if((keystate & DOWN_PRESSED)!=0){//down
        key_down=true;keyevent=true;
        //deal your unstop job code here
        
        //System.out.println("down press");
        //deal your unstop job code end
      }else if((keystate & DOWN_PRESSED)==0){//release key
        if(key_down==true){
          key_down=false;
          //deal your one press-one job code here
          //System.out.println("down release");
          //deal your one press-one job code end
        }
      }

      if((keystate & LEFT_PRESSED)!=0){//left
        key_left=true;keyevent=true;
        //deal your unstop job code here
        
        //System.out.println("left press");
        //deal your unstop job code end
      }else if((keystate & LEFT_PRESSED)==0){//release key
        if(key_left==true){
          key_left=false;
          //deal your one press-one job code here
          //System.out.println("left release");
          //deal your one press-one job code end
        }
      }

      if((keystate & RIGHT_PRESSED)!=0){//right
        key_right=true;keyevent=true;
        //deal your unstop job code here

        //System.out.println("right press");
        //deal your unstop job code end
      }else if((keystate & RIGHT_PRESSED)==0){//release key
        if(key_right==true){
          key_right=false;
          //deal your one press-one job code here
          //System.out.println("right release");
          //deal your one press-one job code end
        }
      }

      if((keystate & FIRE_PRESSED)!=0){//fire
        key_fire=true;keyevent=true;
        //deal your unstop job code here
        //System.out.println("fire press");
        //deal your unstop job code end
      }else if((keystate & FIRE_PRESSED)==0){//release key
        if(key_fire==true){
          key_fire=false;
          //deal your one press-one job code here
          //System.out.println("fire release");
          //deal your one press-one job code end
        }
      }
      if(!keyevent){
        //no keyevent here
        //System.out.println("NO KEY press");
        //no keyevent end
      }
    }
  }

  public static void cleanJob(){
    instance=null;
  }


}

     从发展趋势上说midp2.0是趋势,最便宜的midp2.0手机如ot735i,已经1700元左右;而西门子一年前的高端机cx65,现在也只有2500左右;并且2500-3000这个价位的midp2.0手机有多种选择,西门子、se、N机都有。我个人挺喜欢cx65,如果将来手机制造商成本不断降低,相信1500元的midp将不是梦…当然还要看应用是否丰富了。

    言归正传,我们将使用midp 2.0 来开发我们的游戏,代号fly。开发工具jbulider。等文章全写完了,会提供src下载。

目录:

一、游戏的框架

二、完善周边工具类(图象、GameObject、Font)

三、控制飞机的移动

四、加入子弹群,实现碰撞运算

五、实现爆炸效果、并加入道具导弹

六、不足多多,你认为呢?

七、源码

一、游戏的框架

    我们的游戏需要一个通用的游戏框架,也方便以后的开发,但实现一个引擎是复杂的。作为初学者如果要你考虑太多的问题,恐怕会让你偏离主线,这里只给出canvas的代码,不理解可以参看本站的另外一篇系列文章《使用MIDP2.0开发游戏》。

    使用singlon实现,因为每个gamecanvas都需要很多的内存空间。另外对我们来说,只要改写gameInit(),gameMain(),一次性初始化的代码写在构造函数中。

public class MyGameCanvas extends GameCanvas
implements Runnable, CommandListener{
  private static MyGameCanvas instance;
  Graphics g;
  boolean running;
  Thread t;
  Command startcmd,exitcmd,restartcmd;
  int keystate;
  boolean keyevent;
  boolean key_up,key_down,key_left,key_right,key_fire;
  private boolean allowinput;
  public int screenwidth;
  public int screenheight;
  boolean gameover;
  //define your variable here
  //define your variable end


  protected MyGameCanvas() {
    super(true);
    g=getGraphics();
    running=false;
    t=null;
    addCommand(startcmd=new Command("start",Command.OK,1));
    addCommand(exitcmd=new Command("exit",Command.EXIT,1));
    setCommandListener(this);
    screenwidth=getWidth();
    screenheight=getHeight();

    //put your init once code here
    //put your init once code end
  }
  
  synchronized public static MyGameCanvas getInstance() {
    if (instance == null) {
      instance = new MyGameCanvas();
      System.out.println("new MyGameCanvas");
    }
    return instance;
  }

  public void run(){
    System.out.println("MyGameCanvas run start");
    long st=0,et=0,diff=0;
    int rate=50;//16-17 frame per second
    while(running){
      st=System.currentTimeMillis();
      gameinput();
      gameMain();
      et=System.currentTimeMillis();
      diff=et-st;
      if(diff<rate){
        //System.out.println("Sleep "+(rate-diff));
        try {
          Thread.sleep(rate - diff);
        }
        catch (InterruptedException ex) {}
      }else{
        //System.out.println("rush , and the frame using time: á"+diff);
      }
    }
    System.out.println("MyGameCanvas run end");
  }

  public void start(){
      if(!running){
        running=true;
        t=new Thread(this);
        t.start();
      }
  }

  private void gameMain() {
    g.setColor(0,0,0);//clear screen
    g.fillRect(0,0,getWidth(),getHeight());

    background.paint(g);//draw background
    //g.setColor(255,255,255);
    //g.drawString("hello",1,1,g.TOP|g.LEFT);
    flushGraphics();
  }

  private void gameInit() {
    gameover=false;
    gametime=0;
    gametimeoffset=System.currentTimeMillis();
    allowinput=true;
    key_up=key_down=key_left=key_right=key_fire=false;
  }

  public void stop(){
    if(running){
      running = false;
    }
  }

  public void commandAction(Command c, Displayable d) {
    String cmdstr=c.getLabel();
    if(cmdstr.equals("start")){
       gameInit();
       start();
       removeCommand(startcmd);
       addCommand(restartcmd=new Command("restart",Command.OK,1));
    }else if(cmdstr.equals("restart")){
      stop();
      while(t.isAlive());
      gameInit();
      start();
    }else if(cmdstr.equals("exit")){
      stop();
      Navigate.midlet.destroyApp(false);
      Navigate.midlet.notifyDestroyed();
    }
  }

  private void gameinput() {
    if(allowinput){
      keystate=getKeyStates();
      keyevent=false;
      if((keystate & UP_PRESSED)!=0){//up
        key_up=true;keyevent=true;
        //deal your unstop job code here
        //System.out.println("up press");
        //deal your unstop job code end
      }else if((keystate & UP_PRESSED)==0){//release key
        if(key_up==true){
          key_up=false;
          //deal your one press-one job code here
          //System.out.println("up release");
          //deal your one press-one job code end
        }
      }

      if((keystate & DOWN_PRESSED)!=0){//down
        key_down=true;keyevent=true;
        //deal your unstop job code here
        
        //System.out.println("down press");
        //deal your unstop job code end
      }else if((keystate & DOWN_PRESSED)==0){//release key
        if(key_down==true){
          key_down=false;
          //deal your one press-one job code here
          //System.out.println("down release");
          //deal your one press-one job code end
        }
      }

      if((keystate & LEFT_PRESSED)!=0){//left
        key_left=true;keyevent=true;
        //deal your unstop job code here
        
        //System.out.println("left press");
        //deal your unstop job code end
      }else if((keystate & LEFT_PRESSED)==0){//release key
        if(key_left==true){
          key_left=false;
          //deal your one press-one job code here
          //System.out.println("left release");
          //deal your one press-one job code end
        }
      }

      if((keystate & RIGHT_PRESSED)!=0){//right
        key_right=true;keyevent=true;
        //deal your unstop job code here

        //System.out.println("right press");
        //deal your unstop job code end
      }else if((keystate & RIGHT_PRESSED)==0){//release key
        if(key_right==true){
          key_right=false;
          //deal your one press-one job code here
          //System.out.println("right release");
          //deal your one press-one job code end
        }
      }

      if((keystate & FIRE_PRESSED)!=0){//fire
        key_fire=true;keyevent=true;
        //deal your unstop job code here
        //System.out.println("fire press");
        //deal your unstop job code end
      }else if((keystate & FIRE_PRESSED)==0){//release key
        if(key_fire==true){
          key_fire=false;
          //deal your one press-one job code here
          //System.out.println("fire release");
          //deal your one press-one job code end
        }
      }
      if(!keyevent){
        //no keyevent here
        //System.out.println("NO KEY press");
        //no keyevent end
      }
    }
  }

  public static void cleanJob(){
    instance=null;
  }


}

   

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
小剑士import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.Random; import javax.microedition.lcdui.*; import javax.microedition.rms.RecordStore; public class HeroSprite extends ASprite{ public final int LISTENER_LEFT=4; public final int LISTENER_RIGHT=32; public final int LISTENER_UP=2; public final int LISTENER_DOWN=64; public final int LISTENER_FIRE=256; public int dir,hp,maxhp,lv,exp,nextexp,prevexp,itemlv,gold,at,df,mapdir=0; public String MyItem; public boolean isAlive,isAttach,isStop,isBattle,iisBattle,iiisBattle,isStopb,isPause=false;//是否生存以及是否攻击两个判定量 //Sprite HSprite=new Sprite(HeroImage,60,61); public int x,y,luX,luY,ruX,ruY,ldX,ldY,rdX,rdY,stopTime=5,time=0; public Random random=new Random(); public int numEmpty=0; //代表各个方向的常量 public final int DIR_LEFT=2; public final int DIR_DOWN=1; public final int DIR_RIGHT=4; public final int DIR_UP=3; public final int DIR_LU=5; public final int DIR_RU=6; public final int DIR_LD=7; public final int DIR_RD=8; public String DataName; public char itemcode[]={'0','0','0','0','0','0','0','0','0','0','0','0','0'}; //各个方向的图象序列数组 private int up_seq[]={1,2,3,4,5,6,7,8}; private int lu_seq[]={14,15,16,17,18,19,20,21}; private int ru_seq[]={40,41,42,43,44,45,46,47}; private int ld_seq[]={66,67,68,69,70,71,72,73}; private int rd_seq[]={79,80,81,82,83,84,85,86}; private int left_seq[]={92,93,94,95,96,97,98,99}; private int down_seq[]={53,54,55,56,57,58,59,60}; private int right_seq[]={27,28,29,30,31,32,33,34}; public int itemat[]={0,30,70,120,200}; public int itemdf[]={0,20,60,110,190}; private int up[]={0}; private int lu[]={13}; private int ru[]={39}; private int ld[]={65}; private int rd[]={78}; private int left[]={91}; private int down[]={52}; private int right[]={26}; //打斗时候的图象序列数组 public int downb_seq[]={9,10,11,12}; public int upb_seq[]={35,36,37,38}; public int leftb_seq[]={48,49,50,51}; public int rightb_seq[]={61,62,63,64}; private int lub_seq[]={87,88,89,90}; private int rub_seq[]={74,75,76,77}; private int ldb_seq[]={22,23,24,25}; private int rdb_seq[]={100,101,102,103}; public boolean[][] isWalkable; //构造函数 public HeroSprite(Image hImage,int height,int width){ super(hImage,height,width); x=180; y=180; luX=(int)(x/16)+1; luY=(int)(y/16); lv=1; maxhp=160+(lv-1)*40; itemlv=0; gold=0; MyItem="000000000000"; /*for(int i=0;i<12;i++){ itemcode[i]='0'; }*/ //itemcode={'0','0','0','0','0','0','0','0','0','0','0','0','0'}; exp=210; hp=maxhp; at=30; df=20; prevexp=lv*lv*60-(lv-1)*(lv-1)*60+150; nextexp=prevexp+(lv-1)*(lv-1)*60-(lv-2)*(lv-2)*60+150; System.out.print("已装载英雄类"); this.setFrameSequence(down); isAlive=true; System.out.print("英雄类装载完毕"); } public byte[] chgTorms(boolean isFirst) throws IOException{ ByteArrayOutputStream baos=new ByteArrayOutputStream(); DataOutputStream dos=new DataOutputStream(baos); if(itemcode!=null){ MyItem=String.valueOf(itemcode); } dos.writeUTF(String.valueOf(lv));//将具体数据写入流 dos.writeUTF(String.valueOf(itemlv)); dos.writeUTF(String.valueOf(gold)); dos.writeUTF(String.valueOf(MyItem)); dos.writeUTF(String.valueOf(exp)); if(isFirst==false){//如果不是第一次读入数据则计算攻防 at=itemat[itemlv]+(lv-1)*8+30; df=itemdf[itemlv]+(lv-1)*10+20; } baos.close(); dos.close(); numEmpty=0; if(isFirst==false){ for(int i=0;i<itemcode.length;i++){//如果不是第一次读入数据则计算空格数 if(itemcode[i]=='0'){ numEmpty++; } } } return baos.toByteArray(); } public void doMonster(int myhp,int deadlv,RecordStore rs,int recordid){ this.hp=myhp; if(lv<=6){ prevexp=lv*lv*60-(lv-1)*(lv-1)*60+150;//经验值公式 nextexp=prevexp+(lv-1)*(lv-1)*60-(lv-2)*(lv-2)*60+150; }else{ prevexp=lv*(lv-5)*(lv-5)-40*(lv-4)*(lv-4)+150; nextexp=prevexp+50*(lv+1)*(lv-4)*(lv-4)-40*(lv-3)*(lv-3)+150; } if(deadlv!=0){ exp=exp+deadlv*15+random.nextInt()%5;//怪物死亡时候等级和经验值的换算公式,nextexp下一等级需要的经验,deadlv被杀死怪物的等级 if(exp>=nextexp){//目前设定的最高等级为11级 if(lv<12){ lv++; } at=itemat[itemlv]+(lv-1)*8+30; df=itemdf[itemlv]+(lv-1)*10+20; maxhp=160+(lv-1)*40; hp=maxhp; } try{ rs.setRecord(recordid,chgTorms(false),0,chgTorms(false).length); }catch(Exception e){System.out.println(e);} isBattle=false; } } private void getNowHanglie(){//获得主角的行列数值 luX=(int)(x/16)+1; luY=(int)(y/16); ruX=(int)((x+40)/16)+1; ruY=luY; ldX=luX; ldY=(int)((y+40)/16); rdX=ldX; rdY=ldY; } public void chgMapbool(boolean[][] newbool){ this.isWalkable=newbool; } public void doMove(int keyState){ //System.out.println(ldX+","+ldY); if(hp<=0){ this.isAlive=false; } if(this.isAlive){ getNowHanglie(); if(isPause==false){ switch(keyState){ case LISTENER_UP: if(dir!=DIR_UP){//如果按下UP键时之前的状态不是朝UP的话,则改变状态 dir=DIR_UP; this.setFrameSequence(up_seq); } if(isWalkable[ldX][ldY-1] && isWalkable[rdX][rdY-1]){//对下一步的判断 if(isBattle==true){//按下UP键时候如果是打斗状态则转化为UP奔跑帧 this.setFrameSequence(up_seq); isBattle=false; } if(isStop==true){//如果是停止状态也转化为UP奔跑帧 this.setFrameSequence(up_seq); isStop=false; } y=y-5;//坐标变化 this.nextFrame();//帧变化 } break; case LISTENER_DOWN: if(dir!=DIR_DOWN){ dir=DIR_DOWN; this.setFrameSequence(down_seq); } if(isBattle==true){ this.setFrameSequence(down_seq); isBattle=false; } if(isStop==true){ this.setFrameSequence(down_seq); isStop=false; } if(isWalkable[ldX][ldY+1] && isWalkable[rdX][rdY+1]){ y=y+5; this.nextFrame(); } break; case LISTENER_LEFT: if(dir!=DIR_LEFT){ dir=DIR_LEFT; this.setFrameSequence(left_seq); } if(isBattle==true){ this.setFrameSequence(left_seq); isBattle=false; } if(isStop==true){ this.setFrameSequence(left_seq); isStop=false; } if(isWalkable[ldX-1][ldY]){ x=x-5; this.nextFrame(); } break; case LISTENER_RIGHT: if(dir!=DIR_RIGHT){ dir=DIR_RIGHT; this.setFrameSequence(right_seq); } if(isBattle==true){ this.setFrameSequence(right_seq); isBattle=false; } if(isStop==true){ this.setFrameSequence(right_seq); isStop=false; } if(isWalkable[rdX+1][rdY]){ x=x+5; this.nextFrame(); } break; case LISTENER_LEFT+LISTENER_UP: if(dir!=DIR_LU){ dir=DIR_LU; this.setFrameSequence(lu_seq); } if(isBattle==true){ this.setFrameSequence(lu_seq); isBattle=false; } if(isStop==true){ this.setFrameSequence(lu_seq); isStop=false; } if(isWalkable[ldX-1][ldY] && isWalkable[ldX][ldY-1] && isWalkable[rdX][rdY-1]){ x=x-3; y=y-3; this.nextFrame(); } break; case LISTENER_RIGHT+LISTENER_UP: if(dir!=DIR_RU){ dir=DIR_RU; this.setFrameSequence(ru_seq); } if(isBattle==true){ this.setFrameSequence(ru_seq); isBattle=false; } if(isStop==true){ this.setFrameSequence(ru_seq); isStop=false; } if(isWalkable[ldX][ldY-1] && isWalkable[rdX][rdY-1] && isWalkable[rdX+1][rdY]){ x=x+3; y=y-3; this.nextFrame(); } break; case LISTENER_LEFT+LISTENER_DOWN: if(dir!=DIR_LD){ dir=DIR_LD; this.setFrameSequence(ld_seq); } if(isBattle==true){ this.setFrameSequence(ld_seq); isBattle=false; } if(isStop==true){ this.setFrameSequence(ld_seq); isStop=false; } if(isWalkable[ldX-1][ldY] && isWalkable[ldX][ldY+1] && isWalkable[rdX][rdY+1]){ x=x-3; y=y+3; this.nextFrame(); } break; case LISTENER_RIGHT+LISTENER_DOWN: if(dir!=DIR_RD){ dir=DIR_RD; this.setFrameSequence(rd_seq); } if(isBattle==true){ this.setFrameSequence(rd_seq); isBattle=false; } if(isStop==true){ this.setFrameSequence(rd_seq); isStop=false; } if(isWalkable[rdX+1][rdY] && isWalkable[ldX][ldY+1] && isWalkable[rdX][rdY+1]){ x=x+3; y=y+3; this.nextFrame(); } break; case 0: if(isBattle==false){ isStop=true; switch(dir){ case DIR_DOWN: this.setFrameSequence(down); break; case DIR_LEFT: this.setFrameSequence(left); break; case DIR_UP: this.setFrameSequence(up); break; case DIR_RIGHT: this.setFrameSequence(right); break; case DIR_LU: this.setFrameSequence(lu); break; case DIR_RU: this.setFrameSequence(ru); break; case DIR_RD: this.setFrameSequence(rd); break; case DIR_LD: this.setFrameSequence(ld); break; } } break; case LISTENER_FIRE: if(mapdir==1){ switch(dir){ case 1: if(isBattle==false){ this.setFrameSequence(downb_seq); } break; case 2: if(isBattle==false){ this.setFrameSequence(leftb_seq); } break; case 3: if(isBattle==false){ this.setFrameSequence(upb_seq); } break; case 4: if(isBattle==false){ this.setFrameSequence(rightb_seq); } break; case DIR_LU: if(isBattle==false){ this.setFrameSequence(lub_seq); } break; case DIR_LD: if(isBattle==false){ this.setFrameSequence(ldb_seq); } break; case DIR_RU: if(isBattle==false){ this.setFrameSequence(rub_seq); } break; case DIR_RD: if(isBattle==false){ this.setFrameSequence(rdb_seq); } break; } isBattle=true; break; } } if(isBattle==true){ //如果是打斗状态 if(this.getFrame()==2){//如果是打斗状态的第二帧 iiisBattle=true;//打中状态置于真 }else{ iiisBattle=false; } this.nextFrame(); } if(iiisBattle && isBattle){ iisBattle=true; }else{ iisBattle=false; } dx=x; dy=y; } }else{ if(this.exp>150){ this.exp=this.exp-150; }else this.exp=0; } } }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值