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

📄 pl.java

📁 用j2me做的空战游戏.多npc,碰撞,特效,道具都有!推荐下载
💻 JAVA
字号:
import java.io.IOException;

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

public class PL 
{
	Image im;
	int x,y,m,hp;
	public PL()
	{
		hp=1;
		x = 84;
		y = 175;
		try {
			im = Image.createImage( "/player.png");
		} catch (IOException e) {
			// TODO 自动生成 catch 块
			e.printStackTrace();
		}
		m = 0;
	}
	public void render(Graphics g,boolean l,boolean r)
	{
		if (l == true)
		{
			Tools.paintImage( g,im,x,y,0,0,16,27);
		}
		else if (r == true)
		{
			Tools.paintImage( g,im,x,y,41,0,16,27);
		}
		else
		{
			Tools.paintImage( g,im,x,y,16,0,25,27);
		}
	}
	public void upData(boolean u,boolean d,boolean l,boolean r)
	{
		if (m == 0)
		{
			if (u == true)
			{
				y-=5;
				if (y < 0)
				{
					y += 5;
				}
			}
			if (d == true)
			{
				y+=5;
				if (y >188)
				{
					y -= 5;
				}
			}
			
			if (l == true)
			{
				x-=5;
				if (x < 0)
				{
					x += 5;
				}
			}
			
			if (r == true)
			{
				x+=5;
				if (x > 160)
				{
					x -= 5;
				}
			}
		}
		
		else 
		{
			y -=5;
			m--;
		}
	}
	
}

⌨️ 快捷键说明

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