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

📄 sevenyearitch$gamecanvas.java

📁 一款类似于扔砖头的游戏
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
import com.nokia.mid.sound.Sound;
import com.nokia.mid.ui.DirectGraphics;
import com.nokia.mid.ui.DirectUtils;
import com.nokia.mid.ui.FullCanvas;
import java.util.Random;
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class GameCanvas extends FullCanvas
{
  private final SevenYearItch this$0;

  public GameCanvas()
  {
    this.this$0 = paramSevenYearItch;
    try
    {
      paramSevenYearItch.bg = Image.createImage("/bg.png");
    }
    catch (Exception localException)
    {
    }
    paramSevenYearItch.intros.setGain(100);
    paramSevenYearItch.overs.setGain(100);
    paramSevenYearItch.sc.setGain(50);
    paramSevenYearItch.hurt.setGain(50);
    paramSevenYearItch.timerO += 1;
    paramSevenYearItch.go_matchopp = 0;
    paramSevenYearItch.ap = 2;
    paramSevenYearItch.bgx = 0;
    paramSevenYearItch.bgy = 0;
    paramSevenYearItch.kpuser_movesR = 2;
    paramSevenYearItch.user_x = -23;
    paramSevenYearItch.user_y = 72;
    paramSevenYearItch.opp_x = 27;
    paramSevenYearItch.opp_y = 9;
    paramSevenYearItch.oppmR = 1;
    paramSevenYearItch.posy = 18;
    paramSevenYearItch.posx = 0;
    paramSevenYearItch.tarR = 1;
    paramSevenYearItch.w = 128;
    paramSevenYearItch.h = 128;
    paramSevenYearItch.vessu = 0;
    paramSevenYearItch.vesso = 0;
    paramSevenYearItch.hit = 0;
    paramSevenYearItch.oppth = 0;
    paramSevenYearItch.opp_anim = 1;
    paramSevenYearItch.rand_g = 1;
    paramSevenYearItch.user_anim = 1;
    paramSevenYearItch.tar_anim = 3;
    paramSevenYearItch.opp_anim = 1;
    paramSevenYearItch.user_anim = 1;
    paramSevenYearItch.rand_g = 1;
    paramSevenYearItch.turn = 1;
    paramSevenYearItch.ccc = 0;
    paramSevenYearItch.abb = 0;
    paramSevenYearItch.vess = 0;
    paramSevenYearItch.sel_img_u = 2;
    paramSevenYearItch.sel_img_o = 2;
    paramSevenYearItch.lives = 5;
    paramSevenYearItch.lev = 1;
    paramSevenYearItch.fircount = 0;
    paramSevenYearItch.animflag = 0;
  }

  public void paint()
  {
    if (!(this.this$0.checkPause))
    {
      this.this$0.game = 1;
      DirectGraphics localDirectGraphics = DirectUtils.getDirectGraphics(paramGraphics);
      this.this$0.count += 1;
      if (this.this$0.start == 0)
      {
        paramGraphics.setColor(16711680);
        paramGraphics.fillRect(0, 0, this.this$0.w, this.this$0.h);
        if (this.this$0.sel == 0)
        {
          paramGraphics.setColor(16777215);
          paramGraphics.drawRect(20, 55, 35, 30);
          paramGraphics.setColor(0);
          paramGraphics.fillRect(20, 55, 35, 30);
        }
        else if (this.this$0.sel == 1)
        {
          paramGraphics.setColor(16777215);
          paramGraphics.drawRect(65, 55, 35, 29);
          paramGraphics.setColor(0);
          paramGraphics.fillRect(65, 55, 35, 29);
        }
        paramGraphics.drawImage(this.this$0.choose[2][0], 13, 57, 20);
        paramGraphics.drawImage(this.this$0.choose[3][0], 60, 56, 20);
        paramGraphics.setColor(16777215);
        paramGraphics.setFont(Font.getFont(0, 1, 8));
        paramGraphics.drawString("CHOOSE YOUR PLAYER", this.this$0.w / 2, 10, 17);
        paramGraphics.setColor(16777215);
        paramGraphics.setFont(Font.getFont(0, 1, 8));
        paramGraphics.drawString("Press 5 To Select", this.this$0.w / 2, 116, 17);
        paramGraphics.setColor(16777215);
        paramGraphics.setFont(Font.getFont(0, 1, 16));
        if (this.this$0.sel == 0)
          paramGraphics.drawString("Wife", this.this$0.w / 2, 90, 17);
        else
          paramGraphics.drawString("Husband", this.this$0.w / 2, 90, 17);
      }
      else
      {
        paramGraphics.drawImage(this.this$0.bg, this.this$0.bgx, this.this$0.bgy, 20);
        if (this.this$0.opp_anim == 1)
        {
          this.this$0.bbb = 0;
          if (this.this$0.opp_x >= 85)
          {
            this.this$0.opp_x = 85;
            this.this$0.oppmR = 0;
          }
          if (this.this$0.opp_x <= -14)
          {
            this.this$0.opp_x = -14;
            this.this$0.oppmR = 1;
          }
          this.this$0.timerR += 1;
          if (this.this$0.timerR % 20 == 0)
          {
            SevenYearItch.access$002(this.this$0, new Random());
            this.this$0.dran = (SevenYearItch.access$000(this.this$0).nextInt() % 2);
            if (this.this$0.dran < 0)
              this.this$0.dran *= -1;
            if ((this.this$0.dran == 0) && (this.this$0.opp_x == -14))
              this.this$0.dran = 1;
            else if ((this.this$0.dran == 1) && (this.this$0.opp_x == 85))
              this.this$0.dran = 0;
            else
              this.this$0.dran = this.this$0.dran;
          }
          else if (this.this$0.timerR == 250)
          {
            this.this$0.timerR = 0;
          }
          if (this.this$0.dran == 1)
            if (this.this$0.opp_x <= 86)
              this.this$0.opp_x += 1;
          else if ((this.this$0.dran == 0) && (this.this$0.opp_x > -16))
            this.this$0.opp_x -= 1;
          if (this.this$0.sel == 1)
            paramGraphics.drawImage(this.this$0.choose[2][0], this.this$0.opp_x, this.this$0.opp_y, 20);
          else if (this.this$0.sel == 0)
            paramGraphics.drawImage(this.this$0.choose[3][0], this.this$0.opp_x, this.this$0.opp_y, 20);
          if ((this.this$0.go_matchopp == 1) && (this.this$0.opp_blink != 1) && (this.this$0.usercnt <= 8))
            this.this$0.opp_thro = 1;
        }
        else if (this.this$0.opp_anim == 0)
        {
          paramGraphics.drawImage(this.this$0.choose[this.this$0.opponent][0], 200, 200, 20);
        }
        if (this.this$0.tar_anim == 1)
        {
          if (this.this$0.tarR == 1)
          {
            this.this$0.posx += 4;
            if (this.this$0.posx > 115)
            {
              this.this$0.posx = 115;
              this.this$0.tarR = 0;
            }
          }
          if (this.this$0.tarR == 0)
          {
            this.this$0.posx -= 4;
            if (this.this$0.posx < 0)
            {
              this.this$0.posx = 0;
              this.this$0.tarR = 1;
            }
          }
          if (this.this$0.tarR == 2);
          paramGraphics.drawImage(this.this$0.target, this.this$0.posx, this.this$0.posy, 20);
        }
        else if (this.this$0.tar_anim == 0)
        {
          paramGraphics.drawImage(this.this$0.target, this.this$0.posx, this.this$0.posy, 20);
        }
        else if (this.this$0.tar_anim == 2)
        {
          paramGraphics.drawImage(this.this$0.target, 140, 140, 20);
        }
        if (this.this$0.lev == 1)
        {
          this.this$0.timerO += 1;
          if (this.this$0.timerO % 140 == 0)
          {
            SevenYearItch.access$002(this.this$0, new Random());
            this.this$0.hran = (SevenYearItch.access$000(this.this$0).nextInt() % 50);
            if (this.this$0.hran < 0)
              this.this$0.hran *= -1;
            if ((this.this$0.hran <= 20) && (this.this$0.hran >= 0))
              this.this$0.hran += 20;
            else if ((this.this$0.hran >= 80) && (this.this$0.hran <= 128))
              this.this$0.hran -= 20;
            this.this$0.go_matchopp = 1;
            this.this$0.opp_anim = 1;
          }
          if (this.this$0.timerO == 1400)
            this.this$0.timerO = 0;
        }
        else if (this.this$0.lev == 2)
        {
          this.this$0.timerO += 1;
          if (this.this$0.timerO % 110 == 0)
          {
            SevenYearItch.access$002(this.this$0, new Random());
            this.this$0.hran = (SevenYearItch.access$000(this.this$0).nextInt() % 50);
            if (this.this$0.hran < 0)
              this.this$0.hran *= -1;
            if ((this.this$0.hran <= 20) && (this.this$0.hran >= 0))
              this.this$0.hran += 20;
            else if ((this.this$0.hran >= 80) && (this.this$0.hran <= 128))
              this.this$0.hran -= 20;
            this.this$0.go_matchopp = 1;
            this.this$0.opp_anim = 1;
          }
          if (this.this$0.timerO == 1100)
            this.this$0.timerO = 0;
        }
        else if (this.this$0.lev == 3)
        {
          this.this$0.timerO += 1;
          if (this.this$0.timerO % 70 == 0)
          {
            SevenYearItch.access$002(this.this$0, new Random());
            this.this$0.hran = (SevenYearItch.access$000(this.this$0).nextInt() % 50);
            if (this.this$0.hran < 0)
              this.this$0.hran *= -1;
            if ((this.this$0.hran <= 20) && (this.this$0.hran >= 0))
              this.this$0.hran += 20;
            else if ((this.this$0.hran >= 80) && (this.this$0.hran <= 128))
              this.this$0.hran -= 20;
            this.this$0.go_matchopp = 1;
            this.this$0.opp_anim = 1;
          }
          if (this.this$0.timerO == 700)
            this.this$0.timerO = 0;
        }
        else if (this.this$0.lev == 4)
        {
          this.this$0.timerO += 1;
          if (this.this$0.timerO % 40 == 0)
          {
            SevenYearItch.access$002(this.this$0, new Random());
            this.this$0.hran = (SevenYearItch.access$000(this.this$0).nextInt() % 50);
            if (this.this$0.hran < 0)
              this.this$0.hran *= -1;
            if ((this.this$0.hran <= 20) && (this.this$0.hran >= 0))
              this.this$0.hran += 20;
            else if ((this.this$0.hran >= 80) && (this.this$0.hran <= 128))
              this.this$0.hran -= 20;
            this.this$0.go_matchopp = 1;
            this.this$0.opp_anim = 1;
          }
          if (this.this$0.timerO == 400)
            this.this$0.timerO = 0;

⌨️ 快捷键说明

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