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

📄 bullet.java

📁 自己做的一个JAVA射击小游戏!可以上真机玩的!
💻 JAVA
字号:
import java.io.IOException;
import java.util.Vector;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

  
public class Bullet {
	Image bulletImage;
	int bulletx=0,bullety=0;
	int height;
	 public static boolean isDisplay = false;
    Back back;
     int imageHeight;
     Vector vector;
     int imageWidth;
 	AcCV ac=null;
    private int dy =10;
	public  Bullet(AcCV ac,int x,int y){
		    
        try {
			bulletImage=Image.createImage("/bullet.png");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		this.ac=ac;
		back=new Back(ac);
		
		
		this.bulletx=x;
		this.bullety=y;
		vector=new Vector();
	}
	protected void paint(Graphics g) {
		
		 
		g.drawImage(bulletImage,bulletx+8,bullety+273,Graphics.TOP | Graphics.LEFT);
	}
	 public void move() {
    if (bullety < ac.getHeight()) {
        bullety-=dy;
       // System.out.println("123="+bullety);
    } 
    else 
    	isDisplay = false;
}   
	 
	 public void processEvent() 
		{
			
			recycleRes();
		}
	 public void recycleRes() 
		{  
			
			bulletImage=null;
			ac=null;
		}  
	
	    
}

⌨️ 快捷键说明

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