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

📄 sprite.java

📁 小游戏,MIDP2.0,非常不错的!请试用下!
💻 JAVA
字号:
 //2003-11-10 //Canoeingimport java.util.Random;import java.lang.Math;public class Sprite {   public int X; //x表示行   public int Y; //y表示行  public int nextX; //下一个障碍物的相对坐标  public int T; //物体类型  public int direction;//方向 及对应的图片0,1,2,3,4,5,6  public static final int TNUM = 7; //障碍物种类个数  public static final int MINnextX = 40; //障碍物种类个数  public static final int MAXnextX = 60; //障碍物种类个数  static Random randomY = new Random();  static Random randomT = new Random();  static Random randomNextX = new Random(); //产生障碍物间隔//0,人//1,鳄鱼//2,树//3,激流//4,漩涡//5,小石头//6,中石头//7,大石头  public Sprite() {           //产生小人的构造函数    this.X = 60;//64-10;表示行 row船的起始高度    this.Y = 80;//50;//30;表示行船的起始    this.T = 0;                  //只有自一个物体    this.nextX = 0;              //0:只有一个船    this.direction = 3;         //船垂直向下的那个船  }  public Sprite(int object) { //产生障碍物    this.X = 208;//128;  //108    此处的X代表有128行                               //物体从底部出现    this.Y = Math.abs(randomY.nextInt()) % 144;//84+40;//128-10-24;    //随机物体出现    if(object<250){    this.T =  Math.abs(randomT.nextInt()) % (this.TNUM-1)+2;  }else{        this.T =  Math.abs(randomT.nextInt()) % this.TNUM+1;  }   // System.out.println("this.T = Math.abs(randomT.nextInt()) % this.TNUM+1;"+this.T);    this.nextX = this.randomNextX.nextInt() %(this.MAXnextX - this.MINnextX) +    //随机物体的间隔        this.MINnextX;  }//  public void sPrint(){ //   System.out.println("this.X = "+this.X+"this.Y"+this.Y+"this.T"+this.T+"this.nextX"+this.nextX); // }}

⌨️ 快捷键说明

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