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

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

?? actor.java

?? 大量j2me源代碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
      return world;
   }

   /**
    * set spin rate in degrees per second
    * @param i 0-360 degrees
    */
   public final void setSpin(int i)
   {
      spinFP = MathFP.toFP(i);
   }

   /**
    * 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;
   }

   public final void setThrust(int i)
   {
      thrustFP = MathFP.div(i, MathFP.toFP(3));
   }

   public final int getThrust()
   {
      return MathFP.toInt(thrustFP);
   }

   public final boolean isThrusting()
   {
      return MathFP.toInt(thrustFP) != 0;
   }

   public final int getX()
   {
      return x;
   }

   public final int getY()
   {
      return y;
   }

   public final void setX(int xArg)
   {
      xFP = MathFP.toFP(xArg);
      x = xArg;
   }

   public final void setY(int yArg)
   {
      yFP = MathFP.toFP(yArg);
      y = yArg;
   }

   public final int getCenterX()
   {
      return x + (getWidth() / 2);
   }

   public final int getCenterY()
   {
      return getY() + (getHeight() / 2);
   }

   public final boolean isCollidingWith(int px, int py)
   {
      if (px >= x && px <= (x + getWidth()) &&
              py >= y && py <= (y + getHeight()))
         return true;
      return false;
   }

   public final boolean isCollidingWith(int ax, int ay, int w, int h)
   {
      if (y + getHeight() < ay || y > ay + h ||
              x + getWidth() < ax || x > ax + w)
         return false;
      return true;
   }

   public final boolean isCollidingWith(Actor another)
   {
      return isCollidingWith(another.getX(), another.getY(), another.getWidth(),
                             another.getHeight());
   }

   public void suicide()
   {
   }

   private boolean teleported;

   /**
    * 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)
         {
            //#ifdef debug
            if (alignedDir > 359) System.out.println("bad aligneddir=" + alignedDir);
            if (alignedDir < 0) System.out.println("bad aligneddir=" + alignedDir);
            //#endif
            xAccFP = MathFP.mul(thrustFP, lookupCosFP[alignedDir]);
            yAccFP = MathFP.mul(thrustFP, -lookupSinFP[alignedDir]);
            xVelFP = MathFP.add(xVelFP, xAccFP);
            yVelFP = MathFP.add(yVelFP, yAccFP);
         }

         //System.out.println("accX=" + MathFP.toString(xAccFP) + " accY=" + MathFP.toString(yAccFP) +
         //						 " velX=" + MathFP.toString(xVelFP) + " velY=" + MathFP.toString(yVelFP));

         // If you change this remember to change the setVel code
         if (xVelFP > maxVelFP)
            xVelFP = maxVelFP;
         else if (xVelFP < -maxVelFP) xVelFP = -maxVelFP;
         if (yVelFP > maxVelFP)
            yVelFP = maxVelFP;
         else if (yVelFP < -maxVelFP) yVelFP = -maxVelFP;

         lastXFP = xFP;
         lastYFP = yFP;

         // adjust X
         xFP = MathFP.add(xFP, MathFP.mul(xVelFP, ticksFP));
         x = MathFP.toInt(xFP);
         teleported = false;
         // now check if we collided with anything (we test X first)
         if (collidable)
         {
            if (world.checkCollision(this, x, y, getWidth(), getHeight()))
            {
               xVelFP = MathFP.mul(xVelFP, bounceVelFP);
               xFP = MathFP.add(lastXFP, xVelFP);
               x = MathFP.toInt(xFP);
            }
            if (lastYFP != yFP) teleported = true;
         }

         // adjust Y
         // we also handle a special case where the x collision may have
         // caused the ship to move (teleport, gateway). In this case our
         // lastYFP is invalid and we should abort the collision test.
         if (!teleported)
         {
            yFP = MathFP.add(yFP, MathFP.mul(yVelFP, ticksFP));
            y = MathFP.toInt(yFP);

            // now check if we collided with anything in Y movement
            if (collidable)
            {
               if (world.checkCollision(this, x, y, getWidth(), getHeight()))
               {
                  yVelFP = MathFP.mul(yVelFP, bounceVelFP);
                  yFP = MathFP.add(lastYFP, yVelFP);
                  y = MathFP.toInt(yFP);
               }
            }
         }
      }
   }

   public void onCollision(Actor another)
   {
   }


   /******************************* STATICS **********************************/

   /**
    * returns the shortest turning direction from one angle to another
    */
   public final static boolean isClockwise(int angleA, int angleB)
   {
      if (angleA > angleB)
         return (Math.abs(angleA - angleB)) < (angleB + (360 - angleA));
      else
         return (angleA + (360 - angleB)) < (Math.abs(angleB - angleA));
   }

   /**
    * Returns a game relative angle between two points
    */
   public final static int getFacingAngle(int x, int y, int ax, int ay)
   {
      // figure the two sides of our right angle triangle
      int a = MathFP.toFP(Math.abs(ax - x));
      int b = MathFP.toFP(Math.abs(ay - y));

      if (a == 0) a = FP_ONE;
      if (b == 0) b = FP_ONE;

      int bovera = MathFP.div(b, a);
      int angleInRadians = MathFP.atan(bovera);
      int angle = getAngleFromRadians(angleInRadians);

      // The tan result from this calculation is between 0 and 90 degrees so now
// we adjust the result for the actual quadrant we're in relative to the
// other Actor.
      if (ax < x) // left side
      {
         if (ay < y)
            return angle + 90;   // top
         return angle + 180;     // bottom
      }
      else // right side
      {
         if (ay < y)
            return angle;        // top
         return angle + 270;     // bottom
      }
   }

   public final static int getAngleFromRadians(int radiansFP)
   {
      return MathFP.toInt(MathFP.mul(radiansFP, FP_DEGREES_PER_RAD));
   }

   public final static int getRadiansFromAngle(int angle)
   {
      return MathFP.div(MathFP.toFP(angle), FP_DEGREES_PER_RAD);
   }

   /**
    * returns the opposite of an angle (ie. 0=180, 90=270)
    * @param angle
    */
   public final static int getOppositeAngle(int angle)
   {
      if (angle < 180) return angle + 180;
      return angle - 180;
   }

   /**
    * Project a point along a vector
    * @param x starting x position
    * @param y starting y position
    * @param angle angle to project along
    * @param distance distance to project
    * @return int[] containing x and y int positions
    */
   public final static int[] getProjectedPos(int x, int y, int angle,
                                             int distance)
   {
      int dx = lookupCosFP[angle];
      int dy = -lookupSinFP[angle];

      int xFP = MathFP.toFP(x);
      int yFP = MathFP.toFP(y);
      int distanceFP = MathFP.toFP(distance);

      xFP = MathFP.add(xFP, MathFP.mul(dx, distanceFP));
      yFP = MathFP.add(yFP, MathFP.mul(dy, distanceFP));

      int[] result = {MathFP.toInt(xFP), MathFP.toInt(yFP)};
      return result;
   }


   public final static int distance(int x1, int y1, int x2, int y2)
   {
      int dx = (x2 - x1) * (x2 - x1);
      int dy = (y2 - y1) * (y2 - y1);
      if (dx == 0 || dy == 0) return 0;

      try
      {
         return MathFP.toInt(MathFP.sqrt(MathFP.toFP(dx + dy)));
      }

      catch (ArithmeticException ae)
      {
         return 0;
      }
   }

}


















?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲色图都市小说| 国产精品麻豆99久久久久久| 国产乱码字幕精品高清av | 成人动漫一区二区| 国产一区二区三区香蕉| 精品一区二区三区香蕉蜜桃| 毛片不卡一区二区| 久久99国产精品免费网站| 麻豆成人av在线| 久久精品国产一区二区| 国产一区二区三区电影在线观看| 国产一区二区三区精品欧美日韩一区二区三区| 日韩国产欧美视频| 久久精品理论片| 国产曰批免费观看久久久| 国产成人高清视频| 99久久精品情趣| 91麻豆高清视频| 欧美猛男gaygay网站| 日韩欧美自拍偷拍| 日本一区二区三级电影在线观看| 国产精品福利在线播放| 亚洲午夜在线观看视频在线| 美女性感视频久久| www.视频一区| 欧美日韩精品系列| 久久久久国产成人精品亚洲午夜| 中文字幕一区二区日韩精品绯色| 亚洲成人av一区| 国产一区二区在线免费观看| 一本久久精品一区二区| 欧美精品三级在线观看| 中文字幕欧美三区| 日韩主播视频在线| 成人免费福利片| 欧美一级二级三级乱码| 五月天亚洲婷婷| 日韩午夜av一区| 91女神在线视频| 欧美日韩情趣电影| 亚洲国产精品黑人久久久| 亚洲国产日韩a在线播放性色| 精品一二三四在线| 欧美自拍偷拍一区| 国产亚洲成年网址在线观看| 日韩精品成人一区二区在线| 成a人片亚洲日本久久| 日韩一区二区在线播放| 亚洲蜜臀av乱码久久精品| 狠狠久久亚洲欧美| 欧美精品一二三区| 亚洲免费观看高清完整版在线 | 日韩一级欧美一级| 最新热久久免费视频| 国产精品一区二区久激情瑜伽| 精品视频999| 成人欧美一区二区三区白人| 国产精品亚洲午夜一区二区三区 | 成人免费视频一区| 日韩视频123| 天天综合色天天综合色h| 91麻豆国产福利精品| 亚洲手机成人高清视频| 91麻豆精品国产无毒不卡在线观看| 欧美精品日日鲁夜夜添| 一区二区久久久久| 成人av集中营| 国产日韩欧美精品综合| av一区二区久久| 日本一区二区三区高清不卡| 国产一区二区女| 欧美不卡一区二区| 美女视频黄免费的久久| 日韩精品专区在线| 热久久久久久久| 欧美成人伊人久久综合网| 免费人成在线不卡| 日韩午夜激情av| 美女在线视频一区| 2019国产精品| 国产精品亚洲人在线观看| 日本一区二区三级电影在线观看| 粉嫩aⅴ一区二区三区四区 | 成人动漫在线一区| 日韩理论片网站| 色诱视频网站一区| 偷拍自拍另类欧美| 91精品欧美福利在线观看| 狂野欧美性猛交blacked| 26uuu国产在线精品一区二区| 国产激情视频一区二区三区欧美| 中文字幕一区二区三区四区| 91久久国产最好的精华液| 视频一区二区三区入口| 精品精品国产高清a毛片牛牛| 经典三级在线一区| 国产精品久久久久aaaa樱花| 欧美四级电影网| 经典三级视频一区| 婷婷国产在线综合| 日韩视频永久免费| 国产成人高清视频| 亚洲va欧美va天堂v国产综合| 日韩欧美一级二级| 99re免费视频精品全部| 日韩影视精彩在线| 国产日韩欧美制服另类| 91老司机福利 在线| 美美哒免费高清在线观看视频一区二区| 久久综合九色综合欧美98 | 欧美亚洲图片小说| 国产一区在线看| 亚洲色图色小说| 亚洲精品一区二区三区四区高清 | 亚洲色图视频网| 日韩一区二区三区高清免费看看| 成人黄动漫网站免费app| 亚洲成a人片综合在线| 久久精品欧美一区二区三区不卡| 91成人在线精品| 国产成a人亚洲| 日本美女一区二区| 一区二区三区四区在线| 久久久久久久久99精品| 555夜色666亚洲国产免| 一本一道久久a久久精品综合蜜臀| 精品亚洲aⅴ乱码一区二区三区| 亚洲色图.com| 欧美亚洲一区二区在线| 一区二区国产视频| 日韩欧美一区二区在线视频| 91精品视频网| 亚洲成人动漫av| 中文字幕亚洲成人| 久久精品一级爱片| 91麻豆精品国产91久久久久久久久 | 色老头久久综合| 国产精品1024| 乱中年女人伦av一区二区| 午夜视频在线观看一区二区三区| 欧美极品aⅴ影院| 久久新电视剧免费观看| 日韩一二三区不卡| 欧美一区二区三区视频在线| 欧美午夜精品一区二区蜜桃| 91蜜桃婷婷狠狠久久综合9色| 成人丝袜视频网| 男人操女人的视频在线观看欧美| 免费的成人av| 26uuu欧美日本| 欧美成人精品福利| 欧美v亚洲v综合ⅴ国产v| 91精品国产手机| 欧美精选午夜久久久乱码6080| 欧美视频自拍偷拍| 欧洲日韩一区二区三区| 欧美偷拍一区二区| 欧美日韩精品欧美日韩精品| 欧美日韩精品欧美日韩精品| 欧美色中文字幕| 欧美日韩中文另类| 91精品国产麻豆| 日韩一区二区高清| 国产欧美一区视频| 亚洲欧洲精品一区二区三区| 亚洲美女在线国产| 亚洲福中文字幕伊人影院| 日本一区中文字幕| 国产一区二区三区电影在线观看| 国产91精品入口| 日本精品一级二级| 51精品国自产在线| 国产调教视频一区| 亚洲精品一二三| 日韩1区2区日韩1区2区| 国产福利电影一区二区三区| 99国产欧美另类久久久精品| 欧美午夜影院一区| 精品国产一区二区亚洲人成毛片| 国产欧美日韩中文久久| 亚洲国产日韩一区二区| 国产一区二区电影| 在线免费不卡电影| 亚洲精品在线免费观看视频| 国产精品传媒视频| 日本三级韩国三级欧美三级| 国产精品一卡二卡在线观看| 在线视频亚洲一区| 久久蜜臀中文字幕| 亚洲国产成人91porn| 国产91在线观看| 欧美日韩高清在线播放| 日本一区二区三级电影在线观看| 久久精品国产精品青草| eeuss鲁片一区二区三区在线观看 eeuss鲁片一区二区三区在线看 | 一个色在线综合| 国产专区综合网| 欧美区一区二区三区| 国产精品福利一区| 美美哒免费高清在线观看视频一区二区 |