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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? 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()
   {

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人av影院| 久久色在线观看| 欧美色成人综合| 在线免费一区三区| 日本高清不卡在线观看| 91老师片黄在线观看| 91小视频免费观看| 日本韩国欧美三级| av一区二区三区| 色国产精品一区在线观看| 在线精品视频一区二区| 在线观看一区不卡| 6080国产精品一区二区| 日韩免费视频一区| 久久午夜羞羞影院免费观看| 国产欧美一区二区精品婷婷| 亚洲欧美影音先锋| 亚洲国产中文字幕| 麻豆成人av在线| 国产黄色精品视频| 一本大道久久a久久综合| 欧美自拍偷拍一区| 欧美一区三区二区| 久久久久国产精品麻豆ai换脸| 国产精品人成在线观看免费| 亚洲精选视频免费看| 婷婷亚洲久悠悠色悠在线播放| 捆绑调教美女网站视频一区| 国产成人在线观看| 在线影院国内精品| 日韩一级完整毛片| 国产精品美女久久久久aⅴ| 一区二区三区在线免费观看| 蜜臀av在线播放一区二区三区 | 日本高清成人免费播放| 91精品免费观看| 久久久久国产精品厨房| 亚洲乱码日产精品bd| 日本伊人色综合网| 国产suv精品一区二区三区| 在线观看视频91| 欧美精品一区二区三区很污很色的| 一区二区三区电影在线播| 青青草91视频| 92精品国产成人观看免费| 3d成人h动漫网站入口| 国产偷国产偷亚洲高清人白洁| 亚洲三级在线免费观看| 天天色天天操综合| 成人性生交大片| 欧美人牲a欧美精品| 欧美激情艳妇裸体舞| 日韩中文字幕亚洲一区二区va在线 | 中文字幕不卡一区| 日本午夜一本久久久综合| www..com久久爱| 欧美一级欧美三级在线观看| 国产精品国模大尺度视频| 另类小说色综合网站| 91在线精品秘密一区二区| 日韩欧美不卡在线观看视频| 亚洲精品日日夜夜| 国产精品一区不卡| 欧美一区二区三区四区视频| 亚洲日本中文字幕区| 国产一区二区电影| 3d动漫精品啪啪一区二区竹菊| 亚洲人精品午夜| 国产成人日日夜夜| 制服丝袜亚洲色图| 一区二区三区日韩| 国产盗摄一区二区三区| 日韩免费成人网| 日本中文字幕一区| 欧美性猛交xxxxxx富婆| 国产精品免费观看视频| 国产福利精品导航| 日韩欧美在线观看一区二区三区| 悠悠色在线精品| 成人激情小说网站| 久久久久久久久97黄色工厂| 青青草国产精品亚洲专区无| 欧美视频在线一区二区三区| 自拍av一区二区三区| 成人sese在线| 国产欧美一区二区三区鸳鸯浴| 久久99久久精品欧美| 91精品婷婷国产综合久久 | 99re6这里只有精品视频在线观看| 精品国产乱码久久久久久免费| 日韩激情视频在线观看| 欧美精品亚洲一区二区在线播放| 夜夜嗨av一区二区三区四季av| 91视频com| 亚洲欧美日韩国产成人精品影院| av在线不卡网| 亚洲视频在线观看三级| 不卡在线观看av| 椎名由奈av一区二区三区| 成人av在线一区二区三区| 国产精品美女久久久久av爽李琼| 成人午夜看片网址| 国产精品二三区| 91视频xxxx| 亚洲一级二级在线| 国产欧美一区二区精品仙草咪| 国产揄拍国内精品对白| 国产性色一区二区| 成人午夜激情视频| 亚洲手机成人高清视频| 欧美在线播放高清精品| 五月天亚洲精品| 日韩久久免费av| 国产一区二区三区不卡在线观看 | 亚洲一区二区三区在线| 欧美精品高清视频| 免费观看在线综合| 欧美精品一区二区久久婷婷| 国产成人免费视频网站高清观看视频| 久久精品夜夜夜夜久久| 99这里只有久久精品视频| 亚洲私人黄色宅男| 欧美精品粉嫩高潮一区二区| 精品无人码麻豆乱码1区2区 | 亚洲图片一区二区| 欧美精品一级二级三级| 精品一区二区三区免费播放 | 成人av片在线观看| 亚洲在线视频免费观看| 欧美精品在线一区二区三区| 蜜桃一区二区三区在线观看| 国产欧美精品日韩区二区麻豆天美| 91亚洲永久精品| 日韩精品一二三| 国产农村妇女毛片精品久久麻豆 | 欧美精三区欧美精三区| 国产一区二三区好的| 国产精品乱码久久久久久| 欧美性videosxxxxx| 裸体在线国模精品偷拍| 亚洲欧美一区二区视频| 日韩一卡二卡三卡四卡| 福利一区二区在线| 亚洲成人免费av| 久久综合九色综合97_久久久 | 国产精品久久毛片| 欧美日韩国产高清一区二区| 国产精品一区二区在线看| 亚洲自拍偷拍欧美| 久久久久久**毛片大全| 精品视频一区三区九区| 国产精品资源在线| 亚洲电影一区二区三区| 国产亚洲美州欧州综合国| 欧美日韩另类国产亚洲欧美一级| 国产麻豆成人传媒免费观看| 亚洲成人av中文| 国产精品欧美久久久久无广告 | 日韩久久精品一区| 色综合久久天天| 国产一区二区不卡在线| 亚洲国产精品精华液网站| 久久久久久久综合狠狠综合| 精品视频123区在线观看| 处破女av一区二区| 麻豆精品视频在线观看免费| 夜夜嗨av一区二区三区四季av | 国产永久精品大片wwwapp| 亚洲五码中文字幕| 国产精品久久久久9999吃药| 精品久久久久久亚洲综合网| 欧美日韩国产美| 91在线视频播放| 国产精品18久久久久久vr| 日韩国产精品久久| 一区二区三区美女视频| 国产精品美女久久久久aⅴ| 久久一二三国产| 欧美va亚洲va| 欧美精品亚洲二区| 欧美日韩一二三区| 91免费观看视频在线| 高清久久久久久| 国产在线观看一区二区| 男人的j进女人的j一区| 亚洲aaa精品| 亚洲va欧美va人人爽午夜| 亚洲视频在线观看三级| 国产精品激情偷乱一区二区∴| 国产日本欧洲亚洲| 久久亚洲精品国产精品紫薇| 91精品国产免费| 欧美日韩国产123区| 欧美视频一区二区| 欧美午夜精品一区二区三区| 欧美专区在线观看一区| 91久久精品国产91性色tv| 91色婷婷久久久久合中文| eeuss影院一区二区三区| gogo大胆日本视频一区|