⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bullets.java

📁 手机RPG游戏
💻 JAVA
字号:
package obj;import java.util.*;import main.*;import javax.microedition.media.*;import java.io.*;import thread.*;import javax.microedition.lcdui.*;public class Bullets {  public Vector bs;  private int max;  int speed=Cntrl.load.myBulletSpeed;  public Bullets() {    max=Cntrl.load.myBulletMax;    bs=new Vector();  }  private void Add(Bullet b){    if(bs.size()>max)return;    bs.addElement(b);  }  private void Remove(Bullet b){    bs.removeElement(b);  }  private void Move(){    for(int i=0;i<bs.size();i++){      Bullet b=(Bullet)bs.elementAt(i);      b.Move();    }    for(int i=0;i<bs.size();i++){      Bullet b=(Bullet)bs.elementAt(i);      if(!b.getAlive()) Remove(b);    }  }  public void DrawSelves(Graphics g,boolean myPlanAlive,Action action,int myPlan_x,int myPlan_y,int w,int h){    if(myPlanAlive)//如果玩家飞机是活的,就能打子弹        {          this.addMyBullet(action,myPlan_x,myPlan_y,w,h);          Move();        for(int i=0;i<bs.size();i++){          Bullet b=(Bullet)bs.elementAt(i);          b.DrawSelf(g);        } }  }//////////////////////////////////////////////////////////////////////private void addMyBullet(Action action,int myPlan_x,int myPlan_y,int w,int h){//玩家子弹的移动      if(action.fire!=(0)){        Add(new Bullet(myPlan_x,myPlan_y,0,speed,w,h));        Cntrl.midt.bulletMid_play=true;//子弹的音乐开关       }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -