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

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

?? actor.java

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

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费大片在线观看| 亚洲高清不卡在线观看| 欧美日免费三级在线| 国产乱子轮精品视频| 亚洲自拍偷拍网站| 亚洲国产成人午夜在线一区| 2024国产精品视频| 欧美三级在线视频| av中文一区二区三区| 麻豆国产精品一区二区三区| 国产精品电影一区二区| 精品国产一区久久| 欧美一区日韩一区| 欧美日韩黄色影视| 91小宝寻花一区二区三区| 国内久久精品视频| 日韩电影在线一区二区三区| 亚洲三级久久久| 国产精品视频免费看| www久久精品| 欧美电影免费观看完整版 | 91蜜桃免费观看视频| 久久97超碰色| 日日摸夜夜添夜夜添国产精品| 中文字幕一区二区在线播放| 精品奇米国产一区二区三区| 欧美色视频一区| 成人av资源下载| 国产乱妇无码大片在线观看| 亚洲午夜一二三区视频| 亚洲视频每日更新| 中文字幕一区二区三区在线观看| 国产精品日韩成人| 久久综合给合久久狠狠狠97色69| 欧美电影免费观看高清完整版在线 | 91精品国产综合久久久蜜臀图片| 99国产精品99久久久久久| 国产乱一区二区| 国产在线精品一区二区不卡了| 欧美aaaaaa午夜精品| 五月婷婷综合在线| 图片区小说区国产精品视频| 亚洲国产视频在线| 五月婷婷色综合| 美女在线观看视频一区二区| 日本不卡一二三| 日韩精品一二区| 久久99国产精品久久| 国产精品白丝jk白祙喷水网站| 国产曰批免费观看久久久| 国产一区二区精品久久| 国产精品一二三四五| 成人sese在线| 国产jizzjizz一区二区| 成人av在线播放网站| 97超碰欧美中文字幕| 日本久久电影网| 欧美日韩在线播放三区| 日韩一区二区免费高清| 精品国产污网站| 国产精品久久久久久久岛一牛影视| 国产精品嫩草久久久久| 亚洲欧美日韩国产另类专区| 午夜精品123| 男女男精品视频网| 国产精品资源站在线| 国产91精品露脸国语对白| 色噜噜狠狠色综合中国| 欧美精品黑人性xxxx| 精品乱人伦一区二区三区| 亚洲国产精华液网站w| 国产亚洲欧美色| 亚洲自拍偷拍图区| 国内成人精品2018免费看| 成人在线一区二区三区| 欧美揉bbbbb揉bbbbb| 精品国产免费一区二区三区四区| 久久久欧美精品sm网站| 亚洲日本va午夜在线电影| 日韩av不卡一区二区| 国产精品一区二区黑丝| 在线观看免费亚洲| 欧美一区二视频| 国产精品无遮挡| 肉肉av福利一精品导航| 国产综合色产在线精品| 色婷婷av一区二区三区之一色屋| 欧美日本一区二区在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 亚洲精品一卡二卡| 国产乱码精品一区二区三区忘忧草| 成人午夜精品在线| 欧美一级二级在线观看| 最近中文字幕一区二区三区| 精品一区二区三区影院在线午夜| 91在线高清观看| 欧美精品一区二区在线观看| 一区二区在线免费| 国产不卡视频在线播放| 欧美一区二区三区在线电影| 国产精品久久久久一区二区三区共 | 乱一区二区av| 国产69精品一区二区亚洲孕妇| 欧美日韩精品综合在线| 国产精品久久久久天堂| 久久国产欧美日韩精品| 欧美丝袜自拍制服另类| 国产精品成人免费| 国内精品国产三级国产a久久| 欧美日韩在线综合| 国产精品久久99| 国产乱一区二区| 亚洲精品一区二区在线观看| 天堂一区二区在线| 欧美丝袜自拍制服另类| 亚洲一区在线观看网站| 91视频你懂的| 国产婷婷色一区二区三区四区| 人人精品人人爱| 欧美区一区二区三区| 一区二区三区四区中文字幕| 成人激情黄色小说| 国产精品久久看| 成人午夜私人影院| 国产欧美日韩麻豆91| 国产资源在线一区| 精品美女一区二区| 韩日精品视频一区| 欧美成人女星排名| 久久成人麻豆午夜电影| 日韩一级二级三级精品视频| 午夜国产不卡在线观看视频| 在线免费观看日韩欧美| 亚洲精品日韩专区silk| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 一区二区三区欧美| 91在线精品一区二区三区| 国产精品嫩草99a| 懂色av一区二区三区免费观看| 精品91自产拍在线观看一区| 狠狠色综合播放一区二区| 精品少妇一区二区三区日产乱码| 黑人巨大精品欧美一区| 欧美精品一区二区三区视频| 国产精品一二三| 国产三级精品三级在线专区| 国产99久久久精品| 日本一区二区三区四区在线视频 | 国产成人精品免费看| 国产日韩欧美在线一区| 国产精品一区二区男女羞羞无遮挡| 日韩视频中午一区| 亚洲国产成人va在线观看天堂| 在线播放国产精品二区一二区四区 | 欧美日韩在线播放| 亚洲美女视频一区| 91麻豆精品国产91久久久久久| 蜜臀国产一区二区三区在线播放| 欧美高清www午色夜在线视频| 看电视剧不卡顿的网站| 国产欧美日韩在线| 在线中文字幕一区| 麻豆极品一区二区三区| 久久婷婷国产综合国色天香| 春色校园综合激情亚洲| 亚洲一区免费观看| 欧美老肥妇做.爰bbww视频| 美国精品在线观看| 国产精品嫩草影院av蜜臀| 一本久久综合亚洲鲁鲁五月天| 亚洲午夜久久久久| 欧美精品一区二区三区四区| 色综合一区二区三区| 日韩福利电影在线观看| 国产欧美一区二区精品性| 91女神在线视频| 日本欧美大码aⅴ在线播放| 久久久久久久综合色一本| 一本色道久久综合精品竹菊| 免费成人你懂的| 国产精品国产三级国产专播品爱网 | 91蝌蚪porny| 蜜臀av性久久久久蜜臀av麻豆| 国产欧美日产一区| 欧美亚洲日本一区| 国产一区二区不卡在线| 亚洲综合精品久久| 欧美国产一区二区在线观看| 欧美精品一卡二卡| av电影在线观看完整版一区二区| 视频在线观看一区二区三区| 中文字幕av一区二区三区高 | 欧美日韩综合色| 成人在线综合网站| 麻豆精品久久精品色综合| 国产精品超碰97尤物18| 精品国产一二三| 欧美精品欧美精品系列| 99re亚洲国产精品| 国产福利不卡视频|