⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamecanvas.java

📁 j2me游戏代码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                drawWindow();
                drawReady();
                drawClock();
            } else
            if(nGame == GAME_PLAY)
            {
                drawBG();
                if(!bMove)
                {
                    drawWindow();
                    if(!bAMap[nX][nY] || !bAKiller[nX][nY] && nChar < 3)
                        drawTarget();
                } else
                {
                    nChar = 0;
                }
                if(bTarget)
                    drawHole();
                drawClock();
                if(bMap)
                    drawMap();
            } else
            if(nGame == GAME_SUC || nGame == GAME_FAIL)
                drawEnd();
            else
            if(nGame == GAME_OVER)
            {
                drawBG();
                drawWindow();
                if(bTarget)
                    drawHole();
                drawClock();
                GameCanvas _tmp = this;
                GameCanvas _tmp1 = this;
                gx.drawImage(gameMain.gameImg.bang, 64, 50, 0x1 | 0x10);
                gx.setColor(255, 0, 0);
                GameCanvas _tmp2 = this;
                GameCanvas _tmp3 = this;
                gx.drawString("Oh No!", 54, 70, 0x1 | 0x10);
                if(bMap)
                    drawMap();
            }
            bPaint = true;
            bMove = false;
        }
    }

    private void drawIni()
    {
        for(int i = 0; i < 17; i++)
        {
            for(int j = 0; j < 16; j++)
            {
                GameCanvas _tmp = this;
                GameCanvas _tmp1 = this;
                gx.drawImage(gameMain.gameImg.bg_1, i * 8, j * 8, 0x4 | 0x10);
            }

        }

        gx.setColor(255, 160, 0);
        gx.fillRect(25, 36, 79, 63);
        gx.setColor(122, 122, 255);
        gx.fillRect(10, 1, 100, 30);
        GameCanvas _tmp2 = this;
        GameCanvas _tmp3 = this;
        gx.drawImage(gameMain.gameImg.arrow_1, 51, 21, 0x4 | 0x10);
        GameCanvas _tmp4 = this;
        GameCanvas _tmp5 = this;
        GameCanvas _tmp6 = this;
        dg.drawImage(gameMain.gameImg.arrow_1, 41, 21, 0x4 | 0x10, 8192);
        gx.setColor(255, 255, 254);
        gx.fillRect(24, 104, 80, 10);
        gx.setColor(0);
        GameCanvas _tmp7 = this;
        GameCanvas _tmp8 = this;
        gx.drawString("Press 5 to start", 64, 105, 0x1 | 0x10);
        gx.fillRect(37, 43, 57, 10);
        gx.fillRect(37, 56, 57, 10);
        gx.fillRect(37, 69, 57, 10);
        gx.fillRect(37, 82, 57, 10);
        gx.setColor(192, 192, 192);
        gx.drawRect(37, 42, 56, 11);
        gx.drawRect(37, 55, 56, 11);
        gx.drawRect(37, 68, 56, 11);
        gx.drawRect(37, 81, 56, 11);
        gx.setColor(254, 255, 255);
        GameCanvas _tmp9 = this;
        GameCanvas _tmp10 = this;
        gx.drawString("Exercise", 40, 44, 0x4 | 0x10);
        GameCanvas _tmp11 = this;
        GameCanvas _tmp12 = this;
        gx.drawString("Easy", 40, 57, 0x4 | 0x10);
        GameCanvas _tmp13 = this;
        GameCanvas _tmp14 = this;
        gx.drawString("Normal", 40, 70, 0x4 | 0x10);
        GameCanvas _tmp15 = this;
        GameCanvas _tmp16 = this;
        gx.drawString("Hard", 40, 83, 0x4 | 0x10);
        gx.setColor(255, 0, 0);
        switch(nLevel)
        {
        case 0: // '\0'
            gx.drawRect(37, 42, 56, 11);
            break;

        case 1: // '\001'
            gx.drawRect(37, 55, 56, 11);
            break;

        case 2: // '\002'
            gx.drawRect(37, 68, 56, 11);
            break;

        case 3: // '\003'
            gx.drawRect(37, 81, 56, 11);
            break;
        }
        switch(nGun)
        {
        case 0: // '\0'
            GameCanvas _tmp17 = this;
            GameCanvas _tmp18 = this;
            gx.drawImage(gun1, 60, 2, 0x1 | 0x10);
            break;

        case 1: // '\001'
            GameCanvas _tmp19 = this;
            GameCanvas _tmp20 = this;
            gx.drawImage(gun2, 60, 2, 0x1 | 0x10);
            break;

        case 2: // '\002'
            GameCanvas _tmp21 = this;
            GameCanvas _tmp22 = this;
            gx.drawImage(gun3, 60, 2, 0x1 | 0x10);
            break;
        }
    }

    private void drawShow()
    {
        for(int i = 0; i < 17; i++)
        {
            for(int j = 0; j < 16; j++)
            {
                GameCanvas _tmp = this;
                GameCanvas _tmp1 = this;
                gx.drawImage(gameMain.gameImg.bg_1, i * 8, j * 8, 0x4 | 0x10);
            }

        }

        GameCanvas _tmp2 = this;
        GameCanvas _tmp3 = this;
        gx.drawImage(gameMain.gameImg.baby, 42, 10, 0x1 | 0x10);
        GameCanvas _tmp4 = this;
        GameCanvas _tmp5 = this;
        gx.drawImage(gameMain.gameImg.grandma, 84, 10, 0x1 | 0x10);
        gx.setColor(254, 255, 255);
        gx.fillRect(18, 80, 92, 20);
        gx.setColor(0);
        GameCanvas _tmp6 = this;
        GameCanvas _tmp7 = this;
        gx.drawString("DON'T SHOOT!", 64, 85, 0x1 | 0x10);
        gx.drawRect(18, 80, 92, 20);
    }

    private void drawBG()
    {
        gx.setColor(254, 255, 255);
        gx.drawLine(0, 111, 0, 128);
        gx.drawLine(0, 111, 128, 111);
        gx.setColor(128, 192, 255);
        gx.fillRect(1, 112, 126, 15);
        gx.setColor(0, 128, 255);
        gx.drawLine(0, 128, 128, 128);
        gx.drawLine(128, 111, 128, 128);
        GameCanvas _tmp = this;
        GameCanvas _tmp1 = this;
        gx.drawImage(gameMain.gameImg.map, 4, 114, 0x4 | 0x10);
        GameCanvas _tmp2 = this;
        GameCanvas _tmp3 = this;
        gx.drawImage(gameMain.gameImg.clock_1, 32, 113, 0x4 | 0x10);
        GameCanvas _tmp4 = this;
        GameCanvas _tmp5 = this;
        gx.drawImage(gameMain.gameImg.enemy_1, 76, 114, 0x4 | 0x10);
        GameCanvas _tmp6 = this;
        GameCanvas _tmp7 = this;
        gx.drawImage(gameMain.gameImg.bg_2, 0, 0, 0x4 | 0x10);
        GameCanvas _tmp8 = this;
        GameCanvas _tmp9 = this;
        gx.drawImage(gameMain.gameImg.bullet_2, 2, 2, 0x4 | 0x10);
        GameCanvas _tmp10 = this;
        GameCanvas _tmp11 = this;
        gx.drawImage(gameMain.gameImg.no[nBullet / 10], 15, 2, 0x4 | 0x10);
        GameCanvas _tmp12 = this;
        GameCanvas _tmp13 = this;
        gx.drawImage(gameMain.gameImg.no[nBullet % 10], 23, 2, 0x4 | 0x10);
    }

    private void drawWindow()
    {
        gx.setColor(254, 255, 255);
        gx.fillRect(23, 30, 82, 67);
        if(bAMap[nX][nY])
            if(bAKiller[nX][nY])
            {
                if(nChar == 0)
                {
                    GameCanvas _tmp = this;
                    GameCanvas _tmp1 = this;
                    gx.drawImage(gameMain.gameImg.girl, 34 + nTarget * 30, 35, 0x1 | 0x10);
                } else
                if(nChar == 1)
                {
                    GameCanvas _tmp2 = this;
                    GameCanvas _tmp3 = this;
                    gx.drawImage(gameMain.gameImg.killer_1, 34 + nTarget * 30, 35, 0x1 | 0x10);
                } else
                if(nChar == 2)
                {
                    GameCanvas _tmp4 = this;
                    GameCanvas _tmp5 = this;
                    gx.drawImage(gameMain.gameImg.killer_2, 34 + nTarget * 30, 35, 0x1 | 0x10);
                }
                if(gameMain.gameTimer.count % 4 == 0)
                {
                    GameCanvas _tmp6 = this;
                    GameCanvas _tmp7 = this;
                    gx.drawImage(gameMain.gameImg.target[0], 34 + nTarget * 30, 50, 0x1 | 0x10);
                } else
                if(gameMain.gameTimer.count % 4 == 1)
                {
                    GameCanvas _tmp8 = this;
                    GameCanvas _tmp9 = this;
                    gx.drawImage(gameMain.gameImg.target[1], 34 + nTarget * 30, 50, 0x1 | 0x10);
                } else
                if(gameMain.gameTimer.count % 4 == 2)
                {
                    GameCanvas _tmp10 = this;
                    GameCanvas _tmp11 = this;
                    gx.drawImage(gameMain.gameImg.target[2], 34 + nTarget * 30, 50, 0x1 | 0x10);
                } else
                if(gameMain.gameTimer.count % 4 == 3)
                {
                    GameCanvas _tmp12 = this;
                    GameCanvas _tmp13 = this;
                    gx.drawImage(gameMain.gameImg.target[3], 34 + nTarget * 30, 50, 0x1 | 0x10);
                }
            } else
            if(nChar == 3)
            {
                GameCanvas _tmp14 = this;
                GameCanvas _tmp15 = this;
                gx.drawImage(gameMain.gameImg.baby, 34 + nTarget * 30, 35, 0x1 | 0x10);
            } else
            if(nChar == 4)
            {
                GameCanvas _tmp16 = this;
                GameCanvas _tmp17 = this;
                gx.drawImage(gameMain.gameImg.grandma, 34 + nTarget * 30, 35, 0x1 | 0x10);
            } else
            if(nChar == 5)
            {
                GameCanvas _tmp18 = this;
                GameCanvas _tmp19 = this;
                gx.drawImage(gameMain.gameImg.baby, 34 + nTarget * 30, 35, 0x1 | 0x10);
            } else
            {
                gx.setColor(10, 255, 10);
                GameCanvas _tmp20 = this;
                GameCanvas _tmp21 = this;
                gx.drawString("Empty", 64, 50, 0x1 | 0x10);
            }
        GameCanvas _tmp22 = this;
        GameCanvas _tmp23 = this;
        gx.drawImage(gameMain.gameImg.bg_3, 0, 0, 0x4 | 0x10);
        if(bAMap[nX][nY])
            if(bAKiller[nX][nY])
            {
                gx.setColor(0);
                if(nShoot == 0)
                {
                    if((nTY -= nPlus) <= 23)
                        nTY = 96;
                    gx.drawLine(0, nTY, 120, nTY);
                } else
                if(nShoot == 1)
                {
                    if((nTX += nPlus) >= 105)
                        nTX = 23;
                    gx.drawLine(0, nTY, 120, nTY);
                    gx.drawLine(nTX, 0, nTX, 110);
                }
            } else
            if(nChar == 3 || nChar == 4 || nChar == 5)
            {
                if(bBullet)
                {
                    GameCanvas _tmp24 = this;
                    GameCanvas _tmp25 = this;
                    gx.drawImage(gameMain.gameImg.bullet_1, 34 + nTarget * 30, 80, 0x1 | 0x2);
                }
                gx.setColor(0);
                if(nShoot == 0)
                {
                    if((nTY -= nPlus) <= 13)
                        nTY = 96;
                    gx.drawLine(0, nTY, 120, nTY);
                } else
                if(nShoot == 1)
                {
                    if((nTX += nPlus) >= 105)
                        nTX = 23;
                    gx.drawLine(0, nTY, 120, nTY);
                    gx.drawLine(nTX, 0, nTX, 110);
                }
            }
        GameCanvas _tmp26 = this;
        GameCanvas _tmp27 = this;
        gx.drawImage(gameMain.gameImg.bullet_2, 2, 2, 0x4 | 0x10);
        GameCanvas _tmp28 = this;
        GameCanvas _tmp29 = this;
        gx.drawImage(gameMain.gameImg.no[nBullet / 10], 15, 2, 0x4 | 0x10);
        GameCanvas _tmp30 = this;
        GameCanvas _tmp31 = this;
        gx.drawImage(gameMain.gameImg.no[nBullet % 10], 23, 2, 0x4 | 0x10);
        if(bAMap[nX][nY] && bAKiller[nX][nY] && nGame != GAME_OVER)
        {
            gx.setColor(50 + gameMain.gameTimer.count * 4, 0, 200 - gameMain.gameTimer.count * 4);
            if(nChar == 0)
                gx.fillRect(120, 2, 6, 41 - gameMain.gameTimer.count);
            else
            if(nChar == 1)
                gx.fillRect(120, 2, 6, 31 - gameMain.gameTimer.count);
            else
            if(nChar == 2)
                gx.fillRect(120, 2, 6, 51 - gameMain.gameTimer.count);
        }
    }

    private void drawReady()
    {
        gx.setColor(10, 255, 10);
        GameCanvas _tmp = this;
        GameCanvas _tmp1 = this;
        gx.drawString("Ready", 64, 50, 0x1 | 0x10);
    }

    private void setKiller()
    {
        boolean flag = false;
        if(nLevel == 0)
        {
            int i = random.nextInt() % 25;
            if(i < 0)
                i = -i;
            bAKiller[i / 5][i % 5] = true;
        } else
        {
            for(int k = 0; k < nWindow;)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -