亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
麻豆国产精品777777在线| 欧美剧情电影在线观看完整版免费励志电影 | 欧美日本国产视频| 国精产品一区一区三区mba视频| 久久蜜桃一区二区| 一区二区免费在线播放| 欧美三级韩国三级日本三斤| 国内外成人在线| 中文字幕一区三区| 欧美日韩一级片在线观看| 国产一区中文字幕| 一区二区在线观看av| 欧美人妖巨大在线| 成人美女视频在线看| 亚洲裸体xxx| 欧美精品免费视频| 激情综合网av| 午夜私人影院久久久久| 中文字幕国产一区二区| 欧美一区二区视频在线观看2020 | 亚洲第四色夜色| 久久久久国产精品人| 欧美中文字幕久久| 国产精品一区二区久久不卡| 欧美高清视频www夜色资源网| 精品在线播放午夜| 午夜精品在线视频一区| 亚洲国产精品精华液网站| 国产精品毛片久久久久久久| 国产成人免费视频网站| 日韩视频一区在线观看| 91久久精品国产91性色tv| 成人精品视频一区二区三区 | 精品一区二区三区久久| 亚洲美女视频在线| 成人免费在线播放视频| 国产三级精品视频| 欧美日韩日日骚| 99re6这里只有精品视频在线观看| 激情综合网激情| 免费人成网站在线观看欧美高清| 中文字幕亚洲综合久久菠萝蜜| 在线免费观看一区| 成人黄色电影在线| 国产一区视频导航| 国产精品综合av一区二区国产馆| 本田岬高潮一区二区三区| 欧美高清在线一区二区| 久久久影院官网| 国产日韩av一区二区| 国产亚洲欧洲997久久综合| 欧美日韩一本到| 欧美午夜不卡视频| 亚洲一区精品在线| 国产高清在线精品| 蜜臀精品久久久久久蜜臀 | 欧美sm极限捆绑bd| 2020日本不卡一区二区视频| 国产精品免费丝袜| 国产精品久久久久久久第一福利| 中文字幕在线不卡| 日韩一区二区三区四区五区六区 | 午夜精品国产更新| 国产福利一区在线| 欧美午夜电影一区| 国产欧美日韩在线观看| 亚洲欧美偷拍三级| 国产福利一区二区三区在线视频| 国产精品久久久久久久久动漫 | 成人免费在线观看入口| 国产精品色眯眯| 日韩高清不卡一区二区| 久久超级碰视频| 97久久久精品综合88久久| 欧美精品三级在线观看| 国产精品白丝jk黑袜喷水| 在线视频中文字幕一区二区| 欧美二区在线观看| 欧美伊人久久久久久久久影院| 欧美一二区视频| 国产精品久久久久天堂| 有码一区二区三区| 国产一区二区在线视频| 成人avav在线| 久久99最新地址| 91福利精品视频| 国产欧美一区二区三区沐欲| 欧美日韩aaaaa| 色国产精品一区在线观看| 欧美变态口味重另类| 国产精品久久久久桃色tv| 成人在线视频首页| 欧美四级电影在线观看| 亚洲视频精选在线| 国产91丝袜在线18| 精品国产网站在线观看| 成人免费在线播放视频| 亚洲成人午夜影院| 成人黄色网址在线观看| 欧美精品18+| 成人免费在线观看入口| 粉嫩蜜臀av国产精品网站| k8久久久一区二区三区| 国产精品日韩精品欧美在线| 九九视频精品免费| 色综合久久综合网欧美综合网| 中文字幕av一区 二区| 国产福利91精品一区| 日韩精品一区二区三区蜜臀| 精品一区二区免费看| 91精品国产手机| 青青国产91久久久久久| 4438x成人网最大色成网站| 亚洲一区二区成人在线观看| 久久久久国产精品麻豆ai换脸 | 久久日一线二线三线suv| 久久99精品久久久| 中文字幕中文字幕在线一区 | 91精品一区二区三区在线观看| 亚洲gay无套男同| 日韩美女视频在线| 日韩高清在线一区| 精品亚洲国产成人av制服丝袜| 欧美色综合久久| 久久草av在线| 欧美亚洲禁片免费| 日本网站在线观看一区二区三区| 国产性天天综合网| 豆国产96在线|亚洲| 亚洲午夜av在线| 国产日韩在线不卡| 91麻豆国产香蕉久久精品| 亚洲综合免费观看高清完整版 | 亚洲免费观看视频| 91精品啪在线观看国产60岁| 激情图区综合网| 亚洲精选在线视频| 久久精品男人的天堂| 欧美性色综合网| 久久狠狠亚洲综合| 亚洲图片自拍偷拍| 久久综合狠狠综合久久激情| 欧美性做爰猛烈叫床潮| 国产凹凸在线观看一区二区| 日日摸夜夜添夜夜添亚洲女人| 日本一区二区三区免费乱视频| 亚洲综合视频网| 国产精品视频一区二区三区不卡| 欧美mv和日韩mv的网站| 7777精品伊人久久久大香线蕉经典版下载 | 久久精品99久久久| 国产精品久久久久7777按摩| www国产成人免费观看视频 深夜成人网 | 国产精品99久久久| 石原莉奈在线亚洲二区| 韩国午夜理伦三级不卡影院| 国产精品久久久久久久岛一牛影视| 欧美日韩国产综合草草| 国产精品99久久久久久久vr| 亚洲一区二区中文在线| 国产精品理伦片| 2021国产精品久久精品| 色屁屁一区二区| 91麻豆精东视频| 欧美亚洲尤物久久| 成人一区二区三区在线观看| 激情综合亚洲精品| 国产精品69毛片高清亚洲| 麻豆精品一二三| 亚洲亚洲人成综合网络| 5858s免费视频成人| 欧美一区二视频| 亚洲女与黑人做爰| 91麻豆精品国产91久久久久| 日韩一区二区免费在线观看| 91在线porny国产在线看| 96av麻豆蜜桃一区二区| voyeur盗摄精品| 色偷偷久久人人79超碰人人澡| 91视频你懂的| 在线免费观看视频一区| 在线观看视频91| 日韩欧美电影一区| 欧美国产1区2区| 亚洲一区二区三区视频在线播放| 午夜电影一区二区三区| 国产精品一区二区三区乱码| 国产成人综合自拍| 91丨porny丨户外露出| 亚洲综合成人在线视频| 奇米精品一区二区三区在线观看 | 一本色道**综合亚洲精品蜜桃冫| 日本道在线观看一区二区| 在线综合视频播放| 国产精品福利在线播放| 亚洲女与黑人做爰| www激情久久| 午夜精品久久久久久久99水蜜桃 | 狠狠色2019综合网| 国产一区二区三区综合|