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

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

?? actor.java

?? 大量j2me源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號(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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩精品欧美日韩精品一| 中文字幕久久午夜不卡| 欧美视频一区二| 日本高清不卡aⅴ免费网站| 成人av先锋影音| 99在线精品一区二区三区| 成人免费视频网站在线观看| 成人激情校园春色| fc2成人免费人成在线观看播放 | 欧美一区二区人人喊爽| 9191成人精品久久| 日韩欧美国产电影| 久久精品免视看| 中文字幕视频一区二区三区久| 亚洲欧美另类久久久精品| 亚洲综合在线观看视频| 亚州成人在线电影| 精品一区二区三区免费视频| 国产激情一区二区三区四区| 成人av午夜影院| 欧美三日本三级三级在线播放| 欧美日韩久久久| 欧美精品一区二区三区高清aⅴ | 国产农村妇女精品| 自拍偷拍欧美精品| 亚洲大片免费看| 狠狠久久亚洲欧美| www.成人网.com| 欧美日韩国产色站一区二区三区| 日韩欧美一级二级三级久久久| 2021国产精品久久精品| 综合在线观看色| 人妖欧美一区二区| 国产高清在线精品| 欧美午夜精品电影| 精品日产卡一卡二卡麻豆| 国产精品久久久久影院色老大| 亚洲综合免费观看高清完整版| 日本aⅴ免费视频一区二区三区 | 精品国产91乱码一区二区三区| 国产女人aaa级久久久级| 亚洲福利视频导航| 国产剧情一区二区| 欧美视频第二页| 精品国产a毛片| 一级女性全黄久久生活片免费| 蜜桃视频第一区免费观看| 成人黄色国产精品网站大全在线免费观看 | 亚洲综合色丁香婷婷六月图片| 麻豆91在线观看| 91免费国产在线| 日韩欧美成人一区二区| 亚洲视频一区在线| 免费在线观看一区| 在线观看成人小视频| 久久久国产一区二区三区四区小说 | 欧美中文字幕亚洲一区二区va在线 | 一本久久精品一区二区| 26uuu欧美| 亚洲a一区二区| 99久久久国产精品免费蜜臀| 精品乱人伦一区二区三区| 亚洲免费观看高清| 黄色小说综合网站| 欧美日韩一二三区| 亚洲理论在线观看| 成人中文字幕合集| 精品乱码亚洲一区二区不卡| 亚洲一区在线视频| 波多野结衣一区二区三区 | 亚洲蜜臀av乱码久久精品 | 国产精品视频一二| 久久国产麻豆精品| 精品视频一区三区九区| 亚洲精品欧美在线| 成人性生交大片免费| 久久只精品国产| 日韩精品久久久久久| 91黄视频在线观看| 国产精品久久久久久久久动漫| 久久精品国产精品亚洲综合| 欧美日本视频在线| 亚洲成人免费在线观看| 色综合色狠狠综合色| 国产精品美女久久久久久| 国产一区二区电影| 精品国产一区久久| 美女视频黄频大全不卡视频在线播放| 欧美视频一二三区| 亚洲福利一二三区| 欧美日韩一二三| 亚瑟在线精品视频| 欧洲一区在线观看| 亚洲国产精品久久一线不卡| 欧美在线观看视频一区二区三区| 亚洲欧美二区三区| 99在线精品一区二区三区| 国产精品视频麻豆| jlzzjlzz亚洲女人18| 中文字幕在线一区免费| 成人午夜电影久久影院| 亚洲国产高清在线| av在线免费不卡| 亚洲欧美日韩国产手机在线| 91丨九色丨蝌蚪富婆spa| 中文字幕亚洲视频| 一本久久a久久免费精品不卡| 亚洲男人天堂一区| 欧洲一区二区三区免费视频| 亚洲高清久久久| 777a∨成人精品桃花网| 美腿丝袜亚洲色图| 精品精品国产高清一毛片一天堂| 国产麻豆欧美日韩一区| 国产精品国产a| 在线免费精品视频| 午夜影视日本亚洲欧洲精品| 欧美一区二区三区四区五区 | 成人久久视频在线观看| 国产精品福利一区二区| 色婷婷精品大在线视频| 日韩专区在线视频| xnxx国产精品| 91香蕉视频黄| 天天亚洲美女在线视频| 精品少妇一区二区三区在线视频| 国内成人免费视频| 最新热久久免费视频| 欧美性生活大片视频| 美女国产一区二区| 亚洲国产精品ⅴa在线观看| 91麻豆国产福利在线观看| 亚洲国产综合在线| 26uuu亚洲| 一本色道久久综合狠狠躁的推荐| 午夜伊人狠狠久久| 久久免费美女视频| 91免费观看视频在线| 丝袜亚洲另类丝袜在线| 日本一区二区三区在线不卡| 91国偷自产一区二区开放时间 | 99视频在线精品| 日本亚洲天堂网| 欧美高清在线精品一区| 欧美亚洲国产一区二区三区 | 99热国产精品| 免费看黄色91| 中文字幕五月欧美| 欧美一级二级三级乱码| eeuss鲁片一区二区三区| 日本亚洲一区二区| 国产精品动漫网站| 欧美一区二区三区婷婷月色| 波波电影院一区二区三区| 首页国产丝袜综合| 中文一区二区完整视频在线观看| 欧美日韩不卡一区二区| 国产99久久久国产精品免费看| 国产91在线看| 亚洲成av人片在线观看无码| 中文字幕不卡一区| 日韩欧美国产综合在线一区二区三区| 成人福利在线看| 精品在线播放免费| 午夜欧美视频在线观看| 亚洲国产高清在线观看视频| 欧美一区二区三区白人| 色综合天天综合色综合av| 狠狠色狠狠色合久久伊人| 午夜电影久久久| 亚洲激情第一区| 中文欧美字幕免费| 精品国产3级a| 日韩视频一区二区三区| 91极品视觉盛宴| 91亚洲精品乱码久久久久久蜜桃| 久久99九九99精品| 三级欧美在线一区| 一区二区三区四区av| 国产精品天天摸av网| 久久一留热品黄| 精品三级在线观看| 欧美一级午夜免费电影| 欧美日韩久久久久久| 在线一区二区视频| 91免费视频大全| 99re热这里只有精品视频| 成人午夜免费视频| 国产成人综合视频| 久久99久久久欧美国产| 日本午夜精品视频在线观看| 亚洲一区二区三区自拍| 亚洲精品老司机| 成人欧美一区二区三区1314| 国产欧美日韩不卡| 欧美国产日韩在线观看| 欧美高清在线精品一区| 亚洲国产精品av| 国产精品久久久久久久久免费相片| 久久久久久久精|