怪物联萌小游戏

欢迎来到程序小院

怪物联萌

玩法:将怪物连体,怪物只能直线上下左右移动,躲过障碍物,共16关卡,
不同关卡不同界面,遇到金币记得吃掉金币哦,会获得更高分数,快去闯关吧^^。

开始游戏icon-default.png?t=N7T8https://www.ormcc.com/play/gameStart/264

怪物联萌小游戏_第1张图片

html


css

body,html {
  margin: 0;
  padding: 0; 
  background-color: #fff;
  height: 100%;
  width: 100%;
  display:block;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#canvas {
    background-color: #fff;
    margin: 0;
    padding: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -172px;
    margin-left: -160px;
    z-index: 1;
}

js

function isArrayContains(e, t) {
 return -1 < e.indexOf(t)
}
function y185(e, t) {
 e.cacheCanvas = t.cacheCanvas;
 e.cacheID = t.cacheID;
 e._cacheWidth = t._cacheWidth;
 e._cacheHeight = t._cacheHeight;
 e._cacheOffsetX = t._cacheOffsetX;
 e._cacheOffsetY = t._cacheOffsetY;
 e._cacheScale = t._cacheScale
}
function y96(e) {
 isLevelEditor && console.log(e)
}
function y506(e) {
 e.scaleX = e.scaleY = 1.2 * y164 * (e.defaultScale ? e.defaultScale : 1)
}
function y380(e) {
 e.scaleX = e.scaleY = y164 * (e.defaultScale ? e.defaultScale : 1)
}
function y206(e) {
 e.parent && e.parent.removeChild(e)
}
function y110(e, t) {
 y206(e);
 t && t.addChild(e)
}
function y110WithIndex(e, t, n) {
 y206(e);
 t && t.addChildAt(e, n)
}
function setSpriteScale(e, t) {
 e.scaleX = e.scaleY = t
}
function y124(e, t, n, r) {
 r.text != n && (r.text = n, n = r.getBounds(), r.x = e - (n.width >> 1) * r.scaleX, 
  t && (r.y = t - (40 >> 1) * r.scaleY))
}
function setAnimationSpeed(e, t) {
 e._animation.speed = t
}
function setNextAnimation(e, t) {
 e._animation.next = t
}
function randomizeAnimFrame(e) {
 e.currentAnimationFrame = Math.floor(30 * Math.random())
}
function createReverseAnim(e, t) {
 var n = REVERSE_y287 + t;
 if (!e.getAnimation(n)) {
  for (var r = e.getAnimation(t), i = {
    name: n,
    next: r.next,
    speed: r.speed,
    frames: []
   }, s = r.frames.length - 1; 0 <= s; s--) i.frames.push(r.frames[s]);
  e._animations.push(n);
  e._data[n] = i
 }
}
function playReverseAnim(e, t) {
 e.gotoAndPlay(REVERSE_y287 + t)
}
function y306() {
 y328 = y481(160, 322, .8, sponsorLogoFrame, y254, null, null)
}
function y379(e, t, n, r, i, s, o, u, a) {
 y328 || y306();
 y110(y328, r);
 n *= .7;
 y139 = t;
 y502 = e + 10;
 y83 = s;
 y108 = o;
 y328.scaleX = y328.scaleY = n;
 y328.alpha = i ? i : 1;
 y78 = u;
 y147();
 (e = y355.getAnimation(sponsorLogoFrame)) && e.frames && 0 < e.frames.length && (e = 
  y355.getFrameBounds(e.frames[0]), y328.setBoundingBox(e.x * n, e.y * n, e.width * n,
  e.height * n))
}
function y147() {
 y328 && (y328.x = y502, y328.y = y139, y83 === y93 ? y328.x += y170() : y83 === y232 && (
  y328.x -= y170()), y108 === y280 ? y328.y += y199() / y78 : y108 === y73 && (y328.y -= 
  y199() / y78))
}
function startSponsorAds() {
 sponsorApi && (isAdPauseSoundMuted = isMute, sponsorApi.GameBreak.request(onAdBeginPause,
  onAdEndUnpause))
}
function onAdBeginPause() {
 y96("ad pause, , sound is muted: " + isMute);
 isAdPauseSoundMuted = isMute;
 isMute = !0;
 stopBgMusic()
}
function onAdEndUnpause() {
 y96("ad unpause, sound was muted: " + isAdPauseSoundMuted);
 (isMute = isAdPauseSoundMuted) || y452()
}
function initParticleManager() {
 y497.addChild(y262)
}
function setParticlesToFront() {
 y110(y262, y497)
}
function y53Explode(e, t, n, r, i, s) {
 for (var o, u = 0; u < n; u++) {
  o = u * (2 * Math.PI / n);
  partSin = Math.cos(o);
  partCos = Math.sin(o);
  o = y53(r, e, t, 1, i ? i : y262);
  if (!o) break;
  setParticleParamsByIndex(o, s ? s : 0)
 }
}
function setParticleParamsByIndex(e, t) {
 var n = 1.3;
 e.y14 = 0;
 e.y11 = 20 * Math.random();
 0 === t ? (e.maxScale = .7, e.y37 = .2 * FPS, partScale = .2 + .2 * Math.random()) : 1 
  === t ? (n = 4, e.maxScale = 1.3, e.y37 = .3 * FPS, e.y14 = 0, e.y11lpha = .05, e.y11 = 
  20 * Math.random(), partScale = .4 + .6 * Math.random()) : 2 === t && (n = 2, e.maxScale 
  = 1.3, e.vis.alpha = 1, e.y37 = .3 * FPS, e.y11 = 20 * Math.random(), partScale = 
  .4 + .6 * Math.random());
 e.vis.scaleX = e.vis.scaleY = partScale;
 e.y9 = (n + Math.random() * n) * partCos;
 e.y10 = (n + Math.random() * n) * partSin
}
function createDiePart(e, t) {
 var n = y53(y509, e, t, 1, y262);
 n && (n.y38(11), n.y39("deathanimv", !0), n.y11lpha = .05, n.y37 = 1.5 * FPS, n.y9 = 
  0, n.y10 = -1, n.y11 = 0)
}
function createGoodPlayExplode(e, t) {
 for (var n, r = 0 == t ? 90 : -120, i = 0; 8 > i; i++) {
  var s = i * (Math.PI / 2 / 8) - Math.PI / 4;
  0 < t && (s += Math.PI);
  var o = Math.cos(s),
   s = Math.sin(s);
  n = .2 + .2 * Math.random();
  n = y53(y160, r, 0, n, monsterCont);
  if (!n) break;
  n.y39("particle1v");
  n.y11lpha = .1;
  n.y34 = .02;
  n.vis.visible = !1;
  n.y37 = .5 * FPS;
  n.maxScale = .6;
  n.y9 = (1.5 + 1.5 * Math.random()) * o;
  n.y10 = (1.5 + 1.5 * Math.random()) * s;
  n.y11 = 20 * Math.random()
 }
}
function y292(e, t, n) {
 if (e = y53(y509, e, t, .8, y262)) e.y38(n), e.y37 = .2 * FPS, e.y9 = 0, e.y10 = -.8, 
  e.y11 = 0
}
function createGlassExplode(e, t) {
 for (var n, r = e, i = t, s = 0; 4 > s; s++) {
  switch (s) {
   case 0:
    r = e - 10;
    i = t - 30;
    break;
   case 1:
    r = e + 10;
    i = t - 30;
    break;
   case 2:
    r = e - 10;
    i = t - 10;
    break;
   case 3:
    r = e + 10, i = t - 10
  }
  n = y53(PART_GLASS_TYPE, r, i, 1, y262);
  if (!n) break;
  n.y14 = 0;
  n.maxScale = 0;
  n.y14 = 0;
  n.y11lpha = .08;
  n.y34 = -.08;
  n.isReverse = !0;
  partScale = 1;
  n.vis.scaleX = n.vis.scaleY = partScale;
  n.y11 = 30 * Math.random() - 15;
  n.y9 = 1.3 - 2.6 * Math.random();
  n.y10 = 1.3 - 2.6 * Math.random()
 }
}
function y456() {
 var e = y53(y509, 160, topVisionLine + y52 / 2, 1, y262);
 e && (e.y38(11), e.y11lpha = 1, e.y37 = 1.5 * FPS, e.y9 = 0, e.y10 = 0, e.y11 = 0, 
  e.vis.rotation = -360, e.vis.scaleX = e.vis.scaleY = .1, createjs.Tween.get(e.vis, {
  override: !0
 }).to({
  rotation: 0,
  scaleX: 1,
  scaleY: 1
 }, 600).wait(600).to({
  alpha: 0
 }, 200))
}
function createAchievPart(e) {
 for (var t = 210, n = 10, r = 0, i, s = 0; s < y311.length; s++) i = y311[s], i.type === 
  PART_ACHIEV_TYPE && (t = i.vis.y - 50, n += 200, r++);
 if (i = y53(PART_ACHIEV_TYPE, -130, t, .8, y497)) i.y39("achievdesc" + e), i.y11lpha = 
  1, i.y37 = 3.2 * FPS + .2 * r, i.y9 = 0, i.y10 = 0, i.y11 = 0, i.vis.rotation = 0, 
  i.vis.scaleX = i.vis.scaleY = .7, i.vis.alpha = 1, createjs.Tween.get(i.vis, {
  override: !0
 }).wait(n).to({
  x: 5
 }, 600, y244).wait(2e3).to({
  x: -130
 }, 400, createjs.Ease.sineIn)
}
function y53(e, t, n, r, i) {
 var s;
 y311Lenght = y311.length;
 if (y311Lenght > y454) {
  for (var o = 0; o < y311Lenght; o++)
   if (y311[o].type === y160) {
    s = y311[o];
    break
   }
  s || (s = y311[0]);
  s.reset(e, i, r)
 } else s = y453(e, i, r);
 s.setPos(t, n);
 isArrayContains(y311, s) || y311.push(s);
 return s
}
function y134(e) {
 isArrayContains(disposedParts, e) || disposedParts.push(e)
}
function y453(e, t, n) {
 if (0 < disposedParts.length) {
  var r = disposedParts.pop();
  r.reset(e, t, n);
  return r
 }
 return new y513(e, t, n)
}
function y195() {
 y56 = y311.length;
 for (var e = 0; e < y56; e++) y342 = y311[e], y342.tick(), y342.isNeedDispose && 
  disposeNeededParts.push(y342);
 for (; 0 < disposeNeededParts.length;) disposeNeededParts.pop().dispose()
}
function initField() {
 ROW_FIELD_END = FIELD_ROWS - ROWS_MARGIN - 1;
 CELL_FIELD_END = FIELD_CELLS - CELLS_MARGIN - 1;
 shadowContainer = new createjs.Container;
 y497.addChild(shadowContainer);
 y390 = new createjs.Container;
 y497.addChild(y390);
 for (var e = 0; e < FIELD_CELLS; e++) {
  for (var t = [], n = 0; n < FIELD_ROWS; n++) t.push(BLOCK_SPACE_TYPE);
  map.push(t)
 }
}
function createBlock(e, t, n, r) {
 disposeBlockAt(t, n);
 e == BLOCK_SPACE_TYPE ? map[t][n] = BLOCK_SPACE_TYPE : (r || (r = "defB" + t + "r" + n),
  e = getBlockFromPool(e, y390, r), e.setPos(getXByCell(t), getYByRow(n)), 
  e.setIndex(t, n), e.rememberPos(), isArrayContains(allBlocks, e) || allBlocks.push(e), 
  map[t][n] = e, isHero(e) && (findFriends(e), allHeroes.push(e)))
}
function getBlockFromPool(e, t, n) {
 if (0 < disposedBlocks.length) {
  var r = disposedBlocks.pop();
  r.reset(e, t, n);
  return r
 }
 return new BaseBlock(e, t, n)
}
function disposeBlockAt(e, t) {
 var n = getBlockAt(e, t);
 n && n != BLOCK_SPACE_TYPE && n.dispose()
}
function y201(e) {
 isArrayContains(disposedBlocks, e) || disposedBlocks.push(e)
}
function deleteBlockFromMap(e) {
 map[e.cell][e.row] == e && (map[e.cell][e.row] = BLOCK_SPACE_TYPE)
}
function getXByCell(e) {
 return (e + 1 - CELLS_MARGIN) * CELL_SIZE + MARGIN_LEFT - CELL_SIZE / 2
}
function getYByRow(e) {
 return (e + 1 - ROWS_MARGIN) * CELL_SIZE + MARGIN_TOP
}
function getLevelCode() {
 for (var e = [], t = 0; t < FIELD_CELLS; t++) {
  for (var n = [], r = 0; r < FIELD_ROWS; r++) {
   var i = map[t][r];
   i == BLOCK_SPACE_TYPE ? n.push(BLOCK_SPACE_TYPE) : n.push(i.type)
  }
  e.push(n)
 }
 e.push(getBonusCode());
 return e
}
function y192ByCode(e) {
 isLevelLoading = !0;
 disposeLevel();
 addInstructions();
 lightsV.visible = !0;
 isShadowDisabled || (shadowContainer.visible = !0);
 for (var t = 0; t < FIELD_CELLS; t++)
  for (var n = e[t], r = 0; r < FIELD_ROWS; r++) {
   var i = n[r]; - 1 < i && createBlock(i, t, r)
  }
 loadBonusesByCode(e[FIELD_CELLS]);
 y275();
 isLevelLoading = !1;
 setCloudsVisibility(!0)
}
function disposeLevel() {
 disposeMinigame();
 disposeInstructions();
 for (var e = allBlocks.length, t = 0; t < e; t++) allBlocks.pop().dispose();
 allHeroes = [];
 headHero = null;
 isDangerCollided = isLevelCompleted = isHeroMoving = !1;
 levelCollectedStarsNum = levelTotalStarsNum = 0;
 disposeBonuses();
 isOldButtonActivated = !1
}
function y192(e) {
 y50 = e;
 y50 >= y115.length && (y50 = y115.length - 1);
 setBgByLevel(y50, !1);
 IsMinigameLevel(y50) ? loadMinigame(y50) : y192ByCode(y115[y50]);
 setParticlesToFront();
 showIngameSponsorLogo();
 isGamePaused = !1
}
function y507() {
 isDisableWin ? rey192FromEditor() : y192(y50)
function y131() {
 y50++;
 y50 >= y115.length && (y50 = 0);
 y192(y50)
}
function y275() {
 y390.sortChildren(zOrderSortFunction)
}
function zOrderSortFunction(e, t) {
 if (e.isFullTop && !t.isFullTop) return 1;
 if (!e.isFullTop && t.isFullTop) return -1;
 if (e.isFullTop && t.isFullTop) {
  if (e.zIndex > t.zIndex) return 1;
  if (e.zIndex < t.zIndex) return -1
 }
 return e.baseBlock.row < t.baseBlock.row ? -1 : e.baseBlock.row > t.baseBlock.row ? 
  1 : e.isOnBottom && !t.isOnBottom ? -1 : !e.isOnBottom && t.isOnBottom ? 
  1 : !e.isOnTop && t.isOnTop ? -1 : e.isOnTop && !t.isOnTop ? 1 : 0
}
function SearchMovePath(e, t) {
 var n = 100,
  r, i;
 lastDir = t;
 e.oldFriendsNum = e.friends.length;
 if (t == DIR_LEFT || t == DIR_RIGHT) {
  for (var n = SearchMininumStepsHoriz(e, t, n), s = 0; s < e.friends.length; s++) r = 
    e.friends[s], n = SearchMininumStepsHoriz(r, t, n);
  i = StepHorizByDir(e.cell, t, n);
  updateStarsCollectionStatus(n);
  if (0 > i || i > FIELD_CELLS - 1) {
   e.deadMove(t);
   return
  }
  if (i == e.cell) lastDir = -1, isHeroMoving = !1, e.restorePosWithFriends();
  else {
   for (s = 0; s < e.friends.length; s++) {
    r = e.friends[s];
    var o = StepHorizByDir(r.cell, t, n);
    relocate(r, o, r.row)
   }
   e.move(i, e.row, getXByCell(i), getYByRow(e.row));
   playLaunchSound()
  }
 } else if (t == DIR_UP || t == DIR_BOTTOM) {
  n = SearchMininumStepsVert(e, t, n);
  for (s = 0; s < e.friends.length; s++) r = e.friends[s], n = SearchMininumStepsVert(
    r, t, n);
  i = StepVertByDir(e.row, t, n);
  updateStarsCollectionStatus(n);
  if (0 > i || i > FIELD_ROWS - 1) {
   e.deadMove(t);
   return
  }
  if (i == e.row) lastDir = -1, isHeroMoving = !1, e.restorePosWithFriends();
  else {
   for (s = 0; s < e.friends.length; s++) r = e.friends[s], o = StepVertByDir(
      r.row, t, n), relocate(r, r.cell, o);
   e.move(e.cell, i, getXByCell(e.cell), getYByRow(i));
   playLaunchSound()
  }
 }
 resetStarsCollectionSteps()
}
function SearchMininumStepsVert(e, t, n) {
 if (!isNextVertAreFriend(e, t)) {
  t = SearchLastFreeRow(e, t);
  e = Math.abs(t - e.row);
  if (t < ROWS_MARGIN || t > ROW_FIELD_END) e = 100;
  if (e < n) return e
 }
 return n
}
function isNextVertAreFriend(e, t) {
 var n = StepVertByDir(e.row, t, 1);
 return (n = getBlockAt(e.cell, n)) ? isHero(n) : !1
}
function SearchLastFreeRow(e, t) {
 var n = StepVertByDir(e.row, t, 1),
  r = 1;
 for (checkStarCollide(r, e.cell, n); IsFreeOrFriend(e, e.cell, n);) n = StepVertByDir(
  n, t, 1), r += 1, checkStarCollide(r, e.cell, n); - 1 < n && n < FIELD_ROWS && (
  n = StepVertByDir(n, t, -1));
 return n
}

源码

需要源码请关注添加好友哦^ ^

转载:欢迎来到本站,转载请注明文章出处https://ormcc.com/

怪物联萌小游戏_第2张图片

你可能感兴趣的:(H5小游戏,前端,javascript,css,开发语言,游戏)