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

📄 manaction.java

📁 是男人就下100层的游戏的移植到手机上的
💻 JAVA
字号:
//package src;

//import javax.microedition.lcdui.Image;

public class ManAction {

	public int manX, manY;//位置
	
	public int imgX,imgY;
	
	int manY_add;//下落累加
	
	int manY_0;//下落初始y值
	
	int speed;
	
	public boolean down;//true为下落
	
	int ActionFace;//移动时的方向
	
//	int face;//方向  DirectGraphics.FLIP_HORIZONTAL(8192):左,0:右
	
	int width_max,width_min;

//	static Image man0, man1, man2;

	MyCanvas mycanvas;

	public ManAction(MyCanvas mycanvas) {
		
		ActionFace = 0;

	}


	public void MoveAction(int state){
		switch(state){
		case -3:ActionFace = state;
		case -4:ActionFace = state;
		case  0:ActionFace = state;
		}
	
	}

	public void ManMove() {
		
//		System.out.println("down:      "+down);
//		System.out.println("face: "+face);
//		System.out.println("ManMove__ActionFace:"+ActionFace);
		
		if (!down) {//不下落
			manY -= speed;
			manY_add = 0;
			manY_0   = manY;

			if (ActionFace == -3 ) {//左移动
				if(manX - 5 < width_min){manX = width_min;}
				else{manX -= 4;ImgMove();}
			}
			if (ActionFace == -4 ) {//右移动
				if(manX + 5 > width_max){manX = width_max;}
				else{manX += 4;ImgMove();}
			}
			
			
//			if(manY <0 ){down = true;}
//			System.out.println("          downXXXX  "+manX);
//			System.out.println("                  downYYYY "+manY);
		}
		else {//下落
            if(ActionFace == -3){
				manX-=3;imgY = 13;
			}

		    if(ActionFace == -4){
				manX+=3;imgY = 0;
			}

			if(manX > width_max){manX = width_max;}
			if(manX < width_min){manX = width_min;}
			manY_add += 3;
			imgX = 9*2;
			manY = manY_add*manY_add/30 + manY_0;
//			if(manY > 130){down = true;}
//			System.out.println("manY_add  "+manY_add);
//			System.out.println("downXXXX  "+manX);
//			System.out.println("        downYYYY "+manY);
//			b[1] = b[0] * b[0] / 700 + b[2];
		}
//		System.out.println("man.downYYYY "+manY);
	}
	private void ImgMove(){
		imgX+=9;
		if(imgX>=45)imgX = 0;
	}

}

⌨️ 快捷键说明

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