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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? actor.java

?? 大量j2me源代碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
import net.jscience.math.kvm.MathFP;
import javax.microedition.lcdui.*;

/**
 * An abstract base class for higher level Actors. This class handles basic
 * position as well as maintaining a link to the GameScreen. A class extending
 * this needs to implement the render, getHeight and getWidth methods as well
 * as optionally overriding other methods like cycle to implement custom logic.
 * This version now maintains a reference to the World in which it belongs.
 * @author Martin J. Wells.
 */
abstract public class Actor
{
   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);

   private World world;                // the world this actor is within.
   private int xFP, yFP;               // current position (as a MathFP)
   private int lastXFP, lastYFP;       // last position (used by cycle code)
   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 int spinFP;                 // current spin rate (can be negative)
   private int maxSpinRate;           	// maximum spin rate (in degrees per
                                       // second)
   private int xVelFP, yVelFP;         // current velocity
   private int xAccFP, yAccFP;        	// current acceleration
   private int maxVelFP;
   private int thrustFP;
   private int bounceVelFP;              // The amount of bounce when we hit
                                       // something.

   private boolean autoSpinning;			// we set a flag to avoid over calling
                                       // setSpin()
   private int targetAngle;

   private long fluff = 0;

   /**
    * Constructs an Actor at position x, y facing direction d and setting
    * a maximum velocity and starting thrust. (Note the maxVelFPArg and
    * thrustFPArg both must be MathFP values.) 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 worldArg The world this actor belongs in.
    * @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 speedFPArg The starting velocity.
    * @param bounceVelFPArg The level of bounce when colliding with something.
    * @param maxSpinRateArg The maximum turn rate in degrees per second.
    */
   public Actor(World worldArg, int startX, int startY, int startDirection,
                int alignedDivArg, int maxVelFPArg, int thrustFPArg,
                int speedFPArg, int bounceVelFPArg, int maxSpinRateArg)
   {
      world = worldArg;

      xFP = MathFP.toFP(startX);
      yFP = MathFP.toFP(startY);

      maxVelFP = maxVelFPArg;
      thrustFP = thrustFPArg;
      setDirection(startDirection);

      wantAlignment = false;
      if (alignedDivArg > 0)
      {
         alignedDivDegreesFP = MathFP.div(360, alignedDivArg);
         wantAlignment = true;
      }
      maxSpinRate = maxSpinRateArg;
      bounceVelFP = bounceVelFPArg;
      setVel(speedFPArg);
   }

   /**
    * 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), MathFP.cos(getRadiansFromAngle(alignedDir)));
      yVelFP = MathFP.mul(MathFP.toFP(speedArg), -MathFP.sin(getRadiansFromAngle(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;
   }

   /**
    * Gets the world this actor is currently within.
    */
   public World getWorld()
   {
      return world;
   }

   /**
    * 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.
    */
   abstract public void render(Graphics graphics, int offsetX, int offsetY);

   /**
    * Gets the spin rate for this Actor in degrees per second.
    * @return The current spin (turning) rate.
    */
   public int getSpin()
   {
      return MathFP.toInt(spinFP);
   }

   /**
    * Set the spin rate for this Actor in degrees per second.
    * @param newSpin The spin rate.
    */
   public void setSpin(int newSpin)
   {
      spinFP = MathFP.toFP(newSpin);
   }

   /**
    * Sets this Actors spin rate to be the maximum (set in the constructor).
    */
   public final void setPeakSpin()
	{
		spinFP = MathFP.toFP(maxSpinRate);
	}

   /**
    * Sets this Actors spin rate to be the negative maximum (set in the
    * constructor). Use this to spin the Actor backwards (counter clockwise).
    */
	public final void setNegPeakSpin()
	{
		spinFP = MathFP.toFP(-maxSpinRate);
	}

   /**
    * Set an angle this actors wants to face; the actor will start spinning
    * at its default spin rate towards the target angle - see cycle for
    * the actual spin code.
    */
   public final void setTargetDirection(int angle)
   {
      targetAngle = angle;
      autoSpinning = false;
   }

   /**
    * A cycle method that moves the Actor a distance relative to its current
    * speed (the value of the speed int) and the amount of time that has passed
    * since the last call to cycle (deltaMS). This code uses a fluff value in
    * order to remember values too small to handle (below the tick level).
    * @param deltaMS The number of milliseconds that have passed since the last
    * call to cycle.
    */
   public void cycle(long deltaMS)
   {
      int ticks = (int) (deltaMS + fluff) / 100;

      // remember the bit we missed
      fluff += (deltaMS - (ticks * 100));

      if (ticks > 0)
      {
         int ticksFP = MathFP.toFP(ticks);

         // move towards our target direction, if we have one
         if (targetAngle != 0)
         {
            if (!autoSpinning)
            {
               // start spin in the dir of the target angle
               setSpin(isClockwise(getDirection(),
                                   targetAngle) ? -maxSpinRate : maxSpinRate);
            }

            // and check if we've made it to the target direction
            if (getAlignedDirection(targetAngle) == getDirection())
            {
               setSpin(0);
               setTargetDirection(0);
               autoSpinning = false;
            }
         }

         // spin based on degrees per tick
         if (spinFP != 0)
            setDirection(getRealDirection() +
                         MathFP.toInt(MathFP.mul(ticksFP, spinFP)));

         // move based on our speed in pixels per ticks
         if (thrustFP != 0)
         {
            // Calculate the acceleration for this cycle by multiplying the
            // direction by the thrust on both x and y.
            xAccFP = MathFP.mul(thrustFP,
                                MathFP.cos(getRadiansFromAngle(alignedDir)));
            yAccFP = MathFP.mul(thrustFP,
                                -MathFP.sin(getRadiansFromAngle(alignedDir)));

            // Increase the velocity by the amount of acceleration in this
            // cycle.
            xVelFP = MathFP.add(xVelFP, xAccFP);
            yVelFP = MathFP.add(yVelFP, yAccFP);
         }

         // Fix the velocity to the maximum if it currently exceeds it.
         if (xVelFP > maxVelFP)
            xVelFP = maxVelFP;
         else if (xVelFP < -maxVelFP) xVelFP = -maxVelFP;
         if (yVelFP > maxVelFP)
            yVelFP = maxVelFP;
         else if (yVelFP < -maxVelFP) yVelFP = -maxVelFP;

         // Remember previous values
         lastXFP = xFP;
         lastYFP = yFP;

         // Adjust x
         xFP = MathFP.add(xFP, MathFP.mul(xVelFP, ticksFP));

         // Check if we collided with anything after the x movement
         if (world.checkCollision(this))
         {
            xVelFP = MathFP.mul(xVelFP, bounceVelFP);
            xFP = MathFP.add(lastXFP, xVelFP);
         }

         // Adjust Y. This code also handles a special case where the x
         // collision may have caused the Actor to move (such as colliding with
         // a teleport or level gateway). In this case our lastYFP is invalid

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品婷婷伊人一区三区三| 欧美aⅴ一区二区三区视频| 日韩美女主播在线视频一区二区三区 | 国产亚洲精品超碰| 久久综合九色综合欧美98| 2017欧美狠狠色| 日本一区二区三区电影| 国产精品久久久久aaaa樱花| 国产精品电影院| 亚洲蜜桃精久久久久久久| 一区二区在线看| 亚洲电影视频在线| 国模无码大尺度一区二区三区| 国产在线国偷精品免费看| 成人福利视频网站| 欧美视频在线观看一区二区| 91精品国产综合久久久久久久| 欧美一级生活片| 久久蜜桃av一区精品变态类天堂| 欧美日韩一区二区三区在线| 91精品国产aⅴ一区二区| 久久综合成人精品亚洲另类欧美| 欧美国产精品一区二区三区| 亚洲国产一区二区a毛片| 激情丁香综合五月| 色婷婷av一区二区三区gif| 日韩亚洲欧美中文三级| 欧美激情一区二区三区在线| 亚洲精品老司机| 麻豆国产精品一区二区三区 | 中文字幕一区免费在线观看| 亚洲主播在线观看| 国产麻豆精品在线观看| 99国产一区二区三精品乱码| 欧美一区二区三区视频免费播放| 国产日本亚洲高清| 天天操天天干天天综合网| 国产69精品久久777的优势| 欧美三级资源在线| 国产婷婷精品av在线| 日韩电影免费在线看| 91玉足脚交白嫩脚丫在线播放| 制服丝袜国产精品| 亚洲激情中文1区| 国产一区二区三区视频在线播放| 91成人免费电影| 国产精品色眯眯| 国产乱妇无码大片在线观看| 欧美肥妇毛茸茸| 综合久久久久久久| 国产一区二区三区久久悠悠色av| 欧美午夜精品久久久久久孕妇 | 欧美中文字幕一区| 国产无一区二区| 欧美aa在线视频| 制服.丝袜.亚洲.中文.综合| 亚洲日韩欧美一区二区在线| 国产激情偷乱视频一区二区三区| 欧美视频一区在线观看| 一区二区三区影院| av不卡免费在线观看| 国产色产综合色产在线视频| 精品一区二区三区影院在线午夜| 欧美另类videos死尸| 亚洲午夜激情av| 欧美在线999| 亚洲与欧洲av电影| 欧美日韩美女一区二区| 亚洲成人自拍网| 欧美日韩在线综合| 亚洲高清中文字幕| 欧美一区二区三区性视频| 亚洲成av人片在线观看无码| 欧美三级日本三级少妇99| 亚洲精品大片www| 日本韩国欧美一区二区三区| 亚洲免费视频成人| 色综合久久88色综合天天免费| 中文字幕日韩一区| 91在线丨porny丨国产| 亚洲日本一区二区| 欧美日韩精品一区视频| 日韩av午夜在线观看| 日韩一区二区三区在线观看 | 亚洲婷婷国产精品电影人久久| 粉嫩aⅴ一区二区三区四区五区 | 色视频一区二区| 亚洲第一狼人社区| 8x福利精品第一导航| 激情综合色播激情啊| 亚洲欧洲三级电影| 在线观看不卡一区| 九色|91porny| 亚洲色图20p| 日韩免费观看高清完整版 | 日韩经典一区二区| 日韩美女主播在线视频一区二区三区| 蜜臀国产一区二区三区在线播放| 精品日韩一区二区三区| caoporm超碰国产精品| 亚洲主播在线观看| 久久日一线二线三线suv| 99国产精品久久久久| 天堂va蜜桃一区二区三区 | 日本一道高清亚洲日美韩| 久久新电视剧免费观看| 欧美日韩亚洲综合在线| 日韩电影在线观看网站| 国产精品美女久久久久久久| 欧美高清精品3d| 丁香另类激情小说| 日本vs亚洲vs韩国一区三区 | 成人黄色片在线观看| 亚洲成av人片www| 国产欧美日韩精品一区| 欧美群妇大交群中文字幕| 高清av一区二区| 青青草原综合久久大伊人精品优势 | 久久综合九色综合欧美亚洲| 在线欧美日韩精品| 国产不卡视频在线播放| 丝袜亚洲另类欧美综合| 国产精品久久久久四虎| 欧美成人一区二区三区| 欧美午夜精品久久久| 成人三级伦理片| 国内久久婷婷综合| 丝袜诱惑亚洲看片| 亚洲午夜私人影院| 亚洲欧洲国产日韩| 久久久久9999亚洲精品| 精品国产乱码久久| 91精品国产色综合久久ai换脸 | 精品少妇一区二区三区视频免付费 | 日韩国产欧美在线观看| 中文字幕字幕中文在线中不卡视频| 久久精品视频一区二区| 日韩午夜中文字幕| 欧美一区二区三区在线看| 欧美精品tushy高清| 精品视频999| 欧美精品色一区二区三区| 91福利国产成人精品照片| 色噜噜狠狠色综合欧洲selulu| 成人av在线网| 91免费视频观看| 色噜噜久久综合| 欧美在线一区二区| 欧美日韩激情一区| 欧美日韩不卡一区二区| 欧美精品在欧美一区二区少妇| 欧美日韩在线三区| 日韩一级片网站| 欧美mv日韩mv亚洲| 久久精品一区二区三区不卡| 久久欧美中文字幕| 中文字幕中文乱码欧美一区二区| 亚洲国产精品av| 亚洲精品国产成人久久av盗摄| 一区二区免费视频| 五月天激情小说综合| 久久精品免费观看| 国产乱子轮精品视频| 成年人国产精品| 欧美性极品少妇| 欧美第一区第二区| 国产精品色呦呦| 亚洲va中文字幕| 国产精品中文字幕日韩精品| 99视频精品全部免费在线| 91蜜桃免费观看视频| 91 com成人网| 国产三级精品三级| 亚洲日本va午夜在线影院| 性做久久久久久免费观看| 九九精品一区二区| www.欧美.com| 欧美一区国产二区| 国产精品青草久久| 日本人妖一区二区| 成人精品免费视频| 欧美日韩国产综合久久| 欧美成人欧美edvon| 亚洲麻豆国产自偷在线| 久久99精品国产麻豆婷婷洗澡| 成人美女在线视频| 欧美乱熟臀69xxxxxx| 国产精品免费久久久久| 亚洲国产成人porn| 国产成人免费9x9x人网站视频| 欧美自拍丝袜亚洲| 国产日韩欧美一区二区三区乱码 | 久久久久高清精品| 亚洲精品videosex极品| 蜜桃视频在线一区| 欧美午夜寂寞影院| 中文字幕一区视频| 国产乱码精品一品二品| 欧美高清一级片在线| 亚洲欧洲精品一区二区三区|