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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? 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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品久久久久毛片软件| 极品销魂美女一区二区三区| 国产欧美精品一区二区三区四区| 777久久久精品| 欧美日韩亚洲综合一区二区三区| 在线视频国产一区| 欧美优质美女网站| 欧美亚洲国产一区二区三区va| 91免费观看视频在线| 99久久精品国产麻豆演员表| 色综合天天综合| 欧美性xxxxxxxx| 欧美一区二区三区播放老司机| 欧美精品xxxxbbbb| 精品国产污污免费网站入口| 久久精品人人做人人综合 | 91精品国产91久久久久久一区二区| 在线观看日韩高清av| 色婷婷综合在线| 色偷偷一区二区三区| 欧美美女bb生活片| 欧美v日韩v国产v| 国产精品欧美一级免费| 最新久久zyz资源站| 一区二区三区波多野结衣在线观看| 一区二区三区免费观看| 麻豆91在线看| 95精品视频在线| 欧美综合欧美视频| 精品国内片67194| 综合网在线视频| 性做久久久久久免费观看欧美| 蜜臀av一区二区| 色综合中文字幕国产| 久久综合av免费| 亚洲欧洲中文日韩久久av乱码| 日韩精品91亚洲二区在线观看 | 国产精品乱码一区二三区小蝌蚪| 一区二区高清在线| 国产电影一区在线| 制服丝袜av成人在线看| 国产精品色噜噜| 麻豆精品蜜桃视频网站| 91蝌蚪porny| 欧美精品一区二区久久婷婷| 亚洲国产另类av| 成人av在线一区二区三区| 欧美一区二区三区爱爱| 亚洲色图色小说| 国产精品影视在线| 日韩欧美国产三级| 一区二区三区四区不卡在线| 粉嫩av一区二区三区在线播放| 777久久久精品| 亚洲丰满少妇videoshd| 99精品一区二区三区| 精品久久99ma| 老司机午夜精品| 欧美妇女性影城| 亚洲最大的成人av| 91日韩一区二区三区| 欧美激情中文字幕一区二区| 美腿丝袜亚洲色图| 欧美精品丝袜久久久中文字幕| 亚洲欧美日韩国产综合| 99久久精品国产毛片| 国产精品高潮久久久久无| 黑人精品欧美一区二区蜜桃| 91精品国产综合久久精品| 亚洲综合小说图片| 欧美综合天天夜夜久久| 亚洲一区二区三区中文字幕| 日本精品一级二级| 亚洲免费在线看| 成人av在线电影| 国产精品美女久久久久久久久 | 在线精品视频免费观看| 中文字幕一区二区三区av| 成人h版在线观看| 国产精品久久久久久久久免费桃花 | 亚洲国产aⅴ成人精品无吗| 91美女福利视频| 一区二区三区在线视频观看58| 99国产精品久久久久久久久久久 | 日韩精品福利网| 日韩三级免费观看| 国产在线播精品第三| 国产区在线观看成人精品| 成人精品小蝌蚪| 一区二区三区精密机械公司| 欧美日产国产精品| 久久99热这里只有精品| 久久精品无码一区二区三区| 99久久婷婷国产| 香蕉久久一区二区不卡无毒影院| 欧美乱妇15p| 国产寡妇亲子伦一区二区| 亚洲欧美在线视频| 911精品产国品一二三产区| 捆绑变态av一区二区三区| 久久麻豆一区二区| 色婷婷久久一区二区三区麻豆| 日韩高清在线一区| 国产三级一区二区三区| 91美女福利视频| 男女性色大片免费观看一区二区| 国产欧美精品一区二区色综合 | 日韩视频一区在线观看| 国产精品正在播放| 国产精品视频一区二区三区不卡| 欧美无砖砖区免费| 国产麻豆一精品一av一免费| 日韩理论片中文av| 欧美一级二级三级乱码| 成人av在线资源网| 久久国产尿小便嘘嘘| 亚洲天堂网中文字| 91精品国产一区二区三区| 91亚洲永久精品| 精品无码三级在线观看视频| 亚洲免费三区一区二区| 精品成人一区二区三区四区| 欧美性xxxxxxxx| 欧美在线视频日韩| 99久久久国产精品免费蜜臀| 69久久夜色精品国产69蝌蚪网| 极品少妇一区二区三区精品视频| 亚洲欧洲日韩av| 久久老女人爱爱| 日韩久久免费av| 欧美日韩国产精选| 成人白浆超碰人人人人| 国产精品亚洲人在线观看| 日本 国产 欧美色综合| 亚洲一区国产视频| 亚洲激情成人在线| 成人免费在线播放视频| 中文字幕精品综合| 亚洲精品一区二区三区精华液| 欧美一区二区网站| 91精品国产免费| 成人免费高清视频在线观看| 国模娜娜一区二区三区| 青青草国产成人99久久| 日韩av一级电影| 日本成人在线一区| 亚洲成a人v欧美综合天堂| 亚洲激情在线激情| 一区二区三区免费看视频| 亚洲欧美日韩一区| 中文字幕中文在线不卡住| 国产精品网友自拍| 欧美激情一区三区| 中文字幕免费不卡在线| 中文字幕av一区 二区| 国产日产欧美一区二区视频| 久久久国产精品午夜一区ai换脸| 欧美zozozo| 久久精品人人爽人人爽| 国产精品久久国产精麻豆99网站| 久久久国产精华| 国产精品国产三级国产aⅴ无密码| 国产精品色哟哟网站| 综合激情网...| 亚洲综合免费观看高清完整版在线 | 免费xxxx性欧美18vr| 天使萌一区二区三区免费观看| 香蕉成人伊视频在线观看| 亚洲一卡二卡三卡四卡五卡| 日韩精品视频网站| 免费欧美在线视频| 国产精品乡下勾搭老头1| 国产精品18久久久久久久久| 99天天综合性| 欧美久久久一区| 久久免费的精品国产v∧| 中文字幕欧美三区| 无码av免费一区二区三区试看 | 国产精品天天摸av网| 国产精品国产a级| 亚洲欧美日韩中文字幕一区二区三区| 亚洲综合在线第一页| 麻豆91精品91久久久的内涵| 大白屁股一区二区视频| 91啪在线观看| 欧美一区欧美二区| 国产精品久久免费看| 亚洲一二三四久久| 国产伦精品一区二区三区视频青涩| jlzzjlzz亚洲日本少妇| 欧美一区二区三区系列电影| 中文字幕欧美国产| 欧美aⅴ一区二区三区视频| 国产高清久久久| 日韩一区二区三区电影在线观看| 亚洲图片激情小说| 久久国产综合精品| 欧美在线视频不卡| 国产精品久久久久久亚洲伦 | 樱花草国产18久久久久|