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

📄 zd.java

📁 坦克大战类游戏实现坦克的基本功能控制坦克地图行走
💻 JAVA
字号:
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

public class ZD extends Sprite 
{
	int m,v;
	public ZD(Image im,int w,int h)
	{
		super(im,w,h);
		
		v=15;
		this.setVisible(false);
	}
	public void create(int x,int y,int m1)
	{
		m=m1;
		this.setVisible(true);
		this.setPosition(x,y);
	}
	public void destroy()
	{
		this.setVisible(false);
	}
	public void move(BJ bj,MC mc)
	{
		if(this.isVisible()==true)
		{
			if(m==0)
			{
				this.move(0,-v);
				if(this.collidesWith(bj,true)==true)
				{
					destroy();
					for(int i1=0;i1<10;i1++)
					{
					mc.bao[i1].create(this.getX()-12,this.getY()-11);
					}
				}
			}
			if(m==1)
			{
				this.move(0,v);
				if(this.collidesWith(bj,true)==true)
				{
					destroy();
					for(int i1=0;i1<10;i1++)
					{
					mc.bao[i1].create(this.getX()-12,this.getY()-11);
					}
				}
			}
			if(m==2)
			{
				this.move(-v,0);
				if(this.collidesWith(bj,true)==true)
				{
					destroy();
					for(int i1=0;i1<10;i1++)
					{
					mc.bao[i1].create(this.getX()-12,this.getY()-11);
					}
				}
			}
			if(m==3)
			{
				this.move(v,0);
				if(this.collidesWith(bj,true)==true)
				{
					destroy();
					for(int i1=0;i1<10;i1++)
					{
					mc.bao[i1].create(this.getX()-12,this.getY()-11);
					}
				}
			}
		}
	}

	
}

⌨️ 快捷键说明

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