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

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

?? actor.java

?? 大量j2me源代碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/**
 * 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
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久一区二区三区| 麻豆精品一区二区综合av| 国产在线精品免费av| 久久亚洲一区二区三区明星换脸 | 日韩精品一区二区三区视频| 另类的小说在线视频另类成人小视频在线 | 亚洲柠檬福利资源导航| 欧美亚州韩日在线看免费版国语版| 一区二区三区精品视频在线| 欧美精品第1页| 国产精品77777| 亚洲一区二区三区美女| 26uuu精品一区二区在线观看| 91蜜桃视频在线| 久久国产成人午夜av影院| 国产精品美女久久久久av爽李琼| 欧美日韩精品欧美日韩精品一| 久久99国产精品久久| 亚洲一区中文在线| 日本一区二区动态图| 日韩一区二区中文字幕| 色系网站成人免费| 国产一区二区三区久久悠悠色av | av电影在线不卡| 久久福利资源站| 午夜欧美电影在线观看| 日韩一区二区在线观看视频播放| av成人免费在线观看| 国产原创一区二区| 青娱乐精品视频| 日韩国产欧美在线观看| 亚洲综合另类小说| 亚洲日本一区二区三区| 国产精品伦一区二区三级视频| 26uuu亚洲综合色欧美| 91精品国产综合久久国产大片| 欧美主播一区二区三区美女| 91网站在线观看视频| 成人高清视频在线| 不卡一卡二卡三乱码免费网站| 国产成人福利片| 国产91在线看| 91视频在线看| 欧美日韩激情一区二区三区| 欧美久久免费观看| 日韩欧美国产三级| 久久久美女毛片| 久久久99免费| 亚洲伦理在线精品| 亚洲成av人综合在线观看| eeuss国产一区二区三区| 欧美在线小视频| 26uuu亚洲综合色| 日韩码欧中文字| 亚洲第一二三四区| 风间由美一区二区av101 | 国产精品综合在线视频| av一区二区三区黑人| 欧美一区二区视频在线观看2022| 久久精品亚洲精品国产欧美| 亚洲色图制服诱惑| 男人操女人的视频在线观看欧美| 国产成人在线看| 欧美人狂配大交3d怪物一区| 久久精品免视看| 午夜精品久久久久久久久久久| 国产成人免费视频精品含羞草妖精| 在线中文字幕一区| 久久久久99精品国产片| 五月天久久比比资源色| 成人免费va视频| 欧美一级免费观看| 一区二区在线看| 91亚洲精华国产精华精华液| 久久免费看少妇高潮| 日本欧美加勒比视频| 欧美综合亚洲图片综合区| 久久久久久久久久看片| 日本三级韩国三级欧美三级| 欧美精品一卡二卡| 亚洲香肠在线观看| 波多野结衣欧美| 国产三级精品三级| 国产精品99久久久久久久vr | 精品久久久久久久久久久久久久久久久 | 91污在线观看| 依依成人精品视频| 色婷婷久久久久swag精品| 一区二区三区中文在线| 欧美日韩午夜在线| 日韩电影在线观看网站| 欧美一区二区私人影院日本| 蜜臀av性久久久久蜜臀aⅴ四虎| 日韩一区二区在线看| 精品无人区卡一卡二卡三乱码免费卡| 日韩精品一区二| 国产91精品精华液一区二区三区| 国产午夜精品久久| 色综合欧美在线| 日本欧美在线看| 久久久91精品国产一区二区精品 | 99re在线视频这里只有精品| 一区二区三区在线影院| 欧美电影一区二区三区| 国产综合久久久久影院| 中文字幕一区不卡| 欧美一区二区视频观看视频| 成人少妇影院yyyy| 亚洲国产成人91porn| 久久久久9999亚洲精品| 欧美丝袜自拍制服另类| 一本久久a久久免费精品不卡| 一区二区三区小说| 久久婷婷综合激情| 欧美日韩精品电影| 97se亚洲国产综合在线| 九色综合国产一区二区三区| 一区二区三区欧美在线观看| 精品剧情v国产在线观看在线| 色婷婷av一区二区三区大白胸| 国产一区二区三区在线观看免费视频| 亚洲一二三四区不卡| 国产亚洲短视频| 亚洲精品一区二区三区影院| 欧美一区二区在线不卡| 99久久综合狠狠综合久久| 粉嫩久久99精品久久久久久夜| 免费成人你懂的| 青青草91视频| 激情综合色综合久久综合| 日本欧美加勒比视频| 麻豆91在线播放免费| 蜜乳av一区二区| 美女网站色91| 美女精品自拍一二三四| 免费成人在线网站| 日韩av中文字幕一区二区 | 中文字幕精品在线不卡| 国产视频在线观看一区二区三区| 精品区一区二区| 亚洲午夜羞羞片| 五月开心婷婷久久| 美女尤物国产一区| 国产揄拍国内精品对白| 国产乱码字幕精品高清av | 欧美日韩高清一区二区| 欧美一区二区在线视频| 2024国产精品| 亚洲日本va午夜在线影院| 亚洲影院久久精品| 五月天欧美精品| 国产成人综合亚洲91猫咪| jlzzjlzz亚洲日本少妇| 在线一区二区三区| 欧美成人精品二区三区99精品| 精品国产不卡一区二区三区| 亚洲欧美在线视频观看| 亚洲综合精品久久| 国产一区二区三区在线观看免费视频| 不卡的av电影在线观看| 中文字幕av一区二区三区免费看 | 亚洲国产乱码最新视频| 国产精品一二三在| 欧美精品日韩精品| 亚洲欧洲av色图| 久久99精品久久久久久动态图 | 久久99精品一区二区三区| 99久久婷婷国产综合精品| 日韩视频123| 亚洲国产成人va在线观看天堂| 成人精品鲁一区一区二区| 在线91免费看| 亚洲国产cao| 在线观看国产日韩| 亚洲一区二区三区在线| caoporen国产精品视频| 久久夜色精品国产欧美乱极品| 日韩精品乱码免费| 欧美三区在线视频| 久久国产欧美日韩精品| 欧美日韩一区二区三区四区五区| 亚洲另类春色校园小说| 色婷婷综合五月| 亚洲精品v日韩精品| 欧美系列在线观看| 亚洲一区二区美女| 欧美日韩国产首页| 香蕉加勒比综合久久| 欧美一区在线视频| 国产一区二区三区免费| 久久亚洲春色中文字幕久久久| 国产成人免费9x9x人网站视频| 亚洲色大成网站www久久九九| 欧美日韩中文精品| 免费成人av资源网| 亚洲国产精品ⅴa在线观看| 欧洲一区二区三区在线| 日日夜夜精品视频天天综合网| 精品国产一区二区精华| 91亚洲精品久久久蜜桃|