diff --git a/ATARCS__.TTF b/ATARCS__.TTF deleted file mode 100644 index ef9bcbb..0000000 Binary files a/ATARCS__.TTF and /dev/null differ diff --git a/atari.ttf b/atari.ttf new file mode 100644 index 0000000..01b9dbe Binary files /dev/null and b/atari.ttf differ diff --git a/crosshair.cur b/crosshair.cur new file mode 100644 index 0000000..e1d1dc2 Binary files /dev/null and b/crosshair.cur differ diff --git a/engine/Event.js b/engine/Event.js index 3583e18..6ca6fd5 100644 --- a/engine/Event.js +++ b/engine/Event.js @@ -49,6 +49,8 @@ GO.Event.init = function() addEventListener('keypress', function(e) { if (GO.pause) { + GO.pause = false + GO.oldtime = 0 return } diff --git a/engine/GO.js b/engine/GO.js index 9c4eb57..d8ec53e 100644 --- a/engine/GO.js +++ b/engine/GO.js @@ -115,7 +115,7 @@ GO.loop = function() GO.showFPS = function() { - if (!this.config.showFPS) { + if (!this.config.showFPS && !(ext && ext.showFPS)) { return } diff --git a/engine/Sound.js b/engine/Sound.js new file mode 100644 index 0000000..9a62811 --- /dev/null +++ b/engine/Sound.js @@ -0,0 +1,8 @@ + +GO.Sound = { } + +GO.Sound.play = function(name) +{ + +} + diff --git a/game.dat b/game.dat new file mode 100644 index 0000000..07b6483 Binary files /dev/null and b/game.dat differ diff --git a/game/EndScene.js b/game/EndScene.js index e05888e..c7e3a9d 100644 --- a/game/EndScene.js +++ b/game/EndScene.js @@ -1,14 +1,33 @@ -P4.EndScene = function(label1, label2) +P4.EndScene = function(label1, score, diff) { if (label1) { this.label1 = label1 } - if (label2) { - this.label2 = label2 + this.score = score + this.isNewHighScore = false + + P4.GameState.data['level'] = false + P4.GameState.data['score'] = 0 + P4.GameState.data['lives'] = 0 + P4.GameState.data['diff'] = 0 + + var state = P4.GameState.data + + if (!state.highscore) { + state.highscore = {} } + if (!state.highscore[diff]) { + state.highscore[diff] = score + } else if (score > state.highscore[diff]) { + state.highscore[diff] = score + this.isNewHighScore = true + } + + P4.GameState.commit() + P4.EndScene.superproto.constructor.call(this) this.layers.handlers = new GO.Layer @@ -17,28 +36,21 @@ P4.EndScene = function(label1, label2) this.layers.transition = new GO.Layer P4.Starfield.create(this.layers.starfield) - - this.blinkTimer = new GO.Timer(500, function() { - this.blink = ! this.blink - }, this) - this.blinkTimer.pause = true - this.layers.handlers.push(this.blinkTimer) } GO.Util.extend(P4.EndScene, GO.Scene) P4.EndScene.prototype.label1 = 'Game Over' -P4.EndScene.prototype.label2 = 'try again' P4.EndScene.prototype.activate = function() { this.locked = true + + GO.Sound.play('game_over') /* allow click after time period */ this.layers.handlers.push(new GO.Timer(1500, function() { this.locked = false - this.blinkTimer.reset() - this.blinkTimer.pause = false return false }, this)) } @@ -76,7 +88,14 @@ P4.EndScene.prototype.drawSubTitle = function() GO.ctx.fillStyle = '#fff' GO.ctx.textBaseline = 'middle' GO.ctx.textAlign = 'center' - GO.ctx.fillText(this.label2, GO.Screen.width / 2, GO.Screen.height / 2 + 100) + + var label = 'YOUR SCORE : ' + this.score + + if (this.isNewHighScore) { + label = 'NEW HIGHSCORE : ' + this.score; + } + + GO.ctx.fillText(label, GO.Screen.width / 2, GO.Screen.height / 2 + 100) } P4.EndScene.prototype.handleEvent = function() diff --git a/game/EnemyBoss.js b/game/EnemyBoss.js new file mode 100644 index 0000000..65bebbd --- /dev/null +++ b/game/EnemyBoss.js @@ -0,0 +1,252 @@ + +P4.EnemyBoss = function() +{ + P4.EnemyBoss.superproto.constructor.call(this) + + this.x = GO.Screen.width / 2 + this.y = -20 + + this.tx = GO.Screen.width / 2 + this.ty = 100 + + this.angle = Math.PI + + this.tail = new GO.LinkedList + for (var i = 0; i < 20; i += 1) { + this.tail.push({ + x: -100 + ,y: -100 + ,angle: 0 + ,alpha: 1 + }) + } + this.tailCur = this.tail.first +} + +GO.Util.extend(P4.EnemyBoss, P4.Enemy) + +P4.EnemyBoss.prototype.size = 3 +P4.EnemyBoss.prototype.angle = 0 +P4.EnemyBoss.prototype.v = 3 +P4.EnemyBoss.prototype.cr = 30 +P4.EnemyBoss.prototype.lethal = true +P4.EnemyBoss.prototype.life = 100 +P4.EnemyBoss.prototype.color = '247,252,105' + +P4.EnemyBoss.prototype.process = function() +{ + if (!this.hit) { + this.drawTail() + this.drawShip(this.x, this.y, this.angle, 1, this.color) + } + + this.x += (this.tx - this.x) * (GO.delta * this.v) + this.y += (this.ty - this.y) * (GO.delta * this.v) + + if (this.y - 200 > GO.Screen.height + || this.x > GO.Screen.width + || this.x < 0) { + + this.dead = true + } + + GO.VisibleEntityGroup.prototype.process.call(this) + + if (this.hit) { + if (this.count <= 0) { + this.dead = true + } + + return + } + var player = GO.scenes.game.player + ,px = player.x + ,py = player.y + + if (!player.heaven) { + this.angle = (Math.PI / 2) + Math.atan((this.y - py) / (this.x - px)) + if (px <= this.x) { + this.angle -= Math.PI + } + } else { + this.angle = Math.PI + } + + if (!this.hit && this.lastTick != GO.tick) { + if (GO.tick % 20 == 0) { + this.changePos() + } + + if (GO.tick % 30 == 0) { + this.fire() + } + + if (GO.tick % 100 == 0) { + var p = new P4.Powerup + p.x = Math.random() * GO.Screen.width + p.y = 0 + p.type = 'w' + GO.scenes.game.layers.fg.push(p) + } + + this.lastTick = GO.tick + } + + this.drawEnergy() + + if (player.heaven) { + this.tx = GO.Screen.width / 2 + this.ty = GO.Screen.height + 300 + } +} + +P4.EnemyBoss.prototype.drawEnergy = function() +{ + GO.ctx.textBaseline = 'middle' + GO.ctx.textAlign = 'center' + GO.ctx.font = '8px ' + GO.config.fontName + GO.ctx.fillStyle = 'white' + GO.ctx.fillText('BOSS : ' + this.life, GO.Screen.width / 2, 20) +} + +P4.EnemyBoss.prototype.changePos = function() +{ + var sw = GO.Screen.width + ,sh = GO.Screen.height + + GO.Sound.play('boss_move') + this.tx = 100 + (Math.random() * (sw - 200)) + this.ty = 50 + (Math.random() * (sh - 400)) +} + +P4.EnemyBoss.prototype.fire = function() +{ + GO.Sound.play('boss_fire') + + for (var i = 0; i < 10; i += 1) { + var c = { r: 255, g: 255, b: -1 } + ,ec = { r: 255, g: 255, b: -1 } + ,a = new P4.EnemyShip(c, ec) + + a.x = this.x - 20 + (Math.random() * 20) + a.y = this.y - 20 + (Math.random() * 20) + a.v = 1 + (Math.random() * 2) + a.size = 0.2 + a.canFire = false + a.canFlyAway = false + a.canGiveScore = false + a.explodeLifetime = 1 / 20 + GO.scenes.game.layers.fg.push(a) + } +} + +P4.EnemyBoss.prototype.drawTail = function() +{ + if (this.tailCur) { + this.tailCur.x = this.x + this.tailCur.y = this.y + this.tailCur.angle = this.angle + this.tailCur.alpha = 1 + if (this.tailCur.llnext) { + this.tailCur = this.tailCur.llnext + } else { + this.tailCur = this.tail.first + } + } + + var i = 0 + ,cur = this.tailCur + + do { + cur.alpha -= 1 / 10 + if (cur.alpha > 0.1) { + this.drawShip(cur.x, cur.y, cur.angle, cur.alpha, this.color) + } + + if (cur.llnext) { + cur = cur.llnext + } else { + cur = this.tail.first + } + i += 1 + } while (i < this.tail.count) +} + +P4.EnemyBoss.prototype.drawShip = function(x, y, angle, alpha, color) +{ + GO.ctx.save() + GO.ctx.fillStyle = 'rgba('+ color +','+ alpha +')' + GO.ctx.beginPath() + GO.ctx.translate(x, y) + GO.ctx.rotate(angle) + + GO.ctx.moveTo(0, -10 * this.size) + GO.ctx.lineTo(5 * this.size, 5 * this.size) + GO.ctx.lineTo(-5 * this.size, 5 * this.size) + + GO.ctx.moveTo(0 - 10, -10 * this.size) + GO.ctx.lineTo(5 * this.size - 10, 5 * this.size) + GO.ctx.lineTo(-5 * this.size - 10, 5 * this.size) + + GO.ctx.moveTo(0 + 10, -10 * this.size) + GO.ctx.lineTo(5 * this.size + 10, 5 * this.size) + GO.ctx.lineTo(-5 * this.size + 10, 5 * this.size) + + GO.ctx.fill() + GO.ctx.restore() +} + +P4.EnemyBoss.prototype.explode = function(x, y, v, n) +{ + if (!n) { + n = 10 + } + + var p = new GO.Particles + p.colorscheme = this.excolorscheme + p.x = x + p.y = y + p.lifetime = 1 / 5 + p.v = v + p.vr = 100 + p.explode(n) + this.push(p) +} + +P4.EnemyBoss.prototype.oncollision = function(s, d) +{ + if (!(s instanceof P4.Shot)) { + return + } + + if (d > this.cr) { + return + } + + if (!this.lethal) { + return + } + + this.life -= 1 + s.dead = true + + if (this.life <= 0) { + GO.Sound.play('boss_explode') + this.explode(s.x, s.y, 500, 50) + this.dust = false + this.lethal = false + this.hit = true + + if (this.powerup) { + var p = new P4.Powerup + p.x = this.x + p.y = this.y + GO.scenes.game.layers.fg.push(p) + } + } else { + GO.Sound.play('hit') + this.explode(s.x, s.y, 10) + GO.scenes.game.player.score += 100 + Math.floor(this.v * 100) + } +} + diff --git a/game/EnemyBoss2.js b/game/EnemyBoss2.js new file mode 100644 index 0000000..1ef4bdf --- /dev/null +++ b/game/EnemyBoss2.js @@ -0,0 +1,41 @@ + +P4.EnemyBoss2 = function() +{ + P4.EnemyBoss2.superproto.constructor.call(this) +} + +GO.Util.extend(P4.EnemyBoss2, P4.EnemyBoss) + +P4.EnemyBoss2.prototype.size = 2 +P4.EnemyBoss2.prototype.color = '127,255,0' + +P4.EnemyBoss2.prototype.fire = function() +{ + GO.Sound.play('boss_fire') + + for (var i = 0; i < 2; i += 1) { + var c = { r: 255, g: 255, b: -1 } + ,ec = { r: 255, g: 255, b: -1 } + ,a = new P4.EnemyShip(c, ec) + + a.x = this.x - 20 + (Math.random() * 20) + a.y = this.y - 20 + (Math.random() * 20) + a.v = 1 + (Math.random() * 2) + a.size = 0.2 + a.canFire = false + a.canFlyAway = false + a.canGiveScore = false + a.explodeLifetime = 1 / 20 + GO.scenes.game.layers.fg.push(a) + } +} + +P4.EnemyBoss2.prototype.drawEnergy = function() +{ + GO.ctx.textBaseline = 'middle' + GO.ctx.textAlign = 'center' + GO.ctx.font = '8px ' + GO.config.fontName + GO.ctx.fillStyle = 'white' + GO.ctx.fillText('BOSS : ' + this.life, GO.Screen.width / 2, 20 + (this.pos * 20)) +} + diff --git a/game/EnemyShip.js b/game/EnemyShip.js index 1dbc1ca..b06cc53 100644 --- a/game/EnemyShip.js +++ b/game/EnemyShip.js @@ -12,15 +12,15 @@ P4.EnemyShip = function(colorscheme, excolorscheme) this.excolorscheme = colorscheme } - this.dust = new GO.Particles - this.dust.x = this.x - this.dust.y = this.y - this.dust.gravity = 200 - this.dust.lifetime = 1 / 10 - this.dust.v = 50 + //this.dust = new GO.Particles + //this.dust.x = this.x + //this.dust.y = this.y + //this.dust.gravity = 200 + //this.dust.lifetime = 1 / 10 + //this.dust.v = 50 this.tail = new GO.LinkedList - for (i = 0; i < 20; i += 1) { + for (var i = 0; i < 20; i += 1) { this.tail.push({ x: -100 ,y: -100 @@ -30,7 +30,7 @@ P4.EnemyShip = function(colorscheme, excolorscheme) } this.tailCur = this.tail.first - this.y = -30 + this.y = -10 } GO.Util.extend(P4.EnemyShip, P4.Enemy) @@ -41,48 +41,27 @@ P4.EnemyShip.prototype.v = 0.5 P4.EnemyShip.prototype.cr = 20 P4.EnemyShip.prototype.lethal = true P4.EnemyShip.prototype.life = 2 +P4.EnemyShip.prototype.canFire = true +P4.EnemyShip.prototype.canFlyAway = true +P4.EnemyShip.prototype.canFollowPlayer = true +P4.EnemyShip.prototype.canGiveScore = true +P4.EnemyShip.prototype.explodeLifetime = 1 / 5 +P4.EnemyShip.prototype.tx = false +P4.EnemyShip.prototype.ty = false +P4.EnemyShip.prototype.bulletSpeed = 200 P4.EnemyShip.prototype.process = function() { - var i - ,cur - - if (this.dust) { - this.dust.x = this.x - this.dust.y = this.y - this.dust.gravityangle = this.angle + Math.PI - this.dust.process() - } + //if (this.dust) { + // this.dust.x = this.x + // this.dust.y = this.y + // this.dust.gravityangle = this.angle + Math.PI + // this.dust.process() + //} if (!this.hit) { - if (this.tailCur) { - this.tailCur.x = this.x - this.tailCur.y = this.y - this.tailCur.angle = this.angle - this.tailCur.alpha = 1 - if (this.tailCur.llnext) { - this.tailCur = this.tailCur.llnext - } else { - this.tailCur = this.tail.first - } - } - - i = 0 - cur = this.tailCur - do { - cur.alpha -= 1 / 10 - if (cur.alpha > 0.1) { - this.drawShip(cur.x, cur.y, cur.angle, cur.alpha, this.color) - } - - if (cur.llnext) { - cur = cur.llnext - } else { - cur = this.tail.first - } - i += 1 - } while (i < this.tail.count) - + this.drawTail() + this.drawShip(this.x, this.y, this.angle, 1, this.color) } @@ -100,17 +79,23 @@ P4.EnemyShip.prototype.process = function() ,px = player.x ,py = player.y + if (player.heaven) { + this.canFlyAway = true + } + if (!this.flyaway) { - this.tx = px - this.ty = py + if (this.canFollowPlayer) { + this.tx = px + this.ty = py + } var d = Math.sqrt(Math.pow(px - this.x, 2) + Math.pow(py - this.y, 2)) - if (d <= 300) { + if (d <= 300 && this.canFire) { this.fire() } - if ((d <= 150 && player.y > (GO.Screen.height * 0.5)) || player.heaven) { + if (this.canFlyAway && ((d <= 150 && player.y > (GO.Screen.height * 0.5)) || player.heaven)) { this.flyaway = true this.v = 0.5 @@ -126,6 +111,8 @@ P4.EnemyShip.prototype.process = function() this.x += (this.tx - this.x) * (GO.delta * this.v) this.y += (this.ty - this.y) * (GO.delta * this.v) + this.x += Math.sin(GO.tick) * (GO.delta * (10 * Math.random() + 20)) + if (this.y - 200 > GO.Screen.height || this.x > GO.Screen.width || this.x < 0) { @@ -133,11 +120,12 @@ P4.EnemyShip.prototype.process = function() this.dead = true } - /* angle pointing to mouse position */ - - this.angle = (Math.PI / 2) + Math.atan((this.y - this.ty) / (this.x - this.tx)) - if (px <= this.x) { - this.angle -= Math.PI + /* angle pointing to player's position */ + if (!player.heaven) { + this.angle = (Math.PI / 2) + Math.atan((this.y - py) / (this.x - px)) + if (px <= this.x) { + this.angle -= Math.PI + } } if (this.flyaway) { @@ -147,23 +135,56 @@ P4.EnemyShip.prototype.process = function() P4.EnemyShip.prototype.fire = function() { - if (this.lastTick != GO.tick) { - /* fire shot */ - if (GO.tick % 5 == 0) { - var e = new P4.Shot - e.fillStyle = 'red' - e.x = this.x - e.y = this.y - e.v = 200 - e.cr = 4 - e.angle = this.angle - e.lethal = true - e.collidesWith = [ P4.Player ] - GO.scenes.game.layers.fg.push(e) + if (this.lastTick == GO.tick) { + return + } + + this.lastTick = GO.tick + + if (GO.tick % 5 == 0) { + var e = new P4.Shot + e.fillStyle = 'red' + e.x = this.x + e.y = this.y + e.v = this.bulletSpeed + e.cr = 4 + e.angle = this.angle + e.lethal = true + e.collidesWith = [ P4.Player ] + GO.scenes.game.layers.fg.push(e) + } +} + +P4.EnemyShip.prototype.drawTail = function() +{ + if (this.tailCur) { + this.tailCur.x = this.x + this.tailCur.y = this.y + this.tailCur.angle = this.angle + this.tailCur.alpha = 1 + if (this.tailCur.llnext) { + this.tailCur = this.tailCur.llnext + } else { + this.tailCur = this.tail.first } - - this.lastTick = GO.tick } + + var i = 0 + ,cur = this.tailCur + + do { + cur.alpha -= 1 / 10 + if (cur.alpha > 0.1) { + this.drawShip(cur.x, cur.y, cur.angle, cur.alpha, this.color) + } + + if (cur.llnext) { + cur = cur.llnext + } else { + cur = this.tail.first + } + i += 1 + } while (i < this.tail.count) } P4.EnemyShip.prototype.drawShip = function(x, y, angle, alpha, color) @@ -198,6 +219,7 @@ P4.EnemyShip.prototype.oncollision = function(s, d) s.dead = true if (this.life <= 0) { + GO.Sound.play('explode1') this.explode(s.x, s.y, 300) this.dust = false this.lethal = false @@ -210,7 +232,9 @@ P4.EnemyShip.prototype.oncollision = function(s, d) GO.scenes.game.layers.fg.push(p) } } else { + GO.Sound.play('hit') this.explode(s.x, s.y, 10) + if (this.canGiveScore) GO.scenes.game.player.score += 100 + Math.floor(this.v * 100) } } @@ -220,7 +244,7 @@ P4.EnemyShip.prototype.explode = function(x, y, v) p.colorscheme = this.excolorscheme p.x = x p.y = y - p.lifetime = 1 / 5 + p.lifetime = this.explodeLifetime p.v = v p.vr = 100 p.explode(10) diff --git a/game/EnemyShipVariants.js b/game/EnemyShipVariants.js index 15d1845..9fe3240 100644 --- a/game/EnemyShipVariants.js +++ b/game/EnemyShipVariants.js @@ -6,11 +6,13 @@ P4.EnemyShipBlue = function() P4.EnemyShipBlue.superproto.constructor.call(this, c, ec) - this.v = 0.1 + this.v = 0.3 } GO.Util.extend(P4.EnemyShipBlue, P4.EnemyShip) +/************************************************************************/ + P4.EnemyShipPurple = function() { var c = { r: 255, g: 0, b: 201 } @@ -23,6 +25,8 @@ P4.EnemyShipPurple = function() GO.Util.extend(P4.EnemyShipPurple, P4.EnemyShip) +/************************************************************************/ + P4.EnemyShipYellow = function() { var c = { r: 204, g: 255, b: 0 } @@ -33,6 +37,8 @@ P4.EnemyShipYellow = function() GO.Util.extend(P4.EnemyShipYellow, P4.EnemyShip) +/************************************************************************/ + P4.EnemyShipOrange = function() { var c = { r: 231, g: 53, b: 37 } @@ -43,3 +49,15 @@ P4.EnemyShipOrange = function() GO.Util.extend(P4.EnemyShipOrange, P4.EnemyShip) +/************************************************************************/ + +P4.EnemyShipLime = function() +{ + var c = { r: 120, g: 231, b: 84 } + ,ec = { r: 120, g: -1, b: 84 } + + P4.EnemyShipLime.superproto.constructor.call(this, c, ec) +} + +GO.Util.extend(P4.EnemyShipLime, P4.EnemyShip) + diff --git a/game/EnemyStar.js b/game/EnemyStar.js index 7f01499..5a981fe 100644 --- a/game/EnemyStar.js +++ b/game/EnemyStar.js @@ -28,7 +28,7 @@ P4.EnemyStar.prototype.explode = function(x, y, v) p.colorscheme = { r: -1, g: 1, b: 0 } p.x = x p.y = y - p.lifetime = 1 / 5 + p.lifetime = 1 / 10 p.v = v p.vr = 100 p.explode(2) diff --git a/game/Game.js b/game/Game.js index 9c2b318..c5e17c0 100644 --- a/game/Game.js +++ b/game/Game.js @@ -1,18 +1,94 @@ GO.config.fontName = 'atari' -GO.config.showFPS = true +GO.config.showFPS = false P4.track = function(t) { + var url = "http://vs2.baunz.net/track/?id=p4mac&r=" + encodeURIComponent(t); + var i = new Image(1,1) + i.src = url +} + +P4.FormatDiff = function(diff) +{ + switch (Number(diff)) { + case 0: return 'easy' + case 1: return 'normal' + case 2: return 'hard' + case 3: return 'ultra' + default: return 'easy' + } +} + +P4.DiffFromText = function(diff) +{ + switch (diff) { + case 'easy': return 0 + case 'normal': return 1 + case 'hard': return 2 + case 'ultra': return 3 + default: return false + } +} + +P4.GameState = { } + +P4.GameState.init = function() +{ + if (!window.ext || !window.ext.getGameState) { + return + } + + P4.GameState.data = { } + + var state = ext.getGameState() + if (!state) { + return + } + + state = JSON.parse(state) + if (!state) { + return + } + + P4.GameState.data = state +} + +P4.GameState.store = function(key, val) +{ + if (!window.ext || !window.ext.save) { + return + } + + P4.GameState.data[key] = val + + P4.GameState.commit() +} + +P4.GameState.commit = function() +{ + ext.save('GameState', JSON.stringify(P4.GameState.data)) +} + +P4.GameState.get = function(key) +{ + if (!P4.GameState.data.hasOwnProperty(key)) { + return false + } + + return P4.GameState.data[key] } GO.init = function() { - this.debug = document.location.hash == '#d' + P4.GameState.init() + + this.debug = document.location.hash.indexOf('#d') > -1 if (this.debug) { - //this.godMode = true + this.godMode = document.location.hash.indexOf('godmode') > -1 //this.wireFrame = true + this.config.showFPS = true } GO.handlers.push({ @@ -41,6 +117,12 @@ GO.init = function() } } break + + case '=': + if (GO.debug) { + GO.pause = true + } + break } } }) @@ -49,7 +131,13 @@ GO.init = function() GO.scenes.menu = new P4.MenuScene if (this.debug) { - GO.scenes.game = new P4.GameScene + /* jump to level via url hash: #d,level=10 */ + var ret = document.location.hash.match(/level=(\d+)/) + ,level = ret ? ret[1] : false + ,ret = document.location.hash.match(/diff=(\d+)/) + ,diff = ret ? ret[1] : 0 + + GO.scenes.game = new P4.GameScene({ level: level, score: 100, lives: 3, diff: diff }) GO.setScene(GO.scenes.game) } else { GO.setScene(GO.scenes.intro) diff --git a/game/GameScene.js b/game/GameScene.js index e63d37d..5947c28 100644 --- a/game/GameScene.js +++ b/game/GameScene.js @@ -1,5 +1,5 @@ -P4.GameScene = function() +P4.GameScene = function(state) { P4.GameScene.superproto.constructor.call(this) @@ -14,14 +14,53 @@ P4.GameScene = function() this.layers.fg = new GO.Layer /* foreground */ this.layers.transition = new GO.Layer + var score = state && state.score ? state.score : false + , lives = state && state.lives ? state.lives : false + , startLevel = state && state.level ? state.level : false + , diff = state && state.diff ? state.diff : 0 + + switch (Number(diff)) { + case 1: /* normal */ + P4.Player.prototype.energy = 30 + P4.Player.prototype.lives = 3 + P4.EnemyShip.prototype.bulletSpeed = 250 + break + + case 2: /* hard */ + P4.Player.prototype.energy = 20 + P4.Player.prototype.lives = 3 + P4.EnemyShip.prototype.bulletSpeed = 300 + break + + case 3: /* ultra */ + P4.Player.prototype.energy = 10 + P4.Player.prototype.lives = 3 + P4.EnemyShip.prototype.bulletSpeed = 400 + break + + default: + case 0: /* easy */ + P4.Player.prototype.energy = 40 + P4.Player.prototype.lives = 5 + P4.EnemyShip.prototype.bulletSpeed = 200 + break + } + this.player = new P4.Player(this) + if (lives) this.player.lives = lives + if (score) this.player.score = score + this.player.diff = diff this.player.ondied = { fn: this.onPlayerDied ,ctx: this } this.layers.fg.push(this.player) - this.level = new P4.Level(this) + this.level = new P4.Level(this, startLevel) + + this.overlayAlpha = 0 + this.overlayColor = false + this.overlayFadeout = false } GO.Util.extend(P4.GameScene, GO.Scene) @@ -32,6 +71,8 @@ P4.GameScene.prototype.activate = function() this.warmup = true + GO.Sound.play('getready') + if (GO.debug) { this.warmup = false } @@ -47,7 +88,7 @@ P4.GameScene.prototype.activate = function() P4.GameScene.prototype.onPlayerDied = function() { if (this.player.lives <= 0) { - GO.scenes.end = new P4.EndScene + GO.scenes.end = new P4.EndScene('Game Over', this.player.score, this.player.diff) GO.setScene(GO.scenes.end) P4.track('gameover') return false @@ -71,6 +112,23 @@ P4.GameScene.prototype.process = function() this.clear() + /* BG GRADIENT **************************/ +// //GO.ctx.globalCompositeOperation = 'source-over' +// if (!this.gc) { +// this.gc = 0 +// } +// this.gc += GO.delta * 3 +// if (this.gc > GO.Screen.width + 500) { +// this.gc = -500 +// } +// var grd = GO.ctx.createRadialGradient(this.gc, 0, 0, this.gc, 300, 500); +// grd.addColorStop(0, "#333"); +// grd.addColorStop(1, "#000"); +// GO.ctx.fillStyle = grd; +// GO.ctx.fillRect(0, 0, GO.Screen.width, GO.Screen.height) +// //GO.ctx.globalCompositeOperation = 'lighter' + /* BG GRADIENT **************************/ + if (this.warmup) { GO.ctx.font = '12px ' + GO.config.fontName GO.ctx.textAlign = 'center' @@ -104,28 +162,103 @@ P4.GameScene.prototype.process = function() GO.ctx.fillRect(0, 0, GO.Screen.width, GO.Screen.height) this.player.hit = false } + + this.drawOverlay() +} + +P4.GameScene.prototype.setOverlayColor = function(rgb) +{ + if (!rgb) { + rgb = '0,0,0' + } + + if (!this.overlayColor) { + this.overlayColor = rgb + this.overlayAlpha = 0 + return + } + + if (this.overlayColor == rgb) { + return + } + + this.overlayNextColor = rgb +} + +P4.GameScene.prototype.drawOverlay = function() +{ + if (this.overlayFadeout) { + this.overlayAlpha -= 0.1 * GO.delta + if (this.overlayAlpha <= -0.1) { + this.overlayColor = this.overlayNextColor + this.overlayNextColor = false + this.overlayFadeout = false + } + } else { + this.overlayAlpha += 0.1 * GO.delta + if (this.overlayAlpha >= 0.15) { + this.overlayAlpha = 0.15 + + if (this.overlayNextColor) { + this.overlayFadeout = true + } + } + } + + if (this.overlayColor) { + GO.ctx.globalCompositeOperation = 'lighter' + GO.ctx.fillStyle = 'rgba(' + this.overlayColor + ', ' + this.overlayAlpha + ')' + GO.ctx.fillRect(0, 0, GO.Screen.width, GO.Screen.height) + GO.ctx.globalCompositeOperation = 'source-over' + } } P4.GameScene.prototype.drawHUD = function() { + GO.ctx.font = '8px ' + GO.config.fontName GO.ctx.textBaseline = 'alphabetic' - GO.ctx.textAlign = 'right' - GO.ctx.font = '8px ' + GO.config.fontName - GO.ctx.fillStyle = 'white' - GO.ctx.fillText('Player x ' + this.player.lives, GO.Screen.width - 10, GO.Screen.height - 10) - - GO.ctx.textAlign = 'left' - GO.ctx.fillText('Energy:', 100, GO.Screen.height - 10) - + /* level text */ if (this.level.levelText) { - GO.ctx.fillText(this.level.levelText, 10, GO.Screen.height - 10) + GO.ctx.fillStyle = 'white' + GO.ctx.textAlign = 'left' + GO.ctx.fillText(this.level.levelText + ' - ' + this.level.diffText, 10, GO.Screen.height - 10) } + /* energy */ + GO.ctx.textAlign = 'left' + GO.ctx.fillText('Energy:', 150, GO.Screen.height - 10) + GO.ctx.fillStyle = (this.player.energy <= 3 ? 'red' : 'white') GO.ctx.strokeStyle = GO.ctx.fillStyle GO.ctx.lineWidth = 1 - GO.ctx.strokeRect(165, GO.Screen.height - 16, 1 + 100, 5) - GO.ctx.fillRect(165, GO.Screen.height - 16, 1 + (10 * this.player.energy), 5) + GO.ctx.strokeRect(215, GO.Screen.height - 16, P4.Player.prototype.energy * 3, 5) + GO.ctx.fillRect(215, GO.Screen.height - 16, this.player.energy * 3, 5) + + /* score */ + GO.ctx.fillStyle = 'white' + GO.ctx.textAlign = 'left' + GO.ctx.fillText('Score: ' + this.player.score, GO.Screen.width - 280, GO.Screen.height - 10) + + /* player lives */ + GO.ctx.textAlign = 'right' + GO.ctx.fillStyle = 'white' + GO.ctx.fillText('Player x ' + this.player.lives, GO.Screen.width - 10, GO.Screen.height - 10) + + if (!GO.debug) { + return + } + + GO.ctx.textAlign = 'right' + GO.ctx.fillStyle = 'white' + GO.ctx.fillText('wait: ' + this.level.wait + ' : forcewait: ' + this.level.forcewait, GO.Screen.width - 10, GO.Screen.height - 50) + + GO.ctx.textAlign = 'right' + GO.ctx.fillStyle = 'white' + GO.ctx.fillText('Enemycount: ' + P4.Enemy.count, GO.Screen.width - 10, GO.Screen.height - 30) + +// GO.ctx.textAlign = 'right' +// GO.ctx.fillStyle = 'white' +// GO.ctx.fillText('Step: ' + this.level.stepindex, GO.Screen.width - 10, GO.Screen.height - 60) } diff --git a/game/IntroScene.js b/game/IntroScene.js index d3dce23..22b426d 100644 --- a/game/IntroScene.js +++ b/game/IntroScene.js @@ -25,12 +25,6 @@ P4.IntroScene = function() this.layers.fg.push(p) this.titleSize = 0 - - this.blinkTimer = new GO.Timer(500, function() { - this.blink = ! this.blink - }, this) - this.blinkTimer.pause = true - this.layers.handlers.push(this.blinkTimer) } GO.Util.extend(P4.IntroScene, GO.Scene) @@ -42,10 +36,25 @@ P4.IntroScene.prototype.activate = function() /* allow click after time period */ this.layers.handlers.push(new GO.Timer(1500, function() { this.locked = false - this.blinkTimer.reset() - this.blinkTimer.pause = false return false }, this)) + + GO.Sound.play('intro') + + this.setMainMenu() +} + +P4.IntroScene.prototype.setMainMenu = function() +{ + this.items = [] + + var continueLevel = P4.GameState.get('level') + if (continueLevel) { + this.items.push('continue') + } + + this.items.push('new game') + this.items.push('quit') } P4.IntroScene.prototype.process = function() @@ -53,8 +62,8 @@ P4.IntroScene.prototype.process = function() this.clear() this.drawTitle() - this.drawSubTitle() - this.drawCredit() + this.drawMenu() + this.drawFooter() if (!P4.IntroScene.superproto.process.call(this)) { return @@ -79,29 +88,155 @@ P4.IntroScene.prototype.drawTitle = function() GO.ctx.fillStyle = '#fff' GO.ctx.textBaseline = 'middle' GO.ctx.textAlign = 'center' - GO.ctx.fillText('prototype4', GO.Screen.width / 2, GO.Screen.height / 2) + GO.ctx.fillText('prototype4', GO.Screen.width / 2, GO.Screen.height / 2 - 50) } -P4.IntroScene.prototype.drawSubTitle = function() +P4.IntroScene.prototype.drawMenu = function() { - if (this.locked || this.blink) { + if (this.locked) { return } GO.ctx.font = '20px ' + GO.config.fontName - GO.ctx.fillStyle = '#fff' - GO.ctx.textBaseline = 'middle' + GO.ctx.fillStyle = '#999' + GO.ctx.textBaseline = 'alphabetic' GO.ctx.textAlign = 'center' - GO.ctx.fillText('insert coin', GO.Screen.width / 2, GO.Screen.height / 2 + 100) + + var x = GO.Screen.width / 2 + ,y = GO.Screen.height / 2 + 100 + ,sel = false + + for (var i = 0; i < this.items.length; i += 1) { + if (this.drawMenuItem(i, this.items[i])) { + sel = true + } + } + + if (!sel) { + this.lastMenuItem = false + } } -P4.IntroScene.prototype.drawCredit = function() +P4.IntroScene.prototype.drawMenuItem = function(i, txt, onclick) +{ + var h = 40 + ,x = GO.Screen.width / 2 + ,y = GO.Screen.height / 2 + 25 + (i * h) + ,sel = 0 + + if (GO.Event.Mouse.y > y + && GO.Event.Mouse.y < y + h + && GO.Event.Mouse.x < x + 150 + && GO.Event.Mouse.x > x - 150) { + + sel = true + } + + GO.ctx.font = '20px ' + GO.config.fontName + GO.ctx.textBaseline = 'top' + GO.ctx.textAlign = 'center' + GO.ctx.fillStyle = (sel ? '#aff' : '#999') + GO.ctx.fillText(sel ? '[ ' + txt + ' ]' : txt, x, y) + + if (sel && GO.Event.Mouse.click) { + GO.Sound.play('menu_click') + this.handleMenuItemClick(txt) + } + + if (sel && this.lastMenuItem != txt) { + GO.Sound.play('select') + this.lastMenuItem = txt + } + + return sel +} + +P4.IntroScene.prototype.handleMenuItemClick = function(item) +{ + switch (item) { + case 'continue': + this.beginGame(P4.GameState.data) + break + + case 'new game': + P4.track('menu-newgame') + this.clickNewGame() + break + + case 'quit': + if (ext && ext.quit) { + P4.track('quit') + ext.quit() + } + break + + case 'BACK': + this.setMainMenu() + break + + case 'easy': + P4.track('menu-diff-easy') + this.beginGame({ diff: 0 }) + break + + case 'normal': + P4.track('menu-diff-normal') + this.beginGame({ diff: 1 }) + break + + case 'hard': + P4.track('menu-diff-hard') + this.beginGame({ diff: 2 }) + break + + case 'ultra': + P4.track('menu-diff-ultra') + this.beginGame({ diff: 3 }) + break + } +} + +P4.IntroScene.prototype.clickNewGame = function() +{ + this.items = [] + this.items.push('easy') + this.items.push('normal') + this.items.push('hard') + this.items.push('ultra') + this.items.push('BACK') +} + +P4.IntroScene.prototype.drawFooter = function() { GO.ctx.font = '8px ' + GO.config.fontName GO.ctx.fillStyle = '#666' GO.ctx.textBaseline = 'bottom' GO.ctx.textAlign = 'right' GO.ctx.fillText('A Game By Sebastian Volland', GO.Screen.width - 5, GO.Screen.height - 5) + + var diff = P4.DiffFromText(this.lastMenuItem) + + if (P4.GameState.data.highscore + && diff !== false + && P4.GameState.data.highscore[diff]) { + + GO.ctx.textBaseline = 'bottom' + GO.ctx.textAlign = 'left' + GO.ctx.fillText('HIGHSCORE: ' + P4.GameState.data.highscore[diff], 5, GO.Screen.height - 5) + } +} + +P4.IntroScene.prototype.beginGame = function(gameState) +{ + t = new GO.Transition + t.v = 2 + t.ondone = { + fn: function() { + GO.scenes.game = new P4.GameScene(gameState) + GO.setScene(GO.scenes.game) + }, ctx: this + } + this.layers.transition.push(t) } P4.IntroScene.prototype.handleEvent = function() @@ -112,18 +247,9 @@ P4.IntroScene.prototype.handleEvent = function() return } - if (GO.Event.Mouse.click || GO.Event.Keyboard.chrLower == 'a') { + if (false && GO.Event.Mouse.click || GO.Event.Keyboard.chrLower == 'a') { this.locked = true - - t = new GO.Transition - t.v = 2 - t.ondone = { - fn: function() { - GO.scenes.game = new P4.GameScene - GO.setScene(GO.scenes.game) - }, ctx: this - } - this.layers.transition.push(t) + this.beginGame() } } diff --git a/game/Level.js b/game/Level.js index fc1675a..0623cfc 100644 --- a/game/Level.js +++ b/game/Level.js @@ -1,11 +1,15 @@ -P4.Level = function(scene) +P4.Level = function(scene, startWith) { this.scene = scene + if (startWith) { + this.startWith = startWith + } + if (this.startWith) { for (var i = 0; i <= this.sequence.length; i += 1) { - if (this.startWith == this.sequence[i]) { + if (this.sequence[i].level && this.startWith == this.sequence[i].level) { this.stepindex = i break } @@ -20,7 +24,7 @@ P4.Level.prototype.stepindex = 0 P4.Level.prototype.wait = 0 P4.Level.prototype.forcewait = 0 P4.Level.prototype.lastLevelIndex = 0 -//P4.Level.prototype.startWith = 'Level 10' +//P4.Level.prototype.startWith = 18 P4.Level.prototype.pattern.powerupW = function() { @@ -31,14 +35,40 @@ P4.Level.prototype.pattern.powerupW = function() GO.scenes.game.layers.fg.push(p) } +P4.Level.prototype.pattern.powerupE = function() +{ + var p = new P4.Powerup + p.x = Math.random() * GO.Screen.width + p.y = 0 + p.type = 'e' + GO.scenes.game.layers.fg.push(p) +} + P4.Level.prototype.pattern.star = function() { + GO.Sound.play('enemystar') var a = new P4.EnemyStar() a.x = Math.random() * GO.Screen.width a.y = -10 this.scene.layers.fg.push(a) } +P4.Level.prototype.pattern.minis = function() +{ + GO.Sound.play('minis') + + for (var i = 0; i < 20; i += 1) { + var c = { r: -1, g: 255, b: 255 } + ,ec = { r: -1, g: 255, b: 255 } + ,a = new P4.EnemyShip(c, ec) + + a.x = 100 + (GO.Screen.width - 200) * Math.random() + a.v = 1 + (Math.random() * 2) + a.size = 0.2 + this.scene.layers.fg.push(a) + } +} + P4.Level.prototype.pattern.singlerandom = function() { var a = new P4.EnemyShipPurple() @@ -148,6 +178,212 @@ P4.Level.prototype.pattern.n5 = function() } } +P4.Level.prototype.pattern.rush1 = function() +{ + for (var i = 0; i < 5; i += 1) { + var a = new P4.EnemyShipBlue() + a.x = 100 + (GO.Screen.width - 200) * Math.random() + a.life = 5 + a.v = 0.5 + (Math.random() * 2) + this.scene.layers.fg.push(a) + } +} + +P4.Level.prototype.pattern.rush2 = function() +{ + for (var i = 0; i < 8; i += 1) { + var a = new P4.EnemyShipOrange() + a.x = 100 + (GO.Screen.width - 200) * Math.random() + a.life = 5 + a.v = 0.5 + (Math.random() * 2) + this.scene.layers.fg.push(a) + } +} + +P4.Level.prototype.pattern.rush3 = function() +{ + var l = 8 + ,powerup = this.step.powerup ? Math.floor(Math.random() * l) : false + + for (var i = 0; i < l; i += 1) { + var a = new P4.EnemyShipLime() + a.x = 100 + (GO.Screen.width - 200) * Math.random() + a.life = 5 + a.v = 0.5 + (Math.random() * 2) + + if (i == powerup) { + a.powerup = this.step.powerup + } + + this.scene.layers.fg.push(a) + } +} + +P4.Level.prototype.pattern.linelimeslow = function() +{ + var l = 12 + ,powerup = this.step.powerup ? Math.floor(Math.random() * l) : false + + for (var i = 0; i < l; i += 1) { + a = new P4.EnemyShipLime() + a.x = (GO.Screen.width / (l - 1)) * i + + if (i == powerup) { + a.powerup = this.step.powerup + } + + this.scene.layers.fg.push(a) + } +} + +P4.Level.prototype.pattern.formation1 = function(d, y) +{ + a = new P4.EnemyShipLime() + a.x = (GO.Screen.width / 2) - d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) - d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) + + a = new P4.EnemyShipLime() + a.x = (GO.Screen.width / 2) + d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) + d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) +} + +P4.Level.prototype.pattern.formation2 = function(d, y) +{ + a = new P4.EnemyShipOrange() + a.x = (GO.Screen.width / 2) - d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) - d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) + + a = new P4.EnemyShipOrange() + a.x = (GO.Screen.width / 2) + d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) + d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) +} + +P4.Level.prototype.pattern.formation3 = function(d, y) +{ + var c = { r: 255, g: 0, b: -1 } + ,ec = { r: 255, g: 0, b: -1 } + + a = new P4.EnemyShip(c, ec) + a.x = (GO.Screen.width / 2) - d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) - d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) + + a = new P4.EnemyShip(c, ec) + a.x = (GO.Screen.width / 2) + d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) + d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) +} + +P4.Level.prototype.pattern.formation4 = function(d, y) +{ + var c = { r: -1, g: 255, b: 0 } + ,ec = { r: -1, g: 255, b: 0 } + + a = new P4.EnemyShip(c, ec) + a.x = (GO.Screen.width / 2) - d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) - d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) + + a = new P4.EnemyShip(c, ec) + a.x = (GO.Screen.width / 2) + d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) + d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) +} + +P4.Level.prototype.pattern.formation5 = function(d, y) +{ + var c = { r: 0, g: -1, b: 255 } + ,ec = { r: 0, g: -1, b: 255 } + + a = new P4.EnemyShip(c, ec) + a.x = (GO.Screen.width / 2) - d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) - d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) + + a = new P4.EnemyShip(c, ec) + a.x = (GO.Screen.width / 2) + d + a.y = -10 + a.canFlyAway = false + a.canFollowPlayer = false + a.tx = (GO.Screen.width / 2) + d + a.ty = y + a.v = 3 + this.scene.layers.fg.push(a) +} + +P4.Level.prototype.pattern.kamikaze = function() +{ + var c = { r: -1, g: 255, b: -1 } + ,ec = { r: -1, g: 255, b: -1 } + + a = new P4.EnemyShip(c, ec) + a.x = (GO.Screen.width / 2) + 200 + a.y = -10 + a.v = 1 + a.size = 0.8 + a.canFlyAway = false + a.canFollowPlayer = true + this.scene.layers.fg.push(a) + + a = new P4.EnemyShip(c, ec) + a.x = (GO.Screen.width / 2) - 200 + a.y = -10 + a.v = 1 + a.size = 0.8 + a.canFlyAway = false + a.canFollowPlayer = true + this.scene.layers.fg.push(a) +} + P4.Level.prototype.process = function() { if (this.levelText && this.drawLevelText) { @@ -158,7 +394,7 @@ P4.Level.prototype.process = function() GO.ctx.fillText(this.levelText, GO.Screen.width / 2, GO.Screen.height / 2 - 30) } - this.processStep() + this.processSteps() } P4.Level.prototype.gotoLast = function() @@ -167,55 +403,107 @@ P4.Level.prototype.gotoLast = function() this.step = false } -P4.Level.prototype.processStep = function() +P4.Level.prototype.processSteps = function() { + if (GO.tick == this.lasttick) { + return + } else { + this.lasttick = GO.tick + } + + /* wait until player respawn */ if (this.scene.player.heaven) { return } - if (this.stepindex > this.sequence.length - 1 - && P4.Enemy.count <= 0) { + /* all levels done => endscene */ + if (this.stepindex > this.sequence.length - 1) { + if (P4.Enemy.count > 0) { + return + } - GO.scenes.end = new P4.EndScene('Well Done', 'you finished the game') + GO.scenes.end = new P4.EndScene('Well Done', this.scene.player.score, this.scene.player.diff) GO.setScene(GO.scenes.end) P4.track('finished') return } - if (GO.tick != this.lasttick) { - if (this.forcewait > 0) { - this.forcewait -= 1 - } else if (this.wait > 0) { - this.wait -= 1 - } else if (!this.step) { - if (typeof this.sequence[this.stepindex] == 'string') { - if (P4.Enemy.count <= 0) { - this.levelText = this.sequence[this.stepindex] - P4.track(this.levelText) - this.drawLevelText = true - this.lastLevelIndex = this.stepindex - this.forcewait = 20 - this.stepindex += 1 - } + if (this.forcewait > 0) { + this.forcewait -= 1 + return + } + + if (this.wait > 0) { + this.wait -= 1 + return + } + + if (this.step) { + if (this.step.color !== undefined) { + if (this.step.color) { + this.scene.setOverlayColor(this.step.color) } else { - this.drawLevelText = false - this.step = this.sequence[this.stepindex] - if (!this.step) { - this.step = false - this.stepindex += 1 - } else { - this.wait = this.step.w - } - } - } else { - if (this.step.p) { - this.pattern[this.step.p].call(this) + this.scene.setOverlayColor(false) } - this.step = false - this.stepindex += 1 } + + if (this.step.waitforenemiesdead && P4.Enemy.count > 0) { + return + } + + if (this.step.p && typeof this.step.p == 'string') { + this.pattern[this.step.p].call(this) + } else if (this.step.p) { + this.step.p.call(this) + } + + this.step = false + this.stepindex += 1 + return + } + + var seq = this.sequence[this.stepindex] - this.lasttick = GO.tick + if (seq.level) { + if (P4.Enemy.count > 0) { + return + } + + GO.Sound.play('level_start') + + if (seq.color) { + this.scene.setOverlayColor(seq.color) + } else { + this.scene.setOverlayColor(false) + } + + this.levelText = 'Level ' + seq.level + this.diffText = P4.FormatDiff(this.scene.player.diff) + + if (seq.level > 1) { + P4.GameState.data['level'] = seq.level + P4.GameState.data['score'] = this.scene.player.score + P4.GameState.data['lives'] = this.scene.player.lives + P4.GameState.commit() + } + + P4.track(this.levelText) + + this.drawLevelText = true + this.lastLevelIndex = this.stepindex + this.forcewait = 20 + this.stepindex += 1 + return + } + + this.drawLevelText = false + this.step = this.sequence[this.stepindex] + if (!this.step) { + this.step = false + this.stepindex += 1 + return + } else { + this.wait = this.step.w } } diff --git a/game/LevelPattern.js b/game/LevelPattern.js index b5b6d86..cb536c2 100644 --- a/game/LevelPattern.js +++ b/game/LevelPattern.js @@ -1,39 +1,172 @@ P4.Level.prototype.sequence = [ - 'Level 1' - ,{ w: 0, p: 'lineblueslow', powerup: 1 } - ,{ w: 20, p: 'singlerandom' } - ,{ w: 20, p: 'singlerandom' } - ,{ w: 20, p: 'singlerandom' } - ,{ w: 20, p: 'singlerandom' } + { level: 1 } + ,{ w: 0, p: 'singlerandom' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 0, p: 'powerupW' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } ,{ w: 20, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 0, p: 'powerupW' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'linepurple' } + ,{ w: 20, p: 'lineblueslow' } + ,{ w: 0, p: 'powerupW' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 0, p: 'lineblueslow' } + ,{ w: 50, p: 'lineblueslow' } + ,{ w: 100, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } ,{ w: 20, p: 'singlerandom' } - ,{ w: 0, p: 'lineblueslow', powerup: 1 } - ,{ w: 5, p: 'singlerandom' } - ,{ w: 5, p: 'singlerandom' } - ,{ w: 5, p: 'singlerandom' } - ,{ w: 5, p: 'singlerandom' } - ,{ w: 5, p: 'singlerandom' } - ,{ w: 5, p: 'singlerandom' } - ,{ w: 50, p: 'linepurple' } - ,{ w: 50, p: 'lineblueslow', powerup: 1 } - - ,'Level 2' - ,{ w: 50, p: 'n4' } - ,{ w: 50, p: 'n5' } - ,{ w: 50, p: 'n4' } - ,{ w: 50, p: 'n5' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 0, p: 'powerupW' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'linepurple' } + ,{ w: 20, p: 'lineblueslow' } + ,{ w: 0, p: 'powerupW' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + + ,{ level: 2 } + ,{ w: 0, p: 'powerupW' } + ,{ w: 0, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n5' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n5' } ,{ w: 0, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 0, p: 'powerupE' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n5' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n5' } ,{ w: 0, p: 'star' } - ,{ w: 50, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 0, p: 'powerupE' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 0, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n5' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n5' } + ,{ w: 0, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 0, p: 'powerupE' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n5' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n5' } ,{ w: 0, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 5, p: 'star' } + ,{ w: 0, p: 'powerupE' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ w: 1, p: 'singlerandom' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } - ,'Level 3' - ,{ w: 50, p: 'yellowline', powerup: 1 } - ,{ w: 100, p: 'n4' } + ,{ level: 3 } + ,{ w: 0, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } ,{ w: 0, p: 'n5' } - ,{ w: 50, p: 'lineblueslow', powerup: 1 } - ,{ w: 100, p: 'star' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } + ,{ w: 0, p: 'n5' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'n4' } + ,{ w: 0, p: 'n5' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } @@ -41,215 +174,1098 @@ P4.Level.prototype.sequence = [ ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,'Level 4' + ,{ level: 4 } + ,{ w: 0, p: 'powerupW' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'lineblueslow' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'lineblueslow', powerup: 1 } + ,{ w: 10, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'lineblueslow', powerup: 1 } + ,{ w: 10, p: 'lineblueslow' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'lineblueslow', powerup: 1 } + ,{ w: 10, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } - ,{ w: 100, p: 'lineblueslow', powerup: 1 } ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'lineblueslow' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'lineblueslow', powerup: 1 } ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'lineblueslow', powerup: 1 } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'lineblueslow' } - ,'Level 5' + ,{ level: 5 } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n5' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'n4', powerup: 1 } ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'n5', powerup: 1 } ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'n5' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'n4', powerup: 1 } ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } - ,{ w: 100, p: 'n5', powerup: 1 } ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'n5' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'n4', powerup: 1 } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'n5', powerup: 1 } + ,{ w: 0, p: 'n5' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'n5' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'n5' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'n5' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'n5' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n4' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'n5' } - ,'Level 6' - ,{ w: 10, p: 'yellowline', powerup: 1 } + ,{ level: 6 } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'yellowline' } ,{ w: 10, p: 'star' } ,{ w: 10, p: 'singlerandom' } ,{ w: 10, p: 'star' } ,{ w: 10, p: 'singlerandom' } ,{ w: 10, p: 'star' } - ,{ w: 10, p: 'yellowline', powerup: 1 } + ,{ w: 10, p: 'yellowline' } ,{ w: 10, p: 'singlerandom' } ,{ w: 10, p: 'star' } ,{ w: 10, p: 'singlerandom' } ,{ w: 10, p: 'star' } ,{ w: 10, p: 'singlerandom' } - ,{ w: 10, p: 'yellowline', powerup: 1 } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'yellowline' } ,{ w: 10, p: 'star' } ,{ w: 10, p: 'singlerandom' } ,{ w: 10, p: 'star' } ,{ w: 10, p: 'singlerandom' } ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'yellowline' } ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ w: 10, p: 'star' } + ,{ w: 10, p: 'singlerandom' } + ,{ waitforenemiesdead: true } - ,'Level 7' - ,{ w: 0, p: 'powerupW' } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 100, p: 'yellowline', powerup: 1 } - ,{ w: 0, p: 'powerupW' } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 100, p: 'yellowline', powerup: 1 } - ,{ w: 0, p: 'powerupW' } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'yellowline', powerup: 1 } - ,{ w: 100, p: 'yellowline', powerup: 1 } + ,{ level: 7 } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } - ,'Level 8' + ,{ level: 8 } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 20, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 30, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'yellowline' } ,{ w: 0, p: 'powerupW' } - ,{ w: 10, p: 'lineblueslow', powerup: 1 } + ,{ w: 10, p: 'lineblueslow' } ,{ w: 0, p: 'star' } - ,{ w: 20, p: 'lineblueslow', powerup: 1 } + ,{ w: 20, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } - ,{ w: 30, p: 'lineblueslow', powerup: 1 } + ,{ w: 30, p: 'lineblueslow' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'yellowline', powerup: 1 } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'powerupW' } - ,{ w: 10, p: 'lineblueslow', powerup: 1 } + ,{ w: 10, p: 'lineblueslow' } ,{ w: 0, p: 'star' } - ,{ w: 20, p: 'lineblueslow', powerup: 1 } + ,{ w: 20, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } - ,{ w: 30, p: 'lineblueslow', powerup: 1 } + ,{ w: 30, p: 'lineblueslow' } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'yellowline', powerup: 1 } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'powerupW' } - ,{ w: 10, p: 'lineblueslow', powerup: 1 } + ,{ w: 10, p: 'lineblueslow' } ,{ w: 0, p: 'star' } - ,{ w: 20, p: 'lineblueslow', powerup: 1 } + ,{ w: 20, p: 'lineblueslow' } ,{ w: 0, p: 'star' } - ,{ w: 30, p: 'lineblueslow', powerup: 1 } + ,{ w: 30, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } ,{ w: 0, p: 'star' } - ,{ w: 10, p: 'yellowline', powerup: 1 } + ,{ w: 10, p: 'yellowline' } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 20, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 30, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 20, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 30, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 20, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 30, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'yellowline' } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 20, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 30, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'yellowline' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'powerupW' } + ,{ w: 10, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 20, p: 'lineblueslow' } + ,{ waitforenemiesdead: true } + ,{ w: 0, p: 'star' } + ,{ w: 30, p: 'lineblueslow' } + ,{ w: 0, p: 'star' } + ,{ w: 10, p: 'yellowline' } - ,'Level 9' + ,{ level: 9, color: '52,170,202' } ,{ w: 0, p: 'powerupW' } ,{ w: 0, p: 'powerupW' } ,{ w: 0, p: 'powerupW' } - ,{ w: 50, p: 'yellowline', powerup: 1 } + ,{ w: 50, p: 'yellowline' } ,{ w: 10, p: 'n4' } ,{ w: 0, p: 'n5' } - ,{ w: 50, p: 'lineblueslow', powerup: 1 } + ,{ w: 50, p: 'lineblueslow' } ,{ w: 10, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 50, p: 'yellowline', powerup: 1 } + ,{ w: 50, p: 'yellowline' } ,{ w: 10, p: 'n4' } ,{ w: 0, p: 'n5' } - ,{ w: 50, p: 'lineblueslow', powerup: 1 } + ,{ w: 50, p: 'lineblueslow' } ,{ w: 10, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 50, p: 'yellowline', powerup: 1 } + ,{ w: 50, p: 'yellowline' } ,{ w: 10, p: 'n4' } ,{ w: 0, p: 'n5' } - ,{ w: 50, p: 'lineblueslow', powerup: 1 } + ,{ w: 50, p: 'lineblueslow' } ,{ w: 10, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,'Level 10' - ,{ w: 10, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'yellowline', powerup: 1 } - ,{ w: 10, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'yellowline' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } - ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } ,{ w: 0, p: 'star' } + ,{ level: 10, color: '52,170,202' } + ,{ w: 0, p: function() { + var a = new P4.EnemyBoss() + this.scene.layers.fg.push(a) + }} + + ,{ level: 11 } + ,{ w: 0, p: 'powerupW' } + ,{ w: 5, p: 'powerupW' } + ,{ w: 30, p: 'linelimeslow' } + ,{ w: 20, p: 'rush1' } + ,{ w: 20, p: 'rush2' } + ,{ w: 0, p: 'powerupE' } + ,{ w: 0, p: 'powerupE' } + ,{ w: 0, p: 'powerupE' } + ,{ w: 0, p: 'powerupW' } + ,{ w: 5, p: 'powerupW' } + ,{ w: 30, p: 'linelimeslow' } + ,{ w: 20, p: 'rush1' } + ,{ w: 20, p: 'rush2' } + ,{ w: 0, p: 'powerupW' } + ,{ w: 5, p: 'powerupW' } + ,{ w: 30, p: 'linelimeslow' } + ,{ w: 20, p: 'rush1' } + ,{ w: 20, p: 'rush2' } + ,{ w: 0, p: 'powerupW' } + ,{ w: 5, p: 'powerupW' } + ,{ w: 30, p: 'linelimeslow' } + ,{ w: 20, p: 'rush1' } + ,{ w: 20, p: 'rush2' } + ,{ w: 0, p: 'powerupW' } + ,{ w: 5, p: 'powerupW' } + ,{ w: 30, p: 'linelimeslow' } + ,{ w: 30, p: 'linelimeslow' } + ,{ w: 30, p: 'linelimeslow' } + ,{ w: 20, p: 'rush1' } + ,{ w: 20, p: 'rush2' } + ,{ w: 20, p: 'rush1' } + ,{ w: 20, p: 'rush2' } + + ,{ level: 12 } + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 170) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 190) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 200, 210) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 250, 230) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 300, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 350, 270) }} + ,{ w: 1, p: 'powerupW' } + ,{ w: 1, p: 'minis' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 120) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 140) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 200, 160) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 250, 180) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 300, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 350, 220) }} + ,{ w: 20, p: 'minis' } + ,{ waitforenemiesdead: true } + ,{ w: 20, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 60, 150) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 110, 170) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 160, 190) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 210, 210) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 260, 230) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 310, 250) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 360, 270) }} + ,{ w: 20, p: 'minis' } + ,{ w: 20, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 60, 100) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 110, 120) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 160, 140) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 210, 160) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 260, 180) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 310, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 360, 220) }} + + ,{ level: 13 } + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 25, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 200, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 250, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 150) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 0, 20) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 50, 20) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 100, 20) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 150, 20) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 200, 20) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 250, 20) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 300, 20) }} + ,{ waitforenemiesdead: true } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 0, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 200, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 250, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 300, 100) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 0, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 200, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 250, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 300, 150) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 0, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 200, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 250, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 300, 200) }} + + ,{ level: 14 } + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 0, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 150, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 200, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 250, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 300, 100) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 0, 150) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 50, 150) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 150) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 150, 150) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 200, 150) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 250, 150) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 300, 150) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 0, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 50, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 150, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 200, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 250, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 300, 200) }} + ,{ waitforenemiesdead: true } + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 0, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 150, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 200, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 250, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 300, 100) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 0, 150) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 50, 150) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 150) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 150, 150) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 200, 150) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 250, 150) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 300, 150) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 0, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 50, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 150, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 200, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 250, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 300, 200) }} + ,{ w: 5, p: 'powerupW' } + ,{ waitforenemiesdead: true } + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 0, 100) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 150, 100) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 200, 100) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 250, 100) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 300, 100) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 0, 150) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 50, 150) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 100, 150) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 150, 150) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 200, 150) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 250, 150) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 300, 150) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 0, 200) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 50, 200) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 150, 200) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 200, 200) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 250, 200) }} + ,{ w: 1, p: function() { this.pattern.formation5.call(this, 300, 200) }} + ,{ w: 5, p: 'powerupW' } + + ,{ level: 15 } + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 0, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 150, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 200, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 250, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 300, 100) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 25, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 200, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 250, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 150) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 5, p: 'rush1' } + ,{ w: 20, p: 'rush1' } + ,{ w: 20, p: 'rush1' } + ,{ waitforenemiesdead: true } + ,{ w: 5, p: 'rush1' } + ,{ w: 20, p: 'rush1' } + ,{ w: 20, p: 'rush1' } + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 0, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 150, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 200, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 250, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 300, 100) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 25, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 150) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 200, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 250, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 150) }} + ,{ w: 5, p: 'powerupW' } + + ,{ level: 16 } + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 50) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 100) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 150) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 300) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 350) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 300, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 150, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 300, 300) }} + ,{ waitforenemiesdead: true } + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 50) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 100) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 150) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 250) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 350) }} + ,{ w: 20, p: 'minis' } + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 250) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 150, 250) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 300, 250) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 300) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 150, 300) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 300, 300) }} + ,{ w: 20, p: 'minis' } + ,{ waitforenemiesdead: true } + ,{ w: 5, p: 'powerupW' } + ,{ w: 0, p: function() { this.pattern.formation5.call(this, 20, 50) }} + ,{ w: 0, p: function() { this.pattern.formation5.call(this, 20, 100) }} + ,{ w: 0, p: function() { this.pattern.formation5.call(this, 20, 150) }} + ,{ w: 0, p: function() { this.pattern.formation5.call(this, 20, 200) }} + ,{ w: 0, p: function() { this.pattern.formation5.call(this, 20, 250) }} + ,{ w: 0, p: function() { this.pattern.formation5.call(this, 20, 300) }} + ,{ w: 0, p: function() { this.pattern.formation5.call(this, 20, 350) }} + ,{ w: 20, p: 'minis' } + ,{ w: 0, p: 'star' } + ,{ w: 0, p: function() { this.pattern.formation4.call(this, 100, 250) }} + ,{ w: 0, p: function() { this.pattern.formation4.call(this, 150, 250) }} + ,{ w: 0, p: function() { this.pattern.formation4.call(this, 300, 250) }} + ,{ w: 0, p: function() { this.pattern.formation4.call(this, 100, 300) }} + ,{ w: 0, p: function() { this.pattern.formation4.call(this, 150, 300) }} + ,{ w: 0, p: function() { this.pattern.formation4.call(this, 300, 300) }} + ,{ w: 20, p: 'minis' } + ,{ w: 1, p: 'star' } + ,{ w: 5, p: 'powerupW' } + + ,{ level: 17 } + ,{ w: 5, p: 'powerupW' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 1, p: 'star' } + ,{ w: 5, p: 'powerupW' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 1, p: 'star' } + ,{ w: 5, p: 'powerupW' } + ,{ w: 5, p: 'powerupE' } + ,{ w: 50, p: 'lineblueslow', powerup: 1 } + ,{ w: 5, p: 'minis' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 5, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: 'star' } + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + + ,{ level: 18 } + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 200) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 100) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 50) }} + ,{ w: 5, p: 'powerupW' } + ,{ waitforenemiesdead: true } + ,{ w: 50, p: function() { this.pattern.formation2.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 120, 200) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 100) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 50) }} + ,{ waitforenemiesdead: true } + ,{ w: 5, p: 'powerupW' } + ,{ w: 50, p: function() { this.pattern.formation3.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 120, 200) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 20, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 40, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 60, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 80, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 120, 100) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 50) }} + ,{ waitforenemiesdead: true } + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 200) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 5, p: 'minis' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 100) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 50) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 5, p: 'minis' } + ,{ waitforenemiesdead: true } + ,{ w: 50, p: function() { this.pattern.formation2.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 120, 200) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 5, p: 'minis' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 100) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 50) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 5, p: 'minis' } + ,{ w: 50, p: function() { this.pattern.formation3.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 120, 200) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 20, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 40, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 60, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 80, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 100) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 120, 100) }} + ,{ w: 20, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 1, p: function() { this.pattern.kamikaze.call(this) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 50) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 50) }} + ,{ w: 5, p: 'minis' } + + ,{ level: 19, color: '143,10,139' } + ,{ w: 5, p: 'powerupW' } + ,{ w: 50, p: 'yellowline', powerup: 1 } + ,{ w: 20, p: 'rush2' } + ,{ waitforenemiesdead: true } + ,{ w: 1, p: 'powerupW' } + ,{ w: 1, p: 'yellowline', powerup: 1 } + ,{ w: 1, p: 'rush1' } + ,{ waitforenemiesdead: true } + ,{ w: 1, p: 'powerupW' } + ,{ w: 1, p: 'yellowline', powerup: 1 } + ,{ w: 1, p: 'rush2' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 10, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 30, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 70, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 90, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 110, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 130, 300) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 140, 300) }} + ,{ waitforenemiesdead: true } + ,{ w: 20, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 10, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 30, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 70, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 90, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 110, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 130, 250) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 140, 250) }} + ,{ waitforenemiesdead: true } + ,{ w: 20, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 10, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 30, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 50, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 70, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 90, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 110, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 120, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 130, 200) }} + ,{ w: 1, p: function() { this.pattern.formation1.call(this, 140, 200) }} + ,{ w: 5, p: 'powerupW' } + ,{ w: 50, p: 'yellowline', powerup: 1 } + ,{ w: 20, p: 'rush2' } + ,{ waitforenemiesdead: true } + ,{ w: 1, p: 'powerupW' } + ,{ w: 1, p: 'yellowline', powerup: 1 } + ,{ w: 1, p: 'rush1' } + ,{ waitforenemiesdead: true } + ,{ w: 1, p: 'powerupW' } + ,{ w: 1, p: 'yellowline', powerup: 1 } + ,{ w: 1, p: 'rush2' } + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 10, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 30, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 40, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 50, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 60, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 70, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 80, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 90, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 100, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 110, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 120, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 130, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 140, 300) }} + ,{ waitforenemiesdead: true } + ,{ w: 20, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 10, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 30, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 40, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 50, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 60, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 70, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 80, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 90, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 110, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 120, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 130, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 140, 250) }} + ,{ waitforenemiesdead: true } + ,{ w: 20, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 10, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 30, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 50, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 70, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 90, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 110, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 120, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 130, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 140, 200) }} + ,{ waitforenemiesdead: true } + ,{ w: 5, p: 'powerupW' } + ,{ w: 50, p: 'yellowline', powerup: 1 } + ,{ w: 20, p: 'rush2' } + ,{ waitforenemiesdead: true } + ,{ w: 1, p: 'powerupW' } + ,{ w: 1, p: 'yellowline', powerup: 1 } + ,{ w: 1, p: 'rush1' } + ,{ waitforenemiesdead: true } + ,{ w: 1, p: 'powerupW' } + ,{ w: 1, p: 'yellowline', powerup: 1 } + ,{ w: 1, p: 'rush2' } + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 10, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 20, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 30, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 40, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 50, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 60, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 70, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 80, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 90, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 100, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 110, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 120, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 130, 300) }} + ,{ w: 1, p: function() { this.pattern.formation2.call(this, 140, 300) }} + ,{ waitforenemiesdead: true } + ,{ w: 20, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 10, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 20, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 30, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 40, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 50, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 60, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 70, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 80, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 90, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 100, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 110, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 120, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 130, 250) }} + ,{ w: 1, p: function() { this.pattern.formation3.call(this, 140, 250) }} + ,{ waitforenemiesdead: true } + ,{ w: 20, p: 'powerupW' } + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 10, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 20, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 30, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 40, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 50, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 60, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 70, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 80, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 90, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 100, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 110, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 120, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 130, 200) }} + ,{ w: 1, p: function() { this.pattern.formation4.call(this, 140, 200) }} + ,{ waitforenemiesdead: true } + ,{ w: 20, p: 'powerupW' } + + ,{ level: 20, color: '143,10,139' } + ,{ w: 1, p: 'powerupW' } + ,{ w: 1, p: function() { + var a = new P4.EnemyBoss2() + a.pos = 1 + this.scene.layers.fg.push(a) + + var a = new P4.EnemyBoss2() + a.pos = 2 + this.scene.layers.fg.push(a) + }} + ] diff --git a/game/MenuScene.js b/game/MenuScene.js index 20b21a8..35d5b75 100644 --- a/game/MenuScene.js +++ b/game/MenuScene.js @@ -16,12 +16,12 @@ P4.MenuScene = function() { label: 'new game', func: function() { - GO.scenes.game = new P4.GameScene + GO.scenes.game = new P4.GameScene({ diff: GO.scenes.game.player.diff }) GO.setScene(GO.scenes.game) } }, { - label: 'quit', + label: 'quit to menu', func: function() { GO.setScene(GO.scenes.intro) } @@ -31,6 +31,13 @@ P4.MenuScene = function() GO.Util.extend(P4.MenuScene, GO.Scene) +P4.MenuScene.prototype.activate = function() +{ + this.lastSel = false + + GO.Sound.play('menu_open') +} + P4.MenuScene.prototype.process = function() { this.clear() @@ -40,6 +47,7 @@ P4.MenuScene.prototype.process = function() } if (GO.Event.Keyboard.code == 27) { + GO.Sound.play('menu_close') GO.setScene(GO.scenes.game) return } @@ -75,9 +83,19 @@ P4.MenuScene.prototype.process = function() && GO.Event.Mouse.x < this.x + this.w) { this.sel = Math.floor((GO.Event.Mouse.y - this.y) / (this.txth + 20)) + 1 + + if (this.sel && this.sel <= l && this.sel != this.lastSel) { + GO.Sound.play('select') + this.lastSel = this.sel + } + } + + if (!this.sel) { + this.lastSel = false } if (GO.Event.Mouse.click && this.sel && this.items[this.sel - 1] && this.items[this.sel - 1].func) { + GO.Sound.play('menu_click') this.items[this.sel - 1].func.call() } } diff --git a/game/Player.js b/game/Player.js index 75a2bed..eb0da7e 100644 --- a/game/Player.js +++ b/game/Player.js @@ -17,6 +17,18 @@ P4.Player = function(scene) this.dust.lifetime = 1 / 10 this.dust.v = (1 + Math.random() * 2) * 50 this.push(this.dust) + + this.tail = new GO.LinkedList + for (var i = 0; i < 20; i += 1) { + this.tail.push({ + x: -100 + ,y: -100 + ,angle: 0 + ,alpha: 1 + }) + } + this.tailCur = this.tail.first + } GO.Util.extend(P4.Player, GO.VisibleEntityGroup) @@ -26,7 +38,9 @@ P4.Player.prototype.cr = 8 P4.Player.prototype.size = 1 P4.Player.prototype.lives = 3 P4.Player.prototype.weapon = 0 -P4.Player.prototype.energy = 10 +P4.Player.prototype.energy = 30 +P4.Player.prototype.score = 0 +P4.Player.prototype.diff = 0 P4.Player.prototype.reset = function() { @@ -60,13 +74,15 @@ P4.Player.prototype.oncollision = function(e) case 'w': this.weapon = 1 this.weaponCooldown = 10 + this.score += 100 break case 'e': - this.energy += 1 - if (this.energy >= 10) { - this.energy = 10 + this.energy += 10 + if (this.energy >= P4.Player.prototype.energy) { + this.energy = P4.Player.prototype.energy } + this.score += 200 break } @@ -92,6 +108,8 @@ P4.Player.prototype.oncollision = function(e) } if (this.energy <= 0) { + GO.Sound.play('player_explode') + this.explode(true) this.heaven = true this.x = -5000 @@ -108,6 +126,8 @@ P4.Player.prototype.oncollision = function(e) return false }, this)) } else { + GO.Sound.play('player_hit') + var damage = e.damage ? e.damage : 1 this.energy -= damage if (this.energy < 0) { @@ -129,6 +149,10 @@ P4.Player.prototype.process = function() } if (this.spawn > 0) { + if (this.spawn == 500) { + GO.Sound.play('hit') + } + GO.ctx.beginPath() GO.ctx.lineWidth = 3 GO.ctx.fillStyle = 'rgba(255,255,255,0.1)' @@ -212,26 +236,26 @@ P4.Player.prototype.process = function() this.angle = Math.sin(n / 100) } - /* tail */ - this.push({ - lt: 2, - angle: this.angle, - alpha: 1, - x: this.x, - y: this.y, - parent: this, - size: this.size, - process: function() { - this.lt -= GO.delta * 10 - if (this.lt <= 0) { - this.dead = true - return false - } - - this.alpha = this.alpha / 1.5 - this.parent.drawShip(this.x, this.y, this.angle, this.alpha) - } - }) +// /* tail */ +// this.push({ +// lt: 2, +// angle: this.angle, +// alpha: 1, +// x: this.x, +// y: this.y, +// parent: this, +// size: this.size, +// process: function() { +// this.lt -= GO.delta * 10 +// if (this.lt <= 0) { +// this.dead = true +// return false +// } +// +// this.alpha = this.alpha / 1.5 +// this.parent.drawShip(this.x, this.y, this.angle, this.alpha) +// } +// }) if (!this.spawn && this.invincible) { GO.ctx.beginPath() @@ -240,7 +264,39 @@ P4.Player.prototype.process = function() GO.ctx.fill() } - this.drawShip(this.x, this.y, this.angle, 1) + this.drawTail(this.x, this.y) +} + +P4.Player.prototype.drawTail = function(x, y) +{ + if (this.tailCur) { + this.tailCur.x = x + this.tailCur.y = y + this.tailCur.angle = this.angle + this.tailCur.alpha = 1 + if (this.tailCur.llnext) { + this.tailCur = this.tailCur.llnext + } else { + this.tailCur = this.tail.first + } + } + + var i = 0 + ,cur = this.tailCur + + do { + cur.alpha -= 1 / 10 + if (cur.alpha > 0.1) { + this.drawShip(cur.x, cur.y, cur.angle, cur.alpha, this.color) + } + + if (cur.llnext) { + cur = cur.llnext + } else { + cur = this.tail.first + } + i += 1 + } while (i < this.tail.count) } P4.Player.prototype.fireSingleShot = function() diff --git a/game/Powerup.js b/game/Powerup.js index 958ea74..c5d59e4 100644 --- a/game/Powerup.js +++ b/game/Powerup.js @@ -23,6 +23,12 @@ P4.Powerup.prototype.type = 'w' P4.Powerup.prototype.consume = function() { if (this.active && this.touching) { + if (this.type == 'w') { + GO.Sound.play('powerup_canon') + } else { + GO.Sound.play('powerup_life') + } + this.active = false this.dead = true return true diff --git a/index-mac.html b/index-mac.html new file mode 100644 index 0000000..a581c11 --- /dev/null +++ b/index-mac.html @@ -0,0 +1,74 @@ + +