亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? actor.java

?? 大量j2me源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/**
 * A dynamic moving object capable of existing in a World.
 */

import javax.microedition.lcdui.Graphics;

import net.jscience.math.kvm.MathFP;

abstract public class Actor
{
   public static final int FP_MINUS_1 = MathFP.toFP("-1.0");
   public static final int FP_MINUS_05 = MathFP.toFP("-0.5");
   public static final int FP_MINUS_01 = MathFP.toFP("-0.1");
   public static final int FP_225 = MathFP.toFP("22.5");
   public static final int FP_PI2 = MathFP.mul(MathFP.PI, MathFP.toFP(2));
   public static final int FP_DEGREES_PER_RAD = MathFP.div(MathFP.toFP(360), FP_PI2);
   public static final int FP_ONE = MathFP.toFP("1");

   // lookup table for cos and sin value (0 to 359)
   static int[] lookupCosFP = new int[360];
   static int[] lookupSinFP = new int[360];

   // static init
   {
      for (int i = 0; i < 360; i++)
         lookupCosFP[i] = MathFP.cos(getRadiansFromAngle(i));
      for (int i = 0; i < 360; i++)
         lookupSinFP[i] = MathFP.sin(getRadiansFromAngle(i));
   }
   // Actor types - we place them all in here so we can check the type of
   // a actor instance without doing an expensive instanceof test. This is
   // (of course) a horrible corruption of the intent of an abstract Actor
   // class - it's considered worth it for the performance gain.

   public static final int SHIP_START = 0;
   public static final int PLAYER_SHIP = SHIP_START + 1;

   public static final int ENEMY_SHIP_START = SHIP_START + 2;
   public static final int ENEMY_DRONE = SHIP_START + 3;
   public static final int ENEMY_AI_START = SHIP_START + 4;
   public static final int ENEMY_TURRET = SHIP_START + 5;
   public static final int ENEMY_FIGHTER = SHIP_START + 6;
   public static final int SHIP_END = SHIP_START + 7;

   public static final int BULLET_START = 1000;
   public static final int PLASMA_CANNON = BULLET_START + 1;
   public static final int BULLET_END = BULLET_START + 2;

   private int type;							// type of actor (instead of subclassing)
   private int xFP, yFP;              	// current position
   private int x, y;							// integer versions (stored for speed)
   private int startingX, startingY;	// where the actor starts (used for restart)
   private int startingDir;				// starting direction (used for restart)
   private int lastXFP, lastYFP;
   private int xVelFP, yVelFP;        	// current velocity
   private int xAccFP, yAccFP;        	// current acceleration
   private int thrustFP;
   private int spinFP;                	// current spin rate (in degrees per second)
   private int maxSpinRate;           	// maximum spin rate (in degrees per second)
   private int maxVelFP;					// maximum velocity
   private int bounceVelFP;  			   // velocity to variance when bouncing off an impact
   private int realDir;                // actual direction in degrees
   private int alignedDir;             // aligned direction
   private int alignedDivDegreesFP;   	// degrees per facing division
   private boolean wantAlignment;		// turn auto alignment on

   private long fluff = 0;
   private boolean autoSpinning;			// we set a flag to avoid over calling setSpin()
   private int targetAngle;

   protected Actor owner;
   protected World world;
   private boolean collidable;			// can anything collide with us?
   private boolean visible;				// whether we should be drawn or not

   private Actor nextLinked;				// link to next actor
   private Actor prevLinked;				// link to previous actor

   public Actor()
   {
   }

   public Actor(World w)
   {
      world = w;
   }

   /**
    * Initializes an Actor. The alignedDivArg sets the number of distinct angles
    * this Actor can face. A Ship with 16 facing images has 16 aligned
    * divisions, which translates to an aligned division of 22.5 degrees (360
    * divided by 16). The aligned direction is used by the Actor class to make
    * sure it can only face an angle that can be drawn.
    * @param startX The starting x position of the new Actor.
    * @param startY The starting y position of the new Actor.
    * @param startDirection The starting direction
    * @param alignedDivArg The number of aligned angle divisions.
    * @param maxVelFPArg The maximum velocity.
    * @param thrustFPArg The starting thrust.
    * @param bounceVelFPArg The level of bounce when colliding with something.
    * @param maxSpinRateArg The maximum turn rate in degrees per second.
    */
   public void init(Actor newOwner, int startX, int startY, int thrustFPArg,
                    int speedFPArg, int maxVelFPArg, int startDirection, 
                    int alignedDivArg, int bounceVelFPArg, int maxSpinRateArg)
   {
      setX(startX);
      setY(startY);
      owner = newOwner;
      startingX = x;
      startingY = y;
      startingDir = startDirection;

      maxVelFP = maxVelFPArg;
      maxSpinRate = maxSpinRateArg;

      wantAlignment = false;
      if (alignedDivArg > 0)
      {
         alignedDivDegreesFP = MathFP.div(360, alignedDivArg);
         wantAlignment = true;
      }
      setDirection(startDirection);
      setThrust(thrustFPArg);
      setVel(speedFPArg);

      bounceVelFP = bounceVelFPArg;
      collidable = true;
      visible = true;
   }

   // typically used to restart state for a level (ie. when the player dies)
   public void reset()
   {
      setX(startingX);
      setY(startingY);
      setDirection(startingDir);
      setSpin(0);
      setVel(0);
   }

   public final Actor getNextLinked()
   {
      return nextLinked;
   }

   public final void setNextLinked(Actor nextLinked)
   {
      this.nextLinked = nextLinked;
   }

   public final Actor getPrevLinked()
   {
      return prevLinked;
   }

   public final void setPrevLinked(Actor prevLinked)
   {
      this.prevLinked = prevLinked;
   }

   public final int getType()
   {
      return type;
   }

   public final void setType(int type)
   {
      this.type = type;
   }

   public int getStartingY()
   {
      return startingY;
   }

   public int getStartingX()
   {
      return startingX;
   }

   public final void setStartingPos(int startingX, int startingY)
   {
      this.startingX = startingX;
      this.startingY = startingY;
   }

   public final boolean isEnemyShip()
   {
      return (type > ENEMY_SHIP_START && type < SHIP_END);
   }

   public final boolean isBullet()
   {
      return (type > BULLET_START && type < BULLET_END);
   }

   public final Actor getOwner()
   {
      return owner;
   }

   public final void setOwner(Actor owner)
   {
      this.owner = owner;
   }

   public final void deactivate()
   {
      collidable = false;
      visible = false;
   }

   /**
    * Get a rudamentary distance from this Actor to another (uses basic x, y
    * coords rather than the centre to save time - typically you only need an
    * approx distance anyway.
    */
   public final int distanceTo(Actor another)
   {
      return distance(x, y, another.getX(), another.getY());
   }

   public final void setCollidable(boolean b)
   {
      collidable = b;
   }

   public final boolean isCollidable()
   {
      return collidable;
   }

   public final boolean isVisible()
   {
      return visible;
   }

   public final void setVisible(boolean visible)
   {
      this.visible = visible;
   }

   /**
    * Abstract render method that must be implemented by derived classes.
    * This method is intended to be called by a Actor manager (such as a
    * World class) to draw Actors on the screen.
    * @param graphics The graphics context upon which to draw.
    * @param offsetX The amount to offset the x drawing position by.
    * @param offsetY The amount to offset the y drawing position by.
    */
   public void render(Graphics graphics, int offsetX, int offsetY)
   {
   }

   /**
    * Abstract method to return the width of the Actor.
    */
   abstract public int getWidth();

   /**
    * Abstract method to return the height of the Actor.
    */
   abstract public int getHeight();

   /**
    * Changes the current speed of the actor by setting the velocity based on
    * the current (aligned) direction.
    * @param speedArg The speed to travel at.
    */
   public final void setVel(int speedArg)
   {
      xVelFP = MathFP.mul(MathFP.toFP(speedArg), lookupCosFP[alignedDir]);
      yVelFP = MathFP.mul(MathFP.toFP(speedArg), -lookupSinFP[alignedDir]);
      // If you change this remember to change the cycle code
      if (xVelFP > maxVelFP)
         xVelFP = maxVelFP;
      else if (xVelFP < -maxVelFP) xVelFP = -maxVelFP;
      if (yVelFP > maxVelFP)
         yVelFP = maxVelFP;
      else if (yVelFP < -maxVelFP) yVelFP = -maxVelFP;
   }

   /**
    * Set the direction (in degrees; east = 0). We also set the alignedDir
    * to the closest angle available.
    */
   public final void setDirection(int d)
   {
      realDir = d;
      if (realDir < 0) realDir = (359 + (realDir));   // add the neg value
      if (realDir > 359) realDir = (d - 360);

      // set the facing direction to be the closest alignment
      if (wantAlignment)
      {
         alignedDir = getAlignedDirection(realDir);
      }
      else
         alignedDir = realDir;

   }

   /**
    * Gets the closest aligned direction to the passed in direction (in
    * degrees).
    * @param dir The direction to align (in degrees).
    * @return A direction which aligns to the number of divisions the Actor
    * supports.
    */
   public final int getAlignedDirection(int dir)
   {
      int fp = MathFP.toInt(MathFP.div(MathFP.toFP(dir), alignedDivDegreesFP));
      int ad = MathFP.toInt(MathFP.mul(MathFP.toFP(fp), alignedDivDegreesFP));
      if (ad < 0) ad = 0;
      if (ad > 359) ad = 0;
      return ad;
   }

   /**
    * @return The current aligned direction.
    */
   public final int getDirection()
   {
      return alignedDir;
   }

   /**
    * @return The current real direction (not aligned).
    */
   public final int getRealDirection()
   {
      return realDir;
   }

   /**
    * @return The World object that contains this Actor.
    */
   public final World getWorld()
   {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99热99精品| 欧美三级日韩三级国产三级| 亚洲欧洲www| 91精品啪在线观看国产60岁| 91精品福利视频| 麻豆精品在线播放| 亚洲欧美偷拍卡通变态| 精品少妇一区二区三区在线播放| 一本色道a无线码一区v| 国产一区二区三区四区五区入口| 亚洲大型综合色站| 中文字幕一区二区三区在线观看 | 午夜精品视频一区| 国产精品三级在线观看| 日韩欧美你懂的| 欧美午夜宅男影院| 成人av在线电影| 国产成人自拍高清视频在线免费播放| 亚洲成人激情av| 悠悠色在线精品| 成人欧美一区二区三区1314| 久久久久99精品一区| 日韩欧美视频在线| 7777精品伊人久久久大香线蕉超级流畅| 色综合天天综合网国产成人综合天 | 久久久久99精品国产片| 欧美mv和日韩mv的网站| 日韩一二三区视频| 欧美一区二区三区婷婷月色| 欧美视频精品在线| 欧美在线免费观看视频| 欧美综合在线视频| 在线观看不卡一区| 欧美性大战久久久久久久 | 国产v综合v亚洲欧| 国产一区二区在线免费观看| 久久精品久久综合| 毛片不卡一区二区| 久久99精品久久久久| 蜜桃视频第一区免费观看| 日韩在线播放一区二区| 亚洲国产欧美日韩另类综合| 亚洲国产精品自拍| 亚洲国产精品一区二区久久| 亚洲第一成人在线| 日韩av电影免费观看高清完整版在线观看| 午夜亚洲国产au精品一区二区| 亚洲自拍欧美精品| 亚洲高清不卡在线| 日韩黄色小视频| 美国欧美日韩国产在线播放| 久久se精品一区精品二区| 国产在线视频一区二区三区| 国产一区二区三区电影在线观看| 国产福利一区在线| 91污片在线观看| 91色在线porny| 欧美熟乱第一页| 欧美日韩国产成人在线免费| 日韩免费视频一区| 国产三级三级三级精品8ⅰ区| 国产精品狼人久久影院观看方式| 亚洲激情自拍视频| 日韩成人dvd| 国产精品18久久久久久久久| 97se亚洲国产综合自在线不卡| 91福利在线观看| 日韩天堂在线观看| 日本一区二区高清| 亚洲一区二区视频| 国产一区二区网址| 91麻豆自制传媒国产之光| 欧美美女直播网站| 久久亚洲精品小早川怜子| 一区在线观看免费| 日欧美一区二区| 国产69精品久久久久毛片 | www.在线欧美| 欧美图区在线视频| 国产亚洲精品久| 亚洲综合小说图片| 国产一区二区三区av电影| 色综合久久88色综合天天6| 69堂亚洲精品首页| 国产精品久久久久aaaa| 日日夜夜免费精品视频| 成人性生交大片免费看在线播放| 欧美日韩1区2区| 国产精品嫩草99a| 日韩不卡一区二区| 大胆欧美人体老妇| 69久久夜色精品国产69蝌蚪网| 亚洲国产成人在线| 男人的天堂久久精品| 色综合久久中文字幕综合网| 精品不卡在线视频| 婷婷一区二区三区| 91免费小视频| 久久久噜噜噜久噜久久综合| 亚洲一本大道在线| 99re成人在线| 久久久久久久av麻豆果冻| 亚瑟在线精品视频| 91原创在线视频| 国产日产欧产精品推荐色| 日韩一区精品视频| 欧美一级免费观看| 一区二区三区成人| 成人黄色国产精品网站大全在线免费观看 | 日韩专区一卡二卡| 色88888久久久久久影院野外 | 精品美女一区二区| 亚洲伊人伊色伊影伊综合网| 成人国产精品免费观看动漫| 精品少妇一区二区三区视频免付费| 亚洲综合免费观看高清在线观看 | 7777精品伊人久久久大香线蕉经典版下载 | 中文字幕一区二| 国产大片一区二区| 日韩久久久精品| 亚洲va欧美va人人爽| 色婷婷亚洲综合| 亚洲日本成人在线观看| 成人小视频免费在线观看| 精品国产一区二区三区不卡| 日韩av一区二区在线影视| 欧美日本高清视频在线观看| 亚洲综合精品自拍| 在线看国产日韩| 亚洲精品高清在线| 99在线视频精品| 国产精品不卡在线观看| www.爱久久.com| 亚洲少妇30p| 一本高清dvd不卡在线观看| 日韩理论在线观看| av电影在线不卡| 中文字幕在线不卡一区二区三区 | 欧美性猛交一区二区三区精品 | 亚洲天堂成人在线观看| 久久机这里只有精品| 欧美视频在线一区二区三区 | 日本欧美肥老太交大片| 日韩午夜中文字幕| 久久99久久99| 国产清纯白嫩初高生在线观看91| 国产精选一区二区三区| 久久久国产精品麻豆| 成人三级在线视频| 136国产福利精品导航| 91热门视频在线观看| 亚洲香蕉伊在人在线观| 欧美一级精品大片| 国产一级精品在线| 国产精品久久网站| 91老师国产黑色丝袜在线| 亚洲国产成人va在线观看天堂| 欧美精品日韩一区| 久久不见久久见免费视频7| 久久蜜桃一区二区| 播五月开心婷婷综合| 亚洲国产日韩精品| 欧美v国产在线一区二区三区| 国产精品911| 亚洲午夜在线电影| 欧美mv和日韩mv的网站| 成人动漫视频在线| 亚洲成在线观看| www日韩大片| 色综合久久中文字幕| 毛片基地黄久久久久久天堂| 日本一区二区免费在线观看视频 | 成人av影院在线| 亚洲国产美女搞黄色| 日韩免费高清电影| 成人黄色电影在线| 日韩成人午夜精品| 亚洲成av人影院在线观看网| 91精品国产aⅴ一区二区| 国产精品99久| 亚洲6080在线| 中文字幕欧美激情一区| 欧美日韩视频不卡| 国产成人综合自拍| 亚洲图片欧美视频| 久久男人中文字幕资源站| 在线观看日产精品| 国产乱子伦视频一区二区三区 | 成人av资源网站| 三级影片在线观看欧美日韩一区二区| 久久久久9999亚洲精品| 欧美男同性恋视频网站| 成人国产电影网| 麻豆国产欧美日韩综合精品二区| 亚洲视频每日更新| 久久久久久久久久久久久夜| 欧美自拍偷拍午夜视频| 岛国一区二区在线观看| 久久国产免费看| 午夜伊人狠狠久久|