亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
东方aⅴ免费观看久久av| 欧美日韩久久久久久| 国产精品18久久久久久久久 | 国产福利91精品一区| 久久国产精品99久久人人澡| 奇米色一区二区| 九九久久精品视频| 精品在线观看免费| 国内一区二区视频| 国产91对白在线观看九色| 国产一区二区成人久久免费影院| 国产真实精品久久二三区| 国产一区二区三区四| 成人污污视频在线观看| 成人黄色777网| 97超碰欧美中文字幕| 色999日韩国产欧美一区二区| 91蜜桃免费观看视频| 欧美四级电影网| 日韩欧美亚洲另类制服综合在线| 精品国产乱码久久| 欧美激情在线看| 亚洲日本在线看| 午夜精品久久久久久久99水蜜桃| 日韩av一区二区三区| 久久国产麻豆精品| 成人av网站在线| 欧美三日本三级三级在线播放| 欧美一级片在线| 国产三级精品视频| 一区二区三区四区乱视频| 午夜精品久久一牛影视| 国内精品伊人久久久久影院对白| 成人性视频免费网站| 欧美亚洲国产bt| 欧美岛国在线观看| 18欧美乱大交hd1984| 五月天久久比比资源色| 国精品**一区二区三区在线蜜桃| 成人永久aaa| 欧美福利视频一区| 国产日韩欧美a| 亚洲一区二区三区免费视频| 美女在线一区二区| 99久久99久久久精品齐齐| 欧美日韩一区二区欧美激情| 精品国产区一区| 一区二区三国产精华液| 久久99最新地址| 色欧美片视频在线观看在线视频| 欧美成人三级电影在线| 亚洲三级在线播放| 国产一区二区三区国产| 色哟哟一区二区三区| 日韩免费在线观看| 一区二区三区**美女毛片| 国产乱色国产精品免费视频| 欧美色图12p| 国产精品国产三级国产普通话99 | 日韩 欧美一区二区三区| 成人性生交大片免费| 欧美一区二区三区爱爱| 国产精品久久久久久久久搜平片| 日韩av在线播放中文字幕| 91免费国产视频网站| 精品理论电影在线| 亚洲美腿欧美偷拍| 国产乱妇无码大片在线观看| 欧美性猛片xxxx免费看久爱| 中文字幕国产一区| 久久精品国产第一区二区三区| 91麻豆高清视频| 久久久精品天堂| 婷婷成人激情在线网| 9i在线看片成人免费| 精品成人在线观看| 香港成人在线视频| av电影在线不卡| 2021久久国产精品不只是精品| 亚洲综合久久av| youjizz国产精品| www精品美女久久久tv| 偷偷要91色婷婷| 欧美自拍偷拍一区| 18欧美乱大交hd1984| 国产不卡在线一区| 久久久久久免费| 精品亚洲porn| 日韩精品中文字幕一区二区三区 | 久久久久久久久99精品| 日韩精品乱码av一区二区| 精品视频一区三区九区| 一区二区三区免费网站| 99视频一区二区| 国产精品污污网站在线观看| 国产在线视频精品一区| 欧美一区二区免费| 日本特黄久久久高潮| 91精品在线免费| 日本中文字幕不卡| 欧美精品第1页| 亚洲成人资源在线| 91超碰这里只有精品国产| 午夜电影一区二区| 欧美精品在线一区二区| 天堂va蜜桃一区二区三区漫画版| 欧美日韩激情一区二区| 午夜精品久久久久久久99樱桃| 欧美日韩国产精品自在自线| 亚洲国产中文字幕在线视频综合 | 中文字幕日韩欧美一区二区三区| 岛国一区二区三区| 国产精品乱码妇女bbbb| 成人一区二区在线观看| 中文字幕亚洲精品在线观看| 91麻豆国产福利在线观看| 一区二区三区免费| 欧美精品1区2区3区| 麻豆成人在线观看| 久久久综合网站| 99精品久久久久久| 亚洲国产成人av好男人在线观看| 欧美精三区欧美精三区| 韩国毛片一区二区三区| 中文子幕无线码一区tr| 一本到不卡精品视频在线观看 | av中文一区二区三区| 亚洲另类中文字| 欧美人动与zoxxxx乱| 美腿丝袜亚洲综合| 国产精品美女www爽爽爽| 色噜噜狠狠成人中文综合| 石原莉奈一区二区三区在线观看| 欧美精品自拍偷拍| 国产成人一区在线| 亚洲日本va在线观看| 欧美日韩国产大片| 精品一区二区三区不卡 | 免费一级欧美片在线观看| 国产欧美精品一区二区三区四区| 成人sese在线| 图片区小说区区亚洲影院| 国产亚洲一区字幕| 欧美色图激情小说| 国产风韵犹存在线视精品| 亚洲精品一二三区| 欧美不卡激情三级在线观看| 成人免费观看av| 午夜精品免费在线观看| 国产精品素人视频| 欧美日本在线视频| 成人免费黄色在线| 婷婷丁香激情综合| 自拍偷拍亚洲欧美日韩| 日韩一区二区视频| av不卡一区二区三区| 日本网站在线观看一区二区三区| 国产精品乱码妇女bbbb| 欧美一区二区三区在线观看 | 国产亚洲福利社区一区| 欧美在线免费视屏| 国产91富婆露脸刺激对白| 视频一区欧美精品| 亚洲欧美日韩在线不卡| 老色鬼精品视频在线观看播放| 久久91精品久久久久久秒播| 久久久国际精品| 国产成人h网站| 日韩黄色免费网站| 中文字幕在线观看一区二区| 日韩欧美在线123| 在线观看www91| 成+人+亚洲+综合天堂| 精品一区二区三区不卡 | 99久久99久久精品国产片果冻| 日韩精品一二三四| 尤物视频一区二区| 欧美精彩视频一区二区三区| 日韩视频国产视频| 欧洲亚洲国产日韩| a亚洲天堂av| 国产91丝袜在线播放| 人妖欧美一区二区| 五月婷婷色综合| 亚洲自拍另类综合| 成人欧美一区二区三区1314| 26uuu亚洲综合色欧美| 日韩一本二本av| 欧美日韩第一区日日骚| 色婷婷精品大在线视频| 91在线你懂得| 成人av手机在线观看| 国产成人av福利| 国产在线麻豆精品观看| 久久er99精品| 精品一区二区三区的国产在线播放| 日韩专区欧美专区| 日韩高清在线电影| 五月激情六月综合| 日韩视频在线你懂得|