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

📄 shark.java

📁 j2me的一款钓鱼的游戏
💻 JAVA
字号:
package Kidfishing;

import java.io.IOException;

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

import tool.Tools;

public class Shark {

	static private int v = 1;// 鲨鱼速度

	Image image[];// 鲨鱼图象数组

	int x, y;// 鲨鱼坐标

	private int frame;//

	Graphics g;

	boolean iscome;
	boolean stay;

	int count;

	Shark() {

		try {
			Image res = Image.createImage("/shark.png");

			image = Tools.getAnmi(res, 0, 0, 1, 3, 50, 20);

		} catch (IOException e) {

			e.printStackTrace();
		}
	}

	// 移动
	void move() {
		if (isMove()) {

			x += v;
			nextFrame();

		}

	}

	// 咬钩
	boolean isCatch(int x, int y) {

		if (Tools.isCollRect(x, y, 1, 1, this.x + 24, this.y + 14, 20, 6)) {
			return true;
		}
		return false;
	}

	boolean isMove() {
		if (x > Mycan.WID || stay) {
			return false;
		}
		return true;
	}

	public void drawShark(Graphics g) {
		if (iscome) {
			g.drawImage(image[frame], x, y, Graphics.TOP | Graphics.LEFT);

		}
	}

	public void nextFrame() {

		if (frame++ >= 2) {
			frame = 0;
		}
	}

}

⌨️ 快捷键说明

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