欢迎来到程序小院
八爪鱼拉拉手
玩法:点击鼠标左键拖动移动八爪鱼,当他的手很忙的时候他会很高兴,
不同关卡不同的八爪鱼的位置摆放,快去闯关吧^^。
开始游戏https://www.ormcc.com/play/gameStart/248
html
<div id="gameContainer"></div>
<div id="orientation"></div>
css
#orientation {
margin: 0 auto;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url(../assets/graphics/rotate-phone.png);
background-repeat: no-repeat;
background-position: center;
background-color: #fff;
z-index: 999;
display: none;
}
@font-face {
font-family: 'GrilledCheeseBTNToasted';
font-style: normal;
font-weight: normal;
src: local('GrilledCheeseBTNToasted'),
url('../assets/fonts/GrilledCheeseBTNToasted.woff') format('woff');
}
js
function onLoad() {
new game.Main
}
var game; !
function(t) {
var e = function() {
function t() {}
return t.GAME_WIDTH = 640,
t.GAME_HEIGHT = 832,
t.HALF_GAME_WIDTH = .5 * t.GAME_WIDTH,
t.HALF_GAME_HEIGHT = .5 * t.GAME_HEIGHT,
t.LEVELS_NUM = 60,
t
} ();
t.Config = e
} (game || (game = {}));
var __extends = this.__extends ||
function(t, e) {
function i() {
this.constructor = t
}
for (var a in e) e.hasOwnProperty(a) && (t[a] = e[a]);
i.prototype = e.prototype,
t.prototype = new i
},
game; !
function(t) {
var e = function(e) {
function i() {
e.apply(this, arguments)
}
return __extends(i, e),
i.prototype.init = function() {
this.game.device.android && !this.game.device.chrome && (
this.game.canvas.parentElement.style.overflow = "visible");
var t = {
font: "10px GrilledCheeseBTNToasted"
},
e = this.add.text(0, 0, "0", t);
e.destroy()
},
i.prototype.preload = function() {
this.load.image("rotate", "assets/graphics/rotate-phone.png"),
this.load.image("LoadingBar_Outer", "assets/graphics/LoadingBar_Outer.png"),
this.load.image("LoadingBar_Inner", "assets/graphics/LoadingBar_Inner.png")
},
i.prototype.create = function() {
var e = this.game.scale;
e.scaleMode = Phaser.ScaleManager.SHOW_ALL,
e.minWidth = .25 * t.Config.GAME_WIDTH,
e.minHeight = .25 * t.Config.GAME_HEIGHT,
e.aspectRatio = t.Config.GAME_WIDTH / t.Config.GAME_HEIGHT,
e.pageAlignHorizontally = !0,
e.pageAlignVertically = !0,
this.game.device.desktop || e.forceOrientation(!1, !0),
e.enterIncorrectOrientation.add(this.onEnterIncorrectOrientation, this),
e.leaveIncorrectOrientation.add(this.onLeaveIncorrectOrientation, this),
e.setScreenSize(!0),
this.input.maxPointers = 1,
this.stage.disableVisibilityChange = !0,
this.stage.backgroundColor = 8179412,
this.game.state.start("Preloader", !0, !1)
},
i.prototype.onEnterIncorrectOrientation = function() {
document.getElementById("orientation").style.display = "block",
document.body.style.marginBottom = "0px"
},
i.prototype.onLeaveIncorrectOrientation = function() {
document.getElementById("orientation").style.display = "none",
document.body.style.marginBottom = "100px",
this.game.device.android && !this.game.device.chrome &&
this.game.scale.setScreenSize(!0)
},
i
} (Phaser.State);
t.Boot = e
} (game || (game = {}));
var game; !
function(t) {
var e = function(t) {
function e() {
t.apply(this, arguments)
}
return __extends(e, t),
e.prototype.create = function() {},
e.prototype.addSplash = function() {},
e.prototype.gotoMainMenu = function() {
this.game.state.start("MainMenu", !0, !1, !0)
},
e
} (Phaser.State);
t.SplashScreen = e
} (game || (game = {}));
var game; !
function(t) {
var e = function(e) {
function i(i, a) {
e.call(this, i, a),
this.overlayDuration = 300;
var n = i.add.bitmapData(t.Config.GAME_WIDTH, t.Config.GAME_HEIGHT,
"overlay", !0);
n.context.fillStyle = "rgba(0, 0, 0, 1)",
n.context.fillRect(0, 0, t.Config.GAME_WIDTH, t.Config.GAME_HEIGHT),
this.overlay = new Phaser.Image(i, 0, 0, n),
this.overlay.visible = !1,
this.game.stage.addChild(this.overlay)
}
return __extends(i, e),
i.prototype.changeState = function(t, e) {
this.showOverlay(t, e)
},
i.prototype.showOverlay = function(t, e) {
var i = this;
this.game.input.disabled = !0,
this.overlayTween && this.overlayTween.isRunning && this.overlayTween.stop(),
this.overlay.visible = !0,
this.overlay.alpha = 0,
this.overlayTween = this.game.add.tween(this.overlay).to({
alpha: 1
},
this.overlayDuration, Phaser.Easing.Cubic.Out, !0),
this.overlayTween.onComplete.addOnce(function() {
i.doChangeState(t, e)
},
this)
},
i.prototype.doChangeState = function(t, e) {
var i = this;
this.game.state.start(t, !0, !1, e),
setTimeout(function() {
i.hideOverlay()
},
100),
setTimeout(function() {
i.overlay.visible && (i.overlay.visible = !1)
},
100 + this.overlayDuration)
},
i.prototype.hideOverlay = function() {
this.game.input.disabled = !1,
this.overlayTween && this.overlayTween.isRunning && this.overlayTween.stop(),
this.overlayTween = this.game.add.tween(this.overlay).to({
alpha: 0
},
this.overlayDuration, Phaser.Easing.Cubic.Out, !0)
},
i
} (Phaser.Plugin);
t.StateTransition = e
} (game || (game = {}));
var game; !
function(t) {
var e = function(e) {
function i() {
e.apply(this, arguments)
}
return __extends(i, e),
i.prototype.init = function() {
this.addLoadingText()
},
i.prototype.addLoadingText = function() {
var e = {
font: "45px GrilledCheeseBTNToasted",
fill: "#FFFFFF",
align: "center"
},
i = this.game.add.text(0, 0, "Loading...", e);
i.anchor.set(.5, .5),
i.position.set(t.Config.HALF_GAME_WIDTH, t.Config.HALF_GAME_HEIGHT + 100),
i.setShadow(2, 2, "#249BC8")
},
i.prototype.preload = function() {
this.addPreloadBar(),
this.loadAssets()
},
i.prototype.addPreloadBar = function() {
if (t.Main.development === !1) {
var e = this.game.add.sprite(0, 0, "LoadingBar_Inner");
e.x = t.Config.HALF_GAME_WIDTH - .5 * e.width - .5,
e.y = t.Config.HALF_GAME_HEIGHT - .5 * e.height - 1.5;
var i = this.add.image(0, 0, "LoadingBar_Outer");
i.anchor.set(.5, .5),
i.x = t.Config.HALF_GAME_WIDTH - .5,
i.y = t.Config.HALF_GAME_HEIGHT,
this.load.setPreloadSprite(e)
}
},
i.prototype.loadAssets = function() {
this.load.audio("main_loop", ["assets/audio/MainLoop.ogg",
"assets/audio/MainLoop.m4a"], !0),
this.game.device.webAudio && (this.load.audio("tap", [
"assets/audio/TapSound.wav"], !0), this.load.audio("onLevelComplete", [
"assets/audio/LevelCompleteSound.wav"], !0), this.load.audio("on_down", [
"assets/audio/OnDown.wav"], !0), this.load.audio("on_up", [
"assets/audio/OnUp.wav"], !0), this.load.audio("star", [
"assets/audio/Star.wav"], !0), this.load.audio("star_taken", [
"assets/audio/StarTaken.wav"], !0)),
// this.load.image("splash_screen", "assets/graphics/Splash_Image_play68.png"),
this.load.atlasJSONHash("gui", "assets/graphics/gui.png",
"assets/graphics/gui.json"),
this.load.atlasJSONHash("level_graphics",
"assets/graphics/level_graphics.png", "assets/graphics/level_graphics.json"),
this.load.atlasJSONHash("manta_ray", "assets/graphics/manta_ray.png",
"assets/graphics/manta_ray.json"),
this.load.atlasJSONHash("level_complete", "assets/graphics/
level_complete.png", "assets/graphics/level_complete.json"),
this.load.atlasJSONHash("tutor_hand", "assets/graphics/tutorial_hand.png",
"assets/graphics/tutorial_hand.json"),
this.load.atlasJSONHash("tutorial", "assets/graphics/tutorial.png",
"assets/graphics/tutorial.json"),
this.load.atlasJSONHash("yellow_fish", "assets/graphics/yellow_fish.png",
"assets/graphics/yellow_fish.json"),
this.load.atlasJSONHash("pink_fish", "assets/graphics/pink_fish.png",
"assets/graphics/pink_fish.json"),
this.load.json("texts", "assets/texts.json"),
t.Main.development ? this.load.json("startLevel", "assets/levels/
StartLevel.json") : this.load.json("levelConfigs", "assets/levels/Levels.json")
},
i.prototype.create = function() {
this.initLanguage(),
this.prepareTextures(),
this.game.plugins.add(t.StateTransition),
this.game.cache.removeImage("LoadingBar_Outer"),
this.game.cache.removeImage("LoadingBar_Inner"),
t.Main.development && this.cache.getJSON("startLevel").level,
this.game.state.start("MainMenu", !0, !1, !0)
},
i.prototype.initLanguage = function() {
var e = this.game.cache.getJSON("texts");
t.Main.texts = e[t.Main.language]
},
i.prototype.prepareTextures = function() {},
i
} (Phaser.State);
t.Preloader = e
} (game || (game = {}));
var game; !
function(t) {
var e = function(t) {
function e(e, i, a, n, s) {
var o = this;
t.call(this, e, i, a, n, s),
this._callback = new Phaser.Signal,
this.anchor.set(.5, .5),
this.inputEnabled = !0,
this.game.device.desktop && (this.input.useHandCursor = !0),
this.inputEnabled && (this.events.onInputDown.add(function() {
o.game.device.webAudio && o.game.sound.play("tap"),
o.game.add.tween(o.scale).to({
x: .9,
y: .9
},
200, Phaser.Easing.Cubic.Out, !0)
}), this.events.onInputUp.add(function() {
o.game.add.tween(o.scale).to({
x: 1,
y: 1
},
100, Phaser.Easing.Cubic.Out, !0).onComplete.addOnce(o._callback.dispatch, o)
}))
}
return __extends(e, t),
e.prototype.destroy = function() {
t.prototype.destroy.call(this),
this._callback.dispose()
},
Object.defineProperty(e.prototype, "callback", {
get: function() {
return this._callback
},
enumerable: !0,
configurable: !0
}),
e
} (Phaser.Image);
t.SimpleButton = e
} (game || (game = {}));
var game; !
function(t) {
var e = function(t) {
function e(e, i, a, n, s) {
t.call(this, e, i, a, "gui", n),
this.textureKey1 = n,
this.textureKey2 = s,
this.activeTextureKey = this.textureKey1,
this._state = 1,
this.events.onInputUp.add(this.switchTextures, this, 2)
}
return __extends(e, t),
e.prototype.switchTextures = function() {
this.activeTextureKey = this.activeTextureKey === this.textureKey1 ?
this.textureKey2: this.textureKey1,
this.loadTexture("gui", this.activeTextureKey),
this._state = this.activeTextureKey === this.textureKey1 ? 1 : 2
},
Object.defineProperty(e.prototype, "state", {
get: function() {
return this._state
},
enumerable: !0,
configurable: !0
}),
e
} (game.SimpleButton);
t.ToggleButton = e
} (game || (game = {}));
var game; !
function(t) {
var e = function(e) {
function i() {
e.apply(this, arguments),
this.fromPreloader = !1
}
return __extends(i, e),
i.prototype.init = function(t) {
this.fromPreloader = t
},
i.prototype.create = function() {
this.initImages(),
this.addCreatures(),
this.initButtons(),
this.initLogo(),
this.initCredits(),
this.initAnimation(),
this.fromPreloader && (this.soundButton.input.enabled = !1,
this.soundButton.switchTextures(), this.game.input.onTap.addOnce(
this.startMusic, this), this.stage.disableVisibilityChange = !1,
this.game.onBlur.add(this.onFocusLost, this), this.game.onFocus.add(
this.onFocus, this))
},
i.prototype.onFocusLost = function() {
this.game.tweens.pauseAll(),
t.Main.wasMuted = this.game.sound.mute,
this.game.sound.mute = !0
},
i.prototype.onFocus = function() {
this.game.tweens.resumeAll(),
t.Main.wasMuted === !1 && (this.game.sound.mute = !1)
},
i.prototype.initImages = function() {
this.game.add.image( - 32, 0, "gui", "BG_20000"),
this.title = this.add.image(0, 0, "gui", "GameTitle0000"),
this.title.anchor.set(.5, .5),
this.title.x = t.Config.HALF_GAME_WIDTH - .5,
this.title.y = 150
},
i.prototype.addCreatures = function() {
this.needlefish = this.game.add.image(t.Config.HALF_GAME_WIDTH + 15, 550,
"gui", "Needlefish0000"),
this.needlefish.angle = 120,
this.octopus = this.game.add.image(t.Config.HALF_GAME_WIDTH + 190, 760,
"gui", "Octopus0000"),
this.jelly = this.game.add.image(t.Config.HALF_GAME_WIDTH - 145, 740,
"gui", "Jelly0000"),
[this.needlefish, this.octopus, this.jelly].forEach(function(t) {
t.anchor.set(.5, .5)
})
},
i.prototype.initButtons = function() {
var e = this,
i = 60;
this.soundButton = new t.ToggleButton(this.game, t.Config.GAME_WIDTH - i, i,
"Music_On_Button0000", "Music_Off_Button0000"),
this.soundButton.callback.add(function() {
e.game.sound.mute = !e.game.sound.mute
}),
this.game.sound.mute && this.soundButton.switchTextures(),
this.playButton = new t.SimpleButton(this.game, t.Config.HALF_GAME_WIDTH,
330, "gui", "Play_Button0000"),
this.playButton.callback.addOnce(function() {
e.game.changeState("LevelsMenu")
},
this),
this.creditsButton = new t.SimpleButton(this.game, this.playButton.x + 130,
this.playButton.y, "gui", "Credits_Button0000"),
this.creditsButton.callback.add(this.toggleCredits, this),
this.moreGamesButton = new t.SimpleButton(this.game, this.playButton.x - 130,
this.playButton.y, "gui", "MoreGames_Button0000"),
this.moreGamesButton.callback.add(this.gotoDeveloperWebsite, this),
this.buttons = [this.playButton, this.soundButton, this.moreGamesButton,
this.creditsButton],
this.buttons.forEach(function(t) {
e.world.add(t)
})
},
i.prototype.gotoDeveloperWebsite = function() {
// Play68.goHome()
},
i.prototype.initLogo = function() {},
i.prototype.initCredits = function() {
this.credits = this.game.add.image(0, 0, "gui", "CreditsBoard0000"),
this.credits.position.set(Math.round(.5 * (t.Config.GAME_WIDTH -
this.credits.width)), Math.round(.5 * (t.Config.GAME_HEIGHT -
this.credits.height))),
this.credits.visible = !1
},
i.prototype.toggleCredits = function() {
this.credits.visible ? this.hideCredits() : this.showCredits()
},
i.prototype.hideCredits = function() {
var t = this;
this.game.add.tween(this.credits).to({
y: this.credits.y + 200,
alpha: 0
},
500, Phaser.Easing.Back.In, !0).onComplete.addOnce(function() {
t.playButton.input.enabled = !0,
t.creditsButton.input.enabled = !0,
t.credits.visible = !1
},
this)
},
i.prototype.showCredits = function() {
var e = this;
this.credits.visible = !0,
this.credits.alpha = 0,
this.credits.y = Math.round(.5 * (t.Config.GAME_HEIGHT -
this.credits.height)) + 200,
this.game.add.tween(this.credits).to({
y: this.credits.y - 200,
alpha: 1
},
500, Phaser.Easing.Back.Out, !0),
this.playButton.input.enabled = !1,
this.creditsButton.input.enabled = !1,
this.game.input.onTap.addOnce(function() {
e.hideCredits()
},
this)
},
i.prototype.startMusic = function() {
this.game.sound.play("main_loop", .33, !1),
this.soundButton.switchTextures(),
this.soundButton.input.enabled = !0
},
i.prototype.initAnimation = function() {
var t = this;
this.title.y -= 280,
this.game.add.tween(this.title).to({
y: this.title.y + 280
},
600, Phaser.Easing.Back.Out, !0, 300);
var e = 800;
this.needlefish.y += 500,
this.octopus.x += 400,
this.jelly.x -= 400,
this.game.add.tween(this.needlefish).to({
y: this.needlefish.y - 500,
angle: 354
},
700, Phaser.Easing.Back.Out, !0, e),
this.game.add.tween(this.octopus).to({
x: this.octopus.x - 400
},
600, Phaser.Easing.Back.Out, !0, e + 300),
this.game.add.tween(this.jelly).to({
x: this.jelly.x + 400
},
600, Phaser.Easing.Back.Out, !0, e + 300);
var i = 1600;
this.buttons.forEach(function(e) {
e.scale.set(0, 0),
t.game.add.tween(e.scale).to({
x: 1,
y: 1
},
300, Phaser.Easing.Back.Out, !0, i),
i += 200
})
},
i.prototype.destroy = function() {
this.buttons = null
},
i
} (Phaser.State);
t.MainMenu = e
} (game || (game = {}));
源码
需要源码请关注添加好友哦^ ^
转载:欢迎来到本站,转载请注明文章出处
https://ormcc.com/