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

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

?? base.java

?? J2ME MIDP_Example_Applications
?? JAVA
字號:
// Copyright 2003 Nokia Corporation.//// THIS SOURCE CODE IS PROVIDED 'AS IS', WITH NO WARRANTIES WHATSOEVER,// EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS// FOR ANY PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE// OR TRADE PRACTICE, RELATING TO THE SOURCE CODE OR ANY WARRANTY OTHERWISE// ARISING OUT OF ANY PROPOSAL, SPECIFICATION, OR SAMPLE AND WITH NO// OBLIGATION OF NOKIA TO PROVIDE THE LICENSEE WITH ANY MAINTENANCE OR// SUPPORT. FURTHERMORE, NOKIA MAKES NO WARRANTY THAT EXERCISE OF THE// RIGHTS GRANTED HEREUNDER DOES NOT INFRINGE OR MAY NOT CAUSE INFRINGEMENT// OF ANY PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OWNED OR CONTROLLED// BY THIRD PARTIES//// Furthermore, information provided in this source code is preliminary,// and may be changed substantially prior to final release. Nokia Corporation// retains the right to make changes to this source code at// any time, without notice. This source code is provided for informational// purposes only.//// Nokia and Nokia Connecting People are registered trademarks of Nokia// Corporation.// Java and all Java-based marks are trademarks or registered trademarks of// Sun Microsystems, Inc.// Other product and company names mentioned herein may be trademarks or// trade names of their respective owners.//// A non-exclusive, non-transferable, worldwide, limited license is hereby// granted to the Licensee to download, print, reproduce and modify the// source code. The licensee has the right to market, sell, distribute and// make available the source code in original or modified form only when// incorporated into the programs developed by the Licensee. No other// license, express or implied, by estoppel or otherwise, to any other// intellectual property rights is granted herein.import javax.microedition.lcdui.*;// The player uses the base (or ship) to fly up, down, left and right.// It can fire bullets at blocks. Base is also used to draw itself.class Base{    final static int COLOR = 0xFFFF00; // YELLOW    final static int MAX_CANNON_COOLDOWN_TICKS =        (12000 / GameManager.MILLIS_PER_TICK); // 12 seconds    final static int MAX_CANNON_HEAT = 2;    final static int MAX_CANNON_FIRE_RATE = 2; // 2 bullets per second    private final GameManager gameManager;    private final int xMin;    private final int yMin;    private final int xMax;    private final int yMax;    private final int dx;    private final int dy;    private final int dCannon;    private final boolean useLimitedFiringRate;    private int x;    private int y;    private int w;    private int h;    private int xCannon;    private int yCannon;    private int collideTicks = 0;    private int lives;    private boolean gameActionLeft = false;    private boolean gameActionRight = false;    private boolean gameActionUp = false;    private boolean gameActionDown = false;    private boolean gameActionFire = false;    private int clockTickMillis = 0;    private int clockTickSeconds = 0;    private int cannonHeat = 0;    private int cannonCoolDownTicks = 0;    private int cannonFireCount = 0; // bullets    private int cannonFireRate = 0;  // bullets/sec    Base(GameManager gameManager, boolean useLimitedFiringRate,         int lives, int xMin, int yMin, int xMax, int yMax)    {        this.gameManager = gameManager;        this.lives = lives;        this.xMin = xMin;        this.yMin = yMin;        this.xMax = xMax;        this.yMax = yMax;        this.useLimitedFiringRate = useLimitedFiringRate;        // In general, the height and width of the base only need to depend        // on the game screen's size (xMin, xMax, yMin, yMax).        // I've chosen to make the base about the same size as the blocks,        // which is why the Block size dimensions are used below.        h = (9 * Block.getDimension()) / 10; // base height is 90% of block's        if (h > (yMax / 8))        {            h = yMax / 8;        }        w = h / 2;        y = (yMax - h) / 2;        x = xMin;        dCannon = h / 3;        xCannon = w;        yCannon = y + ((h - dCannon) / 2);        dy = h / 2;        dx = w;    }    public void tick()    {        if (collideTicks > 0)        {            collideTicks--;        }        if (cannonCoolDownTicks > 0)        {            cannonCoolDownTicks--;        }        if (gameActionUp)        {            // move up            if ((y - dy) >= yMin)            {                y -= dy;            }            else if ((y - (dy / 4)) >= yMin)            {                // use a smaller step near a boundary                y -= (dy / 4);            }        }        else if (gameActionDown)        {            // move down            if ((y + dy) <= (yMax - h))            {                y += dy;            }            else if ((y + (dy / 4)) <= (yMin - h))            {                // use a smaller step near a boundary                y += (dy / 4);            }        }        if (gameActionLeft)        {            // move left            if ((x - dx) >= xMin)            {                x -= dx;            }        }        if (gameActionRight)        {            // move right            if ((x + dx) <= (xMax - w - dCannon))            {                x += dx;            }        }        yCannon = y + ((h - dCannon) / 2);        xCannon = x + w;        // ticking of virtual millisecond clock        clockTickMillis++;        int millis = (clockTickMillis * GameManager.MILLIS_PER_TICK);        int seconds = millis / 1000;        boolean isNewSecondTick = false;        if (seconds > clockTickSeconds)        {            clockTickSeconds = seconds;            cannonFireRate = cannonFireCount / seconds;            isNewSecondTick = true;        }        if (gameActionFire)        {            if (!useLimitedFiringRate)            {                // There are no limits on firing the cannon. We may fire it.                int d = dCannon; // Bullet is d x d pixels                Bullet b = new Bullet(xCannon, xMax, yCannon, d, d, (2 * d));                gameManager.addBullet(b);            }            else            {                if (cannonCoolDownTicks == 0)                {                    // compute the cannon's firing rate and heat every second                    if (isNewSecondTick)                    {                        if (cannonFireRate >= MAX_CANNON_FIRE_RATE)                        {                            cannonHeat++;                        }                        else                        {                            if (cannonHeat > 0)                            {                                cannonHeat--;                            }                        }                    }                    if (cannonHeat > MAX_CANNON_HEAT)                    {                        // The cannon is overheating due to excessive                        // continuous firing, and will be cooled down                        // by setting cannonCoolDownTicks. It is not fired.                        cannonCoolDownTicks = MAX_CANNON_COOLDOWN_TICKS;                        cannonFireCount = 0;                        cannonHeat = 0;                        clockTickMillis = 0;                        clockTickSeconds = 0;                    }                    else                    {                        // We may fire the cannon.                        int d = dCannon; // Bullet is d x d pixels                        Bullet b = new Bullet(xCannon, xMax, yCannon,                                              d, d, (2 * d));                        gameManager.addBullet(b);                        cannonFireCount++;                    }                }                else                {                    // The cannon is cooling down, and can not be fired                    // until it has cooled down.                    if (isNewSecondTick)                    {                        reduceCannonHeat();                    }                }            }        }        else        {            // The player is not pressing the game fire action,            // we can cool down the cannon if needed.            if (useLimitedFiringRate && isNewSecondTick && (cannonHeat > 0))            {                reduceCannonHeat();            }        }    }    private void reduceCannonHeat()    {        if (cannonHeat > 0)        {            cannonHeat--;        }        if (cannonHeat == 0)        {            cannonFireCount = 0;            cannonFireRate = 0;            clockTickMillis = 0;            clockTickSeconds = 0;        }    }    int getCannonHeat()    {        return cannonHeat;    }    int getCannonCoolDownTicks()    {        return cannonCoolDownTicks;    }    void gameActionPressed(int action, boolean isPressed)    {        switch (action)        {            case Canvas.UP:                gameActionUp = isPressed;                break;            case Canvas.DOWN:                gameActionDown = isPressed;                break;            case Canvas.LEFT:                gameActionLeft = isPressed;                break;            case Canvas.RIGHT:                gameActionRight = isPressed;                break;            case Canvas.FIRE:                gameActionFire = isPressed;                break;        }    }    void draw(Graphics g)    {        g.setColor(COLOR);        // draw the body of the base        if (collideTicks > 0)        {            // 'Just collided'            // during the 'isColliding' state, we draw base's body            // as 'flashing' to indicate this state to the player            if ((collideTicks % 2) == 0)            {                // even tick: un-filled rectangle                g.drawRect(x, y, (w - 1), (h - 1));            }            else            {                // odd tick: filled rectangle                g.fillRect(x, y, w, h);            }        }        else        {            // 'Not colliding'            // use a filled rectangle with the default base color            g.fillRect(x, y, w, h);        }        // draw the cannon of the base        if (cannonCoolDownTicks > 0)        {            g.drawRect(xCannon, yCannon, dCannon - 1, dCannon - 1);        }        else        {            g.fillRect(xCannon, yCannon, dCannon, dCannon);        }    }    int getX()    {        return x;    }    int getY()    {        return y;    }    int getWidth()    {        return w;    }    int getCannonDimension()    {        return dCannon;    }    int getHeight()    {        return h;    }    int getLives()    {        if (lives < 0)        {            lives = 0;        }        return lives;    }    void doCollision()    {        lives--;        // For two seconds, the base is in a state of 'isColliding'.        // This is indicated by collideTicks > 0. collideTicks is decremented        // by method tick. During this state, new block collisions do not        // affect the base.        //        // This was done so that if the base is hit simultaneously by two        // blocks, that its life count is only decremented by one rather        // than by two.        //        // The base's draw method draws a 'flashing base' during the        // 'isColliding' state.        collideTicks = (2000 / GameManager.MILLIS_PER_TICK);    }    boolean isColliding()    {        return collideTicks > 0;    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品一区久久久久| www.久久精品| 99热这里都是精品| 亚洲色图欧美激情| 亚洲成人自拍网| 亚洲一区二区欧美激情| 风间由美中文字幕在线看视频国产欧美| 一区二区三区中文字幕在线观看| 视频一区二区三区入口| 国产精品一区二区在线观看网站| 成人黄色小视频| 欧美日韩你懂的| 亚洲综合小说图片| 国产91在线观看| 欧美写真视频网站| 亚洲午夜久久久久久久久电影网| 777奇米四色成人影色区| 亚洲日本免费电影| 久久久久久久久97黄色工厂| 精品国产91亚洲一区二区三区婷婷| www国产亚洲精品久久麻豆| 自拍偷拍国产精品| 欧美一区午夜精品| 91亚洲精品久久久蜜桃| 久久电影网站中文字幕| 午夜欧美一区二区三区在线播放| 亚洲欧美自拍偷拍| 中文欧美字幕免费| 欧美日韩精品一区二区三区蜜桃| 99久久精品国产毛片| 亚洲无线码一区二区三区| 精品噜噜噜噜久久久久久久久试看 | 日韩一区二区在线观看视频播放| 香蕉加勒比综合久久| 日韩欧美激情四射| 欧美成人性战久久| 91福利视频在线| 国产大片一区二区| 韩国视频一区二区| 精品一区二区成人精品| 午夜精品一区二区三区免费视频| 欧美一级xxx| 狠狠色丁香婷婷综合久久片| 日韩欧美国产精品| 91在线视频免费91| 国产精品国产三级国产| 久久成人av少妇免费| 欧美综合久久久| 蜜桃91丨九色丨蝌蚪91桃色| 日本一区二区三区国色天香| 欧美挠脚心视频网站| 蜜臀av性久久久久蜜臀aⅴ| 豆国产96在线|亚洲| 日产精品久久久久久久性色 | 99vv1com这只有精品| 亚洲成人动漫av| 国产日韩v精品一区二区| 欧美日韩国产一级片| 国产精品自拍三区| 激情综合网最新| 成人av影视在线观看| 国产精品亚洲专一区二区三区| 亚洲国产精品久久不卡毛片| 视频一区二区国产| 91福利视频网站| 欧美高清视频在线高清观看mv色露露十八| 国产欧美精品国产国产专区| 国产精品资源在线看| 国产精品丝袜一区| 亚洲欧美日韩国产成人精品影院| 欧美精品三级在线观看| 国产午夜精品久久| 国产91丝袜在线播放| 国产精品少妇自拍| 成人app软件下载大全免费| 亚洲欧洲成人av每日更新| 国产美女一区二区| 另类综合日韩欧美亚洲| 亚洲影视在线观看| 丝袜美腿成人在线| 国产综合久久久久久鬼色| 成人免费视频app| 精品伦理精品一区| 一区二区视频在线| 国产成人午夜精品5599| 色悠悠久久综合| 国产精品福利一区| 国产精品一区二区不卡| 色94色欧美sute亚洲13| 午夜精品免费在线观看| 成人晚上爱看视频| 亚洲另类中文字| 成人美女视频在线看| 亚洲毛片av在线| 欧美三区在线观看| 首页亚洲欧美制服丝腿| 日韩欧美二区三区| 亚洲综合精品自拍| 国产一区二区在线免费观看| 欧美精品一区二区三区很污很色的| 国产精品视频你懂的| 美女性感视频久久| 精品一区二区三区久久久| 日本精品免费观看高清观看| 尤物在线观看一区| 国产在线不卡视频| 欧美二区三区91| 国产精品高潮呻吟| 一本色道久久综合狠狠躁的推荐 | 日韩视频在线一区二区| 日本不卡视频在线| 中文字幕不卡在线| 欧美视频三区在线播放| 日韩电影在线观看一区| 精品91自产拍在线观看一区| 国产高清不卡一区二区| 亚洲欧美综合色| 精品久久久久99| 国产片一区二区| 91猫先生在线| 精品美女一区二区三区| 又紧又大又爽精品一区二区| 污片在线观看一区二区| 精品在线免费观看| 亚洲成a人片在线不卡一二三区 | 欧美日韩免费视频| 在线不卡中文字幕播放| 欧美一级日韩一级| 亚洲国产精品激情在线观看| 亚洲一区视频在线| 国产成人av在线影院| 亚洲超碰97人人做人人爱| 99视频国产精品| 午夜视频在线观看一区| 日韩精品中午字幕| 91官网在线免费观看| 欧美日韩国产影片| 欧洲国内综合视频| 欧美日韩国产首页在线观看| 欧美视频中文一区二区三区在线观看| 国产成人精品影视| 99久久久久免费精品国产| 91在线国产观看| 成人免费视频一区| 精品伦理精品一区| 色天使色偷偷av一区二区| 亚洲bdsm女犯bdsm网站| 亚洲综合免费观看高清完整版在线 | 国产精品羞羞答答xxdd| 午夜视频一区在线观看| 日韩专区一卡二卡| 亚洲综合在线免费观看| 日韩国产一二三区| 一区二区视频免费在线观看| 中文字幕一区二区三区不卡| 国产精品美女久久久久久久网站| 一区二区三区在线免费视频| 午夜免费欧美电影| 国产成人免费在线视频| 国产传媒一区在线| 日韩一区二区三区免费看| 日韩欧美在线1卡| 精品精品国产高清a毛片牛牛| 精品久久久久久久一区二区蜜臀| 91精品婷婷国产综合久久竹菊| 2021久久国产精品不只是精品| 亚洲欧美一区二区久久 | 岛国一区二区在线观看| 成人a级免费电影| 色婷婷av一区| 免费欧美在线视频| 国产精品久久久久久久蜜臀| 91精品办公室少妇高潮对白| 日韩欧美一区二区视频| 成人激情综合网站| 国产在线精品免费av| 欧美国产精品一区二区三区| 免费人成精品欧美精品 | 国产美女主播视频一区| 综合色中文字幕| 精品伦理精品一区| 3d动漫精品啪啪一区二区竹菊| 成人免费视频国产在线观看| 午夜亚洲福利老司机| 国产日韩精品一区| 精品国产一区二区三区四区四 | 国产一区不卡视频| 久久久久久免费网| 激情综合一区二区三区| 一区二区视频在线看| 91精品国产乱| 91色综合久久久久婷婷| 国内成人自拍视频| 亚洲一区二区在线免费看| 久久综合色8888| 正在播放亚洲一区| 成人免费视频caoporn| 亚洲视频一二三区| 欧美一区二区高清| 欧美日韩免费观看一区三区|