亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
一本久道久久综合中文字幕| 久久久久久一二三区| 一本色道亚洲精品aⅴ| 成人福利视频在线| aa级大片欧美| 在线观看国产91| 欧美日韩一卡二卡| 7799精品视频| 精品剧情在线观看| www一区二区| 国产欧美日韩综合| 国产精品成人一区二区艾草| 亚洲女子a中天字幕| 亚洲午夜久久久久久久久久久| 午夜精品久久久久影视| 日本网站在线观看一区二区三区| 日本一道高清亚洲日美韩| 久久国产精品99久久人人澡| 日韩视频免费直播| 久久久久久影视| 国产精品久久久久久久久免费樱桃 | 亚洲精品一区二区三区蜜桃下载| 精品久久久久av影院| 国产亚洲一区字幕| 日韩理论片一区二区| 亚洲综合在线第一页| 日韩不卡一二三区| 国产高清不卡一区二区| 91丨九色丨黑人外教| 欧美日韩1234| 国产日韩一级二级三级| 亚洲激情自拍视频| 美女免费视频一区| eeuss鲁片一区二区三区在线观看| 在线欧美小视频| 精品国产免费一区二区三区四区| 欧美激情一区二区三区全黄| 亚洲午夜在线视频| 国产一区二区三区观看| 日本久久电影网| 精品国产乱码久久久久久闺蜜| 国产精品久久久久天堂| 三级在线观看一区二区| 国产69精品久久777的优势| 91久久线看在观草草青青| 日韩精品中文字幕在线一区| 亚洲欧美日韩在线不卡| 久久精品国产澳门| 91久久香蕉国产日韩欧美9色| 精品国产一区二区在线观看| 亚洲精品久久7777| 国产精品99久久久| 欧美日韩一区二区三区高清| 国产午夜亚洲精品理论片色戒| 亚洲一卡二卡三卡四卡五卡| 国产精品系列在线播放| 91精品国产麻豆国产自产在线 | 亚洲福利一二三区| 国产精品69久久久久水密桃| 欧美日韩一区在线| 国产精品久久久久婷婷| 极品少妇xxxx偷拍精品少妇| 欧美在线免费观看视频| 国产精品国产自产拍在线| 免费成人av在线| 精品婷婷伊人一区三区三| 国产精品三级电影| 韩国精品久久久| 91精品国产色综合久久久蜜香臀| 亚洲免费伊人电影| 国产91精品露脸国语对白| 欧美videossexotv100| 色婷婷激情综合| 欧美国产成人精品| 精品午夜久久福利影院| 51精品国自产在线| 亚洲一区二区三区视频在线播放 | 精品三级av在线| 亚洲一二三级电影| 色婷婷久久综合| 亚洲色图都市小说| 99精品欧美一区| 欧美国产一区在线| 国产乱码一区二区三区| 日韩欧美国产系列| 美日韩一区二区三区| 91精品在线免费| 日韩二区在线观看| 欧美麻豆精品久久久久久| 亚洲欧美aⅴ...| 色狠狠色噜噜噜综合网| 亚洲四区在线观看| 91首页免费视频| 亚洲精品国产精华液| 99re这里只有精品6| 国产精品久久久久久久久久免费看 | 日本在线不卡视频| 在线不卡中文字幕播放| 亚洲高清免费一级二级三级| 欧美色图12p| 亚洲成人av一区二区三区| 欧美日韩中文字幕一区| 日韩综合小视频| 欧美一区二区在线免费观看| 日本不卡一二三区黄网| 日韩欧美高清一区| 国产一区二区在线电影| 久久久高清一区二区三区| 国产 欧美在线| 中文字幕日韩欧美一区二区三区| 91丝袜美女网| 亚洲成人资源在线| 欧美一区二区三级| 国产一区二区三区在线观看免费| www亚洲一区| 成人av高清在线| 亚洲乱码中文字幕| 欧美日韩极品在线观看一区| 青青草精品视频| 久久精品夜夜夜夜久久| eeuss鲁片一区二区三区在线观看| 亚洲免费在线视频| 制服丝袜亚洲色图| 激情五月播播久久久精品| 国产三级三级三级精品8ⅰ区| 不卡的电影网站| 亚洲电影视频在线| 日韩女同互慰一区二区| 成人听书哪个软件好| 亚洲综合在线免费观看| 91精品蜜臀在线一区尤物| 国产精品自拍一区| 一区二区三区在线视频播放| 5月丁香婷婷综合| 高清久久久久久| 亚洲一区二区视频| 欧美精品一区二区三区一线天视频 | 欧美日韩精品三区| 国产一区二区三区在线观看免费视频 | 国产mv日韩mv欧美| 亚洲精品日日夜夜| 日韩精品一区二区三区蜜臀| 成人avav在线| 肉丝袜脚交视频一区二区| 国产欧美一区二区精品仙草咪| 色一区在线观看| 久久99精品久久久久久国产越南 | 综合婷婷亚洲小说| 欧美一区二区三区成人| 成人免费观看av| 日韩电影一区二区三区四区| 国产色一区二区| 8x8x8国产精品| caoporen国产精品视频| 免费在线观看视频一区| 亚洲婷婷综合色高清在线| 91精品国产免费| 色激情天天射综合网| 激情五月播播久久久精品| 一区二区三区成人| 久久久久久一二三区| 欧美日韩视频不卡| 成人精品亚洲人成在线| 乱一区二区av| 一区二区三区精品在线| 久久久久国产精品麻豆ai换脸 | 777午夜精品视频在线播放| 成人黄页在线观看| 久久精品国内一区二区三区| 成人动漫在线一区| 日韩福利电影在线| 玉米视频成人免费看| 久久久高清一区二区三区| 91麻豆精品91久久久久久清纯| 99麻豆久久久国产精品免费 | 91在线无精精品入口| 麻豆国产精品一区二区三区| 一区二区三区四区国产精品| 国产欧美一区视频| 日韩美女主播在线视频一区二区三区| 91成人在线观看喷潮| 成人亚洲一区二区一| 国产精一区二区三区| 免费成人你懂的| 日韩精品一级中文字幕精品视频免费观看| 亚洲欧美激情插| 国产精品白丝在线| 亚洲国产成人自拍| 国产欧美一区二区精品婷婷 | 蜜桃精品视频在线观看| 亚洲午夜激情av| 亚洲自拍偷拍av| 一区二区三区蜜桃网| 综合久久一区二区三区| 国产精品美女久久久久久久久 | 亚洲欧美国产毛片在线| |精品福利一区二区三区| 中文av一区二区| 国产精品私人影院| 国产三级三级三级精品8ⅰ区|