亚洲欧美第一页_禁久久精品乱码_粉嫩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ⅴ成人精品无吗| 麻豆91精品91久久久的内涵| www..com久久爱| 日韩欧美一级特黄在线播放| 亚洲欧美区自拍先锋| 精彩视频一区二区| 欧美福利视频导航| 亚洲视频一区二区免费在线观看| 久久精品国产亚洲一区二区三区| 色先锋aa成人| 国产精品免费免费| 国产91精品露脸国语对白| 91精品国产综合久久精品性色| 中文字幕日韩一区| 国产成人在线观看免费网站| 91精品在线一区二区| 亚洲午夜电影网| 91丨九色丨尤物| 中国av一区二区三区| 国产一区二区三区电影在线观看| 91精品国产一区二区| 亚洲五月六月丁香激情| 91精品1区2区| 一区二区在线看| 色综合色狠狠天天综合色| 亚洲欧洲另类国产综合| 国产精品亚洲视频| 2021中文字幕一区亚洲| 国内精品视频666| 精品伦理精品一区| 久草这里只有精品视频| 久久中文字幕电影| 国产剧情av麻豆香蕉精品| 日韩欧美精品三级| 老司机午夜精品99久久| 精品国产伦一区二区三区免费| 日本欧美一区二区在线观看| 日韩视频国产视频| 极品少妇一区二区三区精品视频| 欧美精品一区二区三区久久久| 精品在线你懂的| 久久影院视频免费| 成人小视频在线| 亚洲欧洲制服丝袜| 日韩三级精品电影久久久| 久久精品久久99精品久久| 日韩色视频在线观看| 国产女人aaa级久久久级| 国产不卡视频一区| 国产精品久久久久国产精品日日| 97超碰欧美中文字幕| 一区二区三区精品在线观看| 欧美日韩精品久久久| 蜜臀精品一区二区三区在线观看| 欧美电影免费观看高清完整版在线| 国产伦精品一区二区三区免费迷| 国产欧美日韩不卡| 91国偷自产一区二区三区成为亚洲经典| 一区二区激情视频| 亚洲欧美一区二区三区国产精品 | 美女视频黄免费的久久| 精品国产伦一区二区三区免费 | 国产欧美日韩在线观看| 北条麻妃一区二区三区| 一片黄亚洲嫩模| 日韩欧美国产三级电影视频| 国产成人精品影视| 亚洲bt欧美bt精品| 久久综合九色综合97_久久久| 99久久婷婷国产| 美国十次综合导航| 亚洲丝袜自拍清纯另类| 日韩女优毛片在线| 91福利国产精品| 国产中文一区二区三区| 亚洲成人中文在线| 亚洲国产经典视频| 欧美一级搡bbbb搡bbbb| 波多野结衣在线aⅴ中文字幕不卡| 亚洲国产综合在线| 中文字幕第一页久久| 在线91免费看| 色一情一乱一乱一91av| 国产黄色成人av| 日韩综合一区二区| 亚洲精选视频在线| 国产欧美日韩麻豆91| 日韩精品中文字幕在线一区| 91美女视频网站| 国产成a人无v码亚洲福利| 蜜桃一区二区三区在线观看| 亚洲精品欧美激情| 国产精品福利av| 久久久精品蜜桃| 日韩欧美中文字幕公布| 精品婷婷伊人一区三区三| 99国产精品久久久久| 国产精品一卡二卡| 紧缚捆绑精品一区二区| 日韩精品欧美精品| 亚洲成人自拍偷拍| 亚洲mv在线观看| 亚洲一级在线观看| 一区二区三区中文字幕精品精品 | 成人av电影在线观看| 美女一区二区视频| 蜜乳av一区二区三区| 日本aⅴ亚洲精品中文乱码| 亚洲一二三区视频在线观看| 亚洲色图一区二区| 亚洲激情第一区| 亚洲女爱视频在线| 亚洲色图19p| 久久国产精品99精品国产| 亚洲不卡一区二区三区| 亚洲高清免费视频| 琪琪久久久久日韩精品| 日韩av不卡一区二区| 日本亚洲免费观看| 狠狠色丁香婷婷综合久久片| 久久99国内精品| 国产美女av一区二区三区| 国产美女主播视频一区| 成人三级在线视频| 99精品国产91久久久久久| 91影视在线播放| 欧美在线free| 在线不卡中文字幕| 欧美精品一区二区在线播放 | 精品一区二区在线免费观看| 狠狠v欧美v日韩v亚洲ⅴ| 国产精品99久久久久久久女警 | 欧美精品自拍偷拍动漫精品| 欧美日韩一区二区在线视频| 欧美一区二区啪啪| 久久久久久电影| 亚洲女人****多毛耸耸8| 性做久久久久久久久| 免费看欧美女人艹b| 国产一区二区三区香蕉 | 欧美美女bb生活片| 精品国产99国产精品| 中文字幕第一区二区| 一区二区三区在线免费播放| 日韩电影在线免费观看| 国产成人福利片| 欧美在线短视频| 久久蜜桃一区二区| 亚洲女性喷水在线观看一区| 三级久久三级久久| 成人网在线播放| 欧美另类变人与禽xxxxx| 国产欧美综合在线| 亚洲成人自拍一区| 丁香亚洲综合激情啪啪综合| 欧美体内she精视频| 久久久国产综合精品女国产盗摄| 亚洲男人天堂一区| 久久成人av少妇免费| 日本乱人伦一区| 国产女主播一区| 日本视频一区二区| 91亚洲精品乱码久久久久久蜜桃| 91精品国产综合久久国产大片| 中文一区一区三区高中清不卡| 亚洲一区在线视频| 成人中文字幕在线| 精品免费日韩av| 亚洲国产va精品久久久不卡综合| 东方欧美亚洲色图在线| 日韩欧美在线综合网| 亚洲一区二区三区精品在线| 丁香五精品蜜臀久久久久99网站| 欧美猛男超大videosgay| ㊣最新国产の精品bt伙计久久| 免费成人在线影院| 欧美伦理电影网| 亚洲精品日韩综合观看成人91| 国产成人亚洲综合色影视| 欧美一区二区三区在线看| 亚洲国产成人91porn| 91在线高清观看| 国产精品国产三级国产普通话蜜臀| 美国精品在线观看| 欧美日韩国产一二三| 亚洲欧美欧美一区二区三区| 成人国产精品免费观看视频| 精品国产免费一区二区三区四区| 日产欧产美韩系列久久99| 欧洲一区在线电影| 一区二区三区欧美激情| 色女孩综合影院| 玉米视频成人免费看| 色94色欧美sute亚洲线路二| 亚洲欧美另类综合偷拍| av资源网一区| 伊人色综合久久天天人手人婷| 日本道精品一区二区三区 |