主页 > 知识库 > 网络编程 > JSP/Java >

JAVA打蜜蜂小游戏源码

来源:中国IT实验室 作者:佚名 发表于:2013-07-09 09:47  点击:
body SCRIPT LANGUAGE=JAVAScript var timerID = null; var patno = 1; var cr = \r\n; var spcf1 = ; var spcf2 = ; var spcf3 = ; var hitflag = 0; var score = 0; var selec = 0; var rsmiss = ; function array1(arn) { this.length = arn; for (var ar1
<body>  <SCRIPT LANGUAGE="JAVAScript">
  var timerID = null;
  var patno = 1;
  var cr = "\r\n";
  var spcf1 = "";
  var spcf2 = "";
  var spcf3 = "";
  var hitflag = 0;
  var score = 0;
  var selec = 0;
  var rsmiss = "";
  function array1(arn) {
  this.length = arn;
  for (var ar1 = 0; ar1 <= arn; ar1++) {
  this[ar1] = 1; }
  return this;
  }
  function init() {
  blankx = new array1(63);
  for (var makeblank = 0; makeblank < 63; makeblank++) {
  blankx[makeblank] = "";
  for (var addBlank = 0; addBlank < makeblank; addBlank++) {
  blankx[makeblank] = blankx[makeblank] + " ";
  }
  }
  faker = new array1(24);
  face = new array1(2);
  face[1] = " (O_O) ";
  face[2] = " (o_o) ";
  mestotal = new array1(4);
  interval1();
  }
  function restarter() {
  inplay = 0;
  blankno = 0;
  totalblank = "";
  lr = 1;
  lowerlf = "";
  downlf = "";
  downno = 0;
  missilex = 99;
  missiley = 99;
  mychrx = 1;
  myblank = "";
  mymove = 0;
  selec = 1;
  starter();
  }
  function starter() {
  document.fmark.win.value=cr+cr+cr+cr+cr+cr+cr+cr+cr+cr
  +"挨蜜蜂游戏"+cr+cr+cr
  +"请单击发射开端游戏";
  selec = 1;
  }
  function goleft() {
  mymove = 0;
  mychrx = mychrx - 1;
  if (mychrx <= 0) { mychrx = 1; }
  }
  function goright() {
  mymove = 0
  mychrx = mychrx + 1;
  if (mychrx >= 56) { mychrx = 55; }
  }
  function golmax() {
  if (inplay == 1) { mymove = -1; }
  }
  function gormax() {
  if (inplay == 1){ mymove = 1; }
  }
  function fire() {
  if (inplay == 0){ if (selec == 1){ selec = 9; inplay = 1; init(); }
  } else {
  if (missiley == 99){ missiley = 18; missilex = mychrx + 3; }
  }
  }
  function gameover() {
  score = 0;
  for (var enerme = 1; enerme < 25; enerme++) {
  if (faker[enerme] == 1){ score = score + 1; }
  }
  if (score == 0) {
  document.fmark.win.value = cr+cr+cr+cr+cr+cr+cr+cr
  +"                        Congratulations!"+cr+cr
  +"                          YOU STOPPED THE ENEMY SQUAD!!";
  } else {
  document.fmark.win.value=cr+cr+cr+cr+cr+cr+cr+cr
  +"                           GAME OVER"+cr+cr
  +"                   "+score+" INVADERS GOT THROUGH";
  }
  inplay = 0;
  }
  function interval1() {
  if (missiley != 99) { missiley = missiley - 1; }
  if (missiley < 0){ missiley = 99; }
  mychrx = mychrx + mymove;
  if (mychrx <= 0){ mychrx = 1; }
  if (mychrx >= 56){ mychrx = 55; }
  blankno = blankno + lr;
  totalblank = blankx[blankno];
  if (blankno >= 20) { lr = -1; downno = downno + 1; blankno = 20; }
  if (blankno <= 0) { lr = 1; downno = downno + 1; blankno = 0; }
  if (downno >= 12) { gameover(); }
  downlf = "";

有帮助
(0)
0%
没帮助
(0)
0%