欢迎来到程序小院
玩法:把木块切成等分的碎片,每关都会有切割次数,木块数,切割越均匀分数越搞,
有简单、正常、困难、专家版,快去解锁不同版本进行切割吧^^。
开始游戏https://www.ormcc.com/play/gameStart/238
canvas{
display: block;
touch-action: none;
user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
width: 440px;
height: 550px;
cursor: inherit;
margin-left: 320px;
margin-right: -320px;
}
var LevelButton = function(t, e, s, a, i, h) {
Phaser.Button.call(this, game, t, e, null, i, h), this.lvl_number = a,
this.anchor.setTo(.5, .5), this.locked = !1, this.onInputDown.add(function() {
game.add.tween(this.scale).to({
x: 1.3,
y: 1.3
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0)
}, this), this.miniature = new Phaser.Image(game, 0, 0, null),
this.miniature.anchor.setTo(.5, .6), this.miniature.renderable = !1,
this.addChild(this.miniature), this.stars = new Phaser.Image(game, 0, 8, null),
this.stars.anchor.setTo(.5, 0), this.stars.renderable = !1, this.addChild(this.stars)
};
LevelButton.prototype = Object.create(Phaser.Button.prototype),
LevelButton.prototype.goToLevel = function() {
if (!this.locked) {
game.current_lvl = this.lvl_number;
var t = game.add.tween(game.state.getCurrentState().fade_gfx).to({
alpha: 1
}, 300, Phaser.Easing.Sinusoidal.InOut, !0);
game.lastRoom = "Category", t.onComplete.add(function() {
game.state.start("Play")
})
}
}, LevelButton.prototype.refresh = function() {
SaveLoad.unlocked_levels[game.current_category] < this.lvl_number ? (
this.loadTexture("ssheet", "lvl_button_locked"), this.stars.renderable = !1,
this.miniature.renderable = !1, this.locked = !0) : (
this.loadTexture("ssheet", "lvl_highlight"),
this.miniature.loadTexture("lvlmini", game.current_category.toString() + "_" +
this.lvl_number.toString()), this.miniature.renderable = !0,
this.stars.renderable = !0,
this.stars.loadTexture("ssheet", "lvl_star_" +
SaveLoad.level[game.current_category][this.lvl_number].toString()), this.locked = !1)
}, LevelButton.prototype.constructor = LevelButton, Preload = function() {},
Preload.prototype = {
preload: function() {
this.cm_logo = game.add.image(210, 150, "circusmoth"),
this.cm_logo.anchor.setTo(.5, .5),
this.preload_bg = game.add.image(57, 250, "loading_bar_0"),
this.preload_bar = game.add.image(57, 250, "loading_bar_1"),
this.loading = game.add.image(210, 330, "loading"),
this.loading.anchor.setTo(.5, .5), game.add.tween(this.loading.scale).to({
x: 1.2,
y: 1.2
}, 1e3, Phaser.Easing.Sinusoidal.InOut, !0, 0, -1, !0),
this.load.setPreloadSprite(this.preload_bar),
game.load.bitmapFont("font_label", "assets/images/font_label.png",
"assets/images/font_label.fnt", null, 0),
game.load.bitmapFont("font_digits", "assets/images/font-digits.png",
"assets/images/font-digits.fnt", null, 4),
game.load.atlasJSONHash("ssheet","assets/images/spritesheet.png",
"assets/images/spritesheet.json"),
game.load.atlasJSONHash("lvlmini", "assets/images/lvlmini.png",
"assets/images/lvlmini.json"),
game.load.image("line_dbg", "assets/images/line_dbg.png"),
game.load.audio("music_sfx", "assets/sounds/music.mp3"),
game.load.audio("chainsaw_sfx", "assets/sounds/chainsaw_1s.mp3"),
game.load.audio("chainsaw_alt_sfx", "assets/sounds/chainsaw_1s_alt.mp3"),
game.load.audio("click_sfx", "assets/sounds/click.mp3"),
game.load.audio("transition_sfx", "assets/sounds/transition.mp3"),
game.load.audio("whoosh_sfx", "assets/sounds/whoosh.mp3"),
game.load.audio("label_pop_sfx", "assets/sounds/label_pop.mp3"),
game.load.audio("win_sfx", "assets/sounds/win.mp3"),
game.load.audio("lose_sfx", "assets/sounds/lose.mp3")
},
create: function() {
this.game.stage.backgroundColor = "#FFFFFF", game.sfx = {},
game.sfx.music = game.add.audio("music_sfx", 1, !0), game.sfx.click =
game.add.audio("click_sfx"), this.cm_logo.visible = !1,
this.preload_bg.visible = !1, this.preload_bar.visible = !1,
this.loading.visible = !1, game.sfx.chainsaw_index = 0,
game.sfx.chainsaw = game.add.audio("chainsaw_sfx"),
game.sfx.chainsaw_alt = game.add.audio("chainsaw_alt_sfx"),
game.sfx.transition = game.add.audio("transition_sfx"),
game.sfx.whoosh = game.add.audio("whoosh_sfx"), game.sfx.label_pop =
game.add.audio("label_pop_sfx"), game.sfx.win = game.add.audio("win_sfx"),
game.sfx.lose = game.add.audio("lose_sfx"), this.state.start("MainMenu")
}
};
var Slice = function(t, e) {
this.point_0 = t, this.point_1 = e, this.f0t1 = !1, this.f1t0 = !1
};
Slice.prototype.checkLine = function(t) {
return this.point_0.i == t ? (this.f0t1 = !0, [this.point_0, this.point_1]) :
this.point_1.i == t ? (this.f1t0 = !0, [this.point_1, this.point_0]) : null
};
var Shape = function(t) {
Phaser.Polygon.call(this, t), this.to_kill = !1, this.dead = !1,
this.slices = [], this.new_shapes = [], this.centroid = Phaser.Point.centroid(this.points)
};
Shape.prototype = Object.create(Phaser.Polygon.prototype),
Shape.prototype.constructor = Shape, Shape.prototype.update = function() {},
Shape.prototype.prepareSlices = function(t) {
for (var e = [], s = 0; s < this.points.length; s++) {
var a, i = this.points[s];
a = s == this.points.length - 1 ? this.points[0] : this.points[s + 1];
var h = Phaser.Line.intersectsPoints(t.start, t.end, i, a, !0);
null != h && (h.i = s, e.push(h))
}
e.sort(function(e, s) {
var a = Phaser.Point.distance(t.start, e),
i = Phaser.Point.distance(t.start, s);
return a - i
}), e.length > 0 && (this.contains(t.start.x, t.start.y) && e.splice(0, 1),
this.contains(t.end.x, t.end.y) && e.splice(e.length - 1, 1));
for (var o = [], s = 0; s < e.length; s += 2) o.push(new Slice(e[s], e[s + 1]));
this.slices = o
}, Shape.prototype.makeNewPolygon = function(t, e) {
for (var s = [t, e], a = t.i, i = e.i; i++, i == this.points.length && (i = 0),
s.push(this.points[i]), i != a;) {
var h = this.checkSliceLine(i);
null != h && (i = h[1].i, s.push(h[0]), s.push(h[1]))
}
this.new_shapes.push(s)
}, Shape.prototype.checkSliceLine = function(t) {
for (var e = 0; e < this.slices.length; e++) {
var s = this.slices[e].checkLine(t);
if (null != s) return s
}
return null
}, Shape.prototype.slice = function(t) {
if (this.prepareSlices(t), 0 != this.slices.length) {
this.to_kill = !0;
for (var e = 0; e < this.slices.length; e++) {
var s = this.slices[e];
s.f0t1 || (this.makeNewPolygon(s.point_0, s.point_1), s.f0t1 = !0),
s.f1t0 || (s.f1t0 = !0, this.makeNewPolygon(s.point_1, s.point_0))
}
Phaser.Point.centroid(this.points, this.centroid)
}
};
var Logo = function(t) {
Phaser.Group.call(this, game, 0, 0), this.logo_0 =
game.add.image(60, t, "ssheet", "logo_0"), this.logo_1 =
game.add.image(117, t + 20, "ssheet", "logo_1"), this.logo_2 =
game.add.image(172, t, "ssheet", "logo_2"), this.logo_3 =
game.add.image(267, t + 5, "ssheet", "logo_3"), this.logo_4 =
game.add.image(325, t, "ssheet", "logo_4"), this.logo_5 =
game.add.image(382, t, "ssheet", "logo_5"), this.logo_0.anchor.setTo(.5, .5),
this.logo_1.anchor.setTo(.5, .5), this.logo_2.anchor.setTo(.5, .5),
this.logo_3.anchor.setTo(.5, .5), this.logo_4.anchor.setTo(.5, .5),
this.logo_5.anchor.setTo(.5, .5), game.add.tween(this.logo_0).from({
y: -100
}, 1200, Phaser.Easing.Elastic.Out, !0, 1020), game.add.tween(this.logo_1).from({
y: -100
}, 1420, Phaser.Easing.Elastic.Out, !0, 1060), game.add.tween(this.logo_2).from({
y: -100
}, 1200, Phaser.Easing.Elastic.Out, !0, 1050), game.add.tween(this.logo_3).from({
y: -100
}, 1410, Phaser.Easing.Elastic.Out, !0, 1120), game.add.tween(this.logo_4).from({
y: -100
}, 1200, Phaser.Easing.Elastic.Out, !0, 1080), game.add.tween(this.logo_5).from({
y: -100
}, 1410, Phaser.Easing.Elastic.Out, !0, 1050), this.add(this.logo_0),
this.add(this.logo_1), this.add(this.logo_2), this.add(this.logo_3),
this.add(this.logo_4), this.add(this.logo_5),
game.time.events.add(5 * Phaser.Timer.SECOND, this.init_bounce, this)
};
Logo.prototype = Object.create(Phaser.Group.prototype),
Logo.prototype.constructor = Logo, Logo.prototype.init_bounce = function() {
game.time.events.loop(6 * Phaser.Timer.SECOND, this.bounce, this)
}, Logo.prototype.bounce = function() {
game.add.tween(this.logo_0).to({
y: this.logo_0.y - 30
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0), game.add.tween(this.logo_1).to({
y: this.logo_0.y - 30
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 100, 0, !0), game.add.tween(this.logo_2).to({
y: this.logo_0.y - 30
}, 200, Phaser.Easing.Sinusoidal.Out, !0, 200, 0, !0), game.add.tween(this.logo_3).to({
y: this.logo_0.y - 30
}, 200, Phaser.Easing.Sinusoidal.Out, !0, 300, 0, !0), game.add.tween(this.logo_4).to({
y: this.logo_0.y - 30
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 400, 0, !0), game.add.tween(this.logo_5).to({
y: this.logo_0.y - 30
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 500, 0, !0)
};
var Background = function(t) {
Phaser.Sprite.call(this, game, 0, 0), this.fixedToCamera = !0,
this.offset = t || 0, this.y_margin = game.height - 525,
this.sky = this.game.add.image(0, 0, "ssheet", "bg"),
this.sky.fixedToCamera = !0, this.sky.scale.y = (this.y_margin + 251) / 251,
this.cloud = this.game.add.image(100, 50, "ssheet", "cloud_0"),
this.cloud.fixedToCamera = !0, this.cloud.xx = 400, this.cloud2 =
this.game.add.image(500, 70, "ssheet", "cloud_0"), this.cloud2.xx = 1e3,
this.cloud2.fixedToCamera = !0, this.cloud3 =
this.game.add.image(1e3, 60, "ssheet", "cloud_0"),
this.cloud3.xx = 1600, this.cloud3.fixedToCamera = !0,
this.grass_2 = this.game.add.tileSprite(0,
this.y_margin + 200, game.width, 160, "ssheet", "bg_grass_2"),
this.grass_2.fixedToCamera = !0, this.grass_2.tilePosition.set(-500, 0),
this.grass_1 = this.game.add.tileSprite(0,
this.y_margin + 240, game.width, 187, "ssheet", "bg_grass_1"),
this.grass_1.fixedToCamera = !0, this.grass_1.tilePosition.set(-250, 0),
this.grass_0 = this.game.add.tileSprite(0,
this.y_margin + 310, game.width, 220, "ssheet", "bg_grass_0"),
this.grass_0.fixedToCamera = !0
};
Background.prototype = Object.create(Phaser.Sprite.prototype),
Background.prototype.update = function() {
this.grass_2.tilePosition.set((this.game.camera.x + this.offset) * -.2, 0),
this.grass_1.tilePosition.set((this.game.camera.x + this.offset) * -.5, 0),
this.grass_0.tilePosition.set((this.game.camera.x + this.offset) * -.8, 0),
this.cloud.cameraOffset.x = this.cloud.xx - .2 * this.game.camera.x,
this.cloud.xx -= .2, this.cloud2.cameraOffset.x = this.cloud2.xx - .2 *
this.game.camera.x, this.cloud2.xx -= .2, this.cloud3.cameraOffset.x =
this.cloud2.xx - .2 * this.game.camera.x, this.cloud3.xx -= .2,
this.cloud.xx < -200 && (this.cloud.xx = 1500), this.cloud2.xx < -200 && (
this.cloud2.xx = 1500), this.cloud3.xx < -200 && (this.cloud3.xx = 1500)
}, Background.prototype.destroyBg = function() {
this.sky.destroy(), this.grass_2.destroy(), this.grass_1.destroy(),
this.grass_0.destroy(), this.destroy()
}, Background.prototype.rescale = function() {
this.y_margin = game.height - 525, this.sky.scale.y = (this.y_margin + 251) / 251,
this.grass_2.cameraOffset.y = this.y_margin + 200, this.grass_1.cameraOffset.y =
this.y_margin + 240, this.grass_0.cameraOffset.y = this.y_margin + 310
};
var Tutorial = function() {
Phaser.Group.call(this, game), this.y = 150, this.bg =
game.add.image(-100, 125, "ssheet", "tut_bg"), this.bg.anchor.setTo(0, .5),
this.addChild(this.bg), this.game.add.tween(this).from({
x: -750
}, 1500, Phaser.Easing.Elastic.InOut, !0, 0), game.time.events.add(300, function() {
SaveLoad.SFX && game.sfx.whoosh.play()
}, this), this.current_page = 0, this.page_1 = game.add.group(),
this.addChild(this.page_1),
this.title = game.add.image(210, 20, "ssheet", "tut_title"),
this.title.anchor.setTo(.5, 0), this.page_1.addChild(this.title),
this.shape_w = game.add.image(210, 125, "ssheet", "tut_shape_w"),
this.shape_w.anchor.setTo(.5, .5), this.page_1.addChild(this.shape_w),
this.shape_bottom = game.add.image(210, 125, "ssheet", "tut_shape_bottom"),
this.shape_bottom.anchor.setTo(.5, .5), this.shape_bottom.visible = !1,
this.page_1.addChild(this.shape_bottom),
this.shape_top = game.add.image(210, 125, "ssheet", "tut_shape_top"),
this.shape_top.anchor.setTo(.5, .5), this.shape_top.visible = !1,
this.page_1.addChild(this.shape_top),
this.slice = game.add.image(100, 160, "ssheet", "tut_slice"),
this.slice.anchor.setTo(0, .5), this.slice.width = 0,
this.slice.rotation = -.12435499454676144, this.page_1.addChild(this.slice),
this.click_dot = game.add.image(100, 160, "ssheet", "tut_click_dot"),
this.click_dot.scale.setTo(1.2, 1.2), this.click_dot.alpha = 0,
this.click_dot.anchor.setTo(.5, .5), this.page_1.addChild(this.click_dot),
this.hand = game.add.image(100, 160, "ssheet", "tut_hand"),
this.page_1.addChild(this.hand),
this.page_2 = game.add.image(210, 20, "ssheet", "tut_page2"),
this.page_2.alpha = 0, this.page_2.anchor.setTo(.5, 0),
this.addChild(this.page_2), game.time.events.add(2e3, function() {
this.resetAnimation()
}, this), console.log("TUTORIAL"), console.log(this)
};
Tutorial.prototype = Object.create(Phaser.Group.prototype),
Tutorial.prototype.constructor = Tutorial, Tutorial.prototype.update = function() {
this.y = .28 * game.height
}, Tutorial.prototype.resetAnimation = function() {
this.shape_top.visible = !1, this.shape_top.y = 125,
this.shape_bottom.y = 125, this.shape_bottom.visible = !1,
this.shape_w.visible = !0, this.hand.x = 100, this.hand.y = 160,
this.slice.width = 0, game.add.tween(this.hand).to({
x: 300,
y: 135
}, 2e3, Phaser.Easing.Sinusoidal.InOut, !0, 0), game.add.tween(
this.click_dot.scale).to({
x: .5,
y: .5
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0), game.add.tween(
this.click_dot).to({
alpha: .5
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0), game.add.tween(
this.click_dot).to({
x: 300,
y: 135
}, 2e3, Phaser.Easing.Sinusoidal.InOut, !0, 0),
SaveLoad.SFX && game.sfx.click.play(), game.add.tween(this.slice).to({
width: 202
}, 2e3, Phaser.Easing.Sinusoidal.InOut, !0, 0), game.add.tween(this.slice).to({
alpha: 0
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 2500),
game.time.events.add(2500, function() {
SaveLoad.SFX && game.sfx.label_pop.play(),
this.shape_top.visible = !0, this.shape_bottom.visible = !0,
this.shape_w.visible = !1, game.add.tween(this.click_dot.scale).to({
x: 1.2,
y: 1.2
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0),
game.add.tween(this.click_dot).to({
alpha: 0
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0)
}, this), game.add.tween(this.shape_bottom).to({
y: 140
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 2500), game.add.tween(this.shape_top).to({
y: 110
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 2500), game.add.tween(this.page_2).to({
alpha: 1
}, 500, Phaser.Easing.Sinusoidal.InOut, !0, 4500), game.add.tween(this.page_1).to({
alpha: 0
}, 500, Phaser.Easing.Sinusoidal.InOut, !0, 4200), game.add.tween(this).to({
x: 750
}, 1500, Phaser.Easing.Elastic.InOut, !0, 8500), game.time.events.add(8800, function() {
SaveLoad.SFX && game.sfx.whoosh.play()
}, this)
};
var CategoryButton = function(t, e, s, a, i, h) {
function o() {
this.unlocked && (SaveLoad.SFX && game.sfx.click.play(),
game.add.tween(this.scale).to({
x: 1.3,
y: 1.3
}, 200, Phaser.Easing.Sinusoidal.InOut, !0, 0, 0, !0),
game.current_category = this.category, game.add.tween(game.camera).to({
x: 840
}, 1e3, Phaser.Easing.Sinusoidal.InOut, !0))
}
Phaser.Button.call(this, game, t, e, ""), this.onInputDown.add(o, this, 1),
this.anchor.setTo(.5, .5), this.category = s,
this.fill = new Phaser.Image(game, 0, 0, null),
this.fill.anchor.setTo(.5, .5), this.addChild(this.fill),
this.unlocked = !1, SaveLoad.all_stars < a ? (this.fill.loadTexture("ssheet", i),
this.reqStar = new Phaser.BitmapText(game, -115, 20, "font_digits", a.toString(), 25),
this.reqStar.anchor.setTo(1, 0), this.underline = new Phaser.Image(game, .5 * (
this.reqStar.width + 47 + 153) - 165, 15, "ssheet", "to_unlock"),
this.star_ico = new Phaser.Image(game,
this.underline.x + 28, 17, "ssheet", "small_star"), this.star_ico.anchor.setTo(1, 0),
this.reqStar.x = this.star_ico.x - 38, this.addChild(this.underline),
this.addChild(this.reqStar), this.addChild(this.star_ico)) : (this.unlocked = !0,
this.fill.loadTexture("ssheet", h), maxStars = 54,
this.stars = new Phaser.BitmapText(game, 18, 20, "font_digits", SaveLoad.star[s] + "/" +
mxStars, 25), this.stars.anchor.setTo(1, 0), this.stars.x = this.stars.width - .5 * (
this.stars.width + 47) + 5, this.star_ico = new Phaser.Image(game,
this.stars.x - 5, 17, "ssheet", "small_star"), this.addChild(this.stars),
this.addChild(this.star_ico))
};
CategoryButton.prototype = Object.create(Phaser.Button.prototype),
CategoryButton.prototype.constructor = CategoryButton;
var TurnDevice = function() {
Phaser.Group.call(this, game), this.fixedToCamera = !0, this.bg =
game.add.graphics(0, 0), this.bg.beginFill("#000000", 1),
this.bg.drawRect(0, 0, 420, 1500), this.bg.endFill(), this.add(this.bg),
this.please_turn = game.add.image(210, .5 * game.height, "ssheet",
"turn_device"), this.please_turn.anchor.setTo(.5, .5), this.please_turn.scale.setTo(2, 2),
this.add(this.please_turn)
};
源码
需要源码请关注添加好友哦^ ^
转载:欢迎来到本站,转载请注明文章出处
https://ormcc.com/