User prompt
objects we escape from appear in normal color
User prompt
Let the objects we avoid come 31 percent less
User prompt
The shape of the bomb we throw should be different
User prompt
let's throw a bomb
User prompt
The objects we need to escape from are coming towards us.
User prompt
Delete all text except start in the menu
User prompt
Delete rockets flying in the air
User prompt
Write Superhero Missile Dodge remix before the menu
User prompt
Add start menu
User prompt
Migrate to the latest version of LK
Remix started
Copy Superhero Missile Dodge
/**** * Classes ****/ var Explosion = Container.expand(function () { var self = Container.call(this); var explosionGraphics = self.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5 }); explosionGraphics.scale.x *= 2; explosionGraphics.scale.y *= 2; self.duration = 30; self.tick = function () { self.duration--; if (self.duration <= 0) { self.destroy(); } }; }); var FastCloud = Container.expand(function () { var self = Container.call(this); var cloudGraphics = self.attachAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); cloudGraphics.scale.x *= 6; cloudGraphics.scale.y *= 6; self.speed = (Math.random() * 3 + 1) * 6; self._move_migrated = function () { self.x -= self.speed; if (self.x <= -cloudGraphics.width) { self.x = 2048 + cloudGraphics.width; self.y = Math.random() * 2732; } }; }); var MediumCloud = Container.expand(function () { var self = Container.call(this); var cloudGraphics = self.attachAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); cloudGraphics.scale.x *= 4; cloudGraphics.scale.y *= 4; self.speed = (Math.random() * 2 + 1) * 4; self._move_migrated = function () { self.x -= self.speed; if (self.x <= -cloudGraphics.width) { self.x = 2048 + cloudGraphics.width; self.y = Math.random() * 2732; } }; }); var Missile = Container.expand(function () { var self = Container.call(this); var missileGraphics = self.attachAsset('missile', { anchorX: 0.5, anchorY: 0.5 }); missileGraphics.scale.x *= -4; missileGraphics.scale.y *= 4; self.gameDuration = 0; self.speed = -20 - self.gameDuration * 5; self._move_migrated = function () { self.speed = -20 - self.gameDuration * 2.5; self.x += self.speed; }; }); var SlowCloud = Container.expand(function () { var self = Container.call(this); var cloudGraphics = self.attachAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); cloudGraphics.scale.x *= 2; cloudGraphics.scale.y *= 2; self.speed = (Math.random() * 1 + 1) * 2; self._move_migrated = function () { self.x -= self.speed; if (self.x <= -cloudGraphics.width) { self.x = 2048 + cloudGraphics.width; self.y = Math.random() * 2732; } }; }); var Superman = Container.expand(function () { var self = Container.call(this); var supermanGraphics = self.attachAsset('superman', { anchorX: 0.5, anchorY: 0.5 }); self.hitCount = 0; self._move_migrated = function (x, y) { self.x = x; self.y = y; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ game.setBackgroundColor(0x0000ff); var clouds = []; for (var i = 0; i < 3; i++) { var slowCloud = new SlowCloud(); slowCloud.x = Math.random() * 2048; slowCloud.y = Math.random() * 2732; clouds.push(slowCloud); game.addChild(slowCloud); } for (var i = 0; i < 3; i++) { var mediumCloud = new MediumCloud(); mediumCloud.x = Math.random() * 2048; mediumCloud.y = Math.random() * 2732; clouds.push(mediumCloud); game.addChild(mediumCloud); } for (var i = 0; i < 3; i++) { var fastCloud = new FastCloud(); fastCloud.x = Math.random() * 2048; fastCloud.y = Math.random() * 2732; clouds.push(fastCloud); game.addChild(fastCloud); } var superman = game.addChild(new Superman()); var missiles = []; superman.x = 100; superman.y = 2732 / 2; var isGameOver = false; var tickOffset = 0; var gameDuration = 0; var gameDurationText = new Text2('0', { size: 150, fill: '#ffffff' }); gameDurationText.anchor.set(.5, 0); LK.gui.top.addChild(gameDurationText); LK.on('tick', function () { if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } for (var a = missiles.length - 1; a >= 0; a--) { if (missiles[a]) { missiles[a]._move_migrated(); if (missiles[a].x < -50) { missiles[a].destroy(); missiles.splice(a, 1); } if (superman.intersects(missiles[a])) { var explosion = new Explosion(); explosion.x = missiles[a].x; explosion.y = missiles[a].y; game.addChild(explosion); missiles[a].destroy(); missiles.splice(a, 1); superman.hitCount += 1; if (superman.hitCount >= 4) { isGameOver = true; } } } } clouds.forEach(function (cloud) { cloud._move_migrated(); }); if (tickOffset++ % 60 == 0) { gameDuration++; gameDurationText.setText(gameDuration); } if (tickOffset % 30 == 0) { var newMissile = new Missile(); newMissile.x = 2048; newMissile.y = Math.random() * 2732; newMissile.gameDuration = gameDuration; missiles.push(newMissile); game.addChild(newMissile); } game.children.forEach(function (child) { if (child instanceof Explosion) { child.tick(); } }); }); var dragNode = null; game.on('down', function (x, y, obj) { dragNode = superman; }); function handleMove(obj) { var event = obj.event; var pos = game.toLocal(event.global); if (dragNode) { dragNode._move_migrated(pos.x, pos.y); } } game.on('move', function (x, y, obj) { obj.event = obj; handleMove(obj); }); game.on('up', function (x, y, obj) { dragNode = null; });
===================================================================
--- original.js
+++ change.js
@@ -1,11 +1,33 @@
-var SlowCloud = Container.expand(function () {
+/****
+* Classes
+****/
+var Explosion = Container.expand(function () {
var self = Container.call(this);
- var cloudGraphics = self.createAsset('cloud', 'Cloud Graphics', .5, .5);
- cloudGraphics.scale.x *= 2;
- cloudGraphics.scale.y *= 2;
- self.speed = (Math.random() * 1 + 1) * 2;
- self.move = function () {
+ var explosionGraphics = self.attachAsset('explosion', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ explosionGraphics.scale.x *= 2;
+ explosionGraphics.scale.y *= 2;
+ self.duration = 30;
+ self.tick = function () {
+ self.duration--;
+ if (self.duration <= 0) {
+ self.destroy();
+ }
+ };
+});
+var FastCloud = Container.expand(function () {
+ var self = Container.call(this);
+ var cloudGraphics = self.attachAsset('cloud', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ cloudGraphics.scale.x *= 6;
+ cloudGraphics.scale.y *= 6;
+ self.speed = (Math.random() * 3 + 1) * 6;
+ self._move_migrated = function () {
self.x -= self.speed;
if (self.x <= -cloudGraphics.width) {
self.x = 2048 + cloudGraphics.width;
self.y = Math.random() * 2732;
@@ -13,165 +35,175 @@
};
});
var MediumCloud = Container.expand(function () {
var self = Container.call(this);
- var cloudGraphics = self.createAsset('cloud', 'Cloud Graphics', .5, .5);
+ var cloudGraphics = self.attachAsset('cloud', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
cloudGraphics.scale.x *= 4;
cloudGraphics.scale.y *= 4;
self.speed = (Math.random() * 2 + 1) * 4;
- self.move = function () {
+ self._move_migrated = function () {
self.x -= self.speed;
if (self.x <= -cloudGraphics.width) {
self.x = 2048 + cloudGraphics.width;
self.y = Math.random() * 2732;
}
};
});
-var FastCloud = Container.expand(function () {
- var self = Container.call(this);
- var cloudGraphics = self.createAsset('cloud', 'Cloud Graphics', .5, .5);
- cloudGraphics.scale.x *= 6;
- cloudGraphics.scale.y *= 6;
- self.speed = (Math.random() * 3 + 1) * 6;
- self.move = function () {
- self.x -= self.speed;
- if (self.x <= -cloudGraphics.width) {
- self.x = 2048 + cloudGraphics.width;
- self.y = Math.random() * 2732;
- }
- };
-});
-var Explosion = Container.expand(function () {
- var self = Container.call(this);
- var explosionGraphics = self.createAsset('explosion', 'Explosion Graphics', .5, .5);
- explosionGraphics.scale.x *= 2;
- explosionGraphics.scale.y *= 2;
- self.duration = 30;
- self.tick = function () {
- self.duration--;
- if (self.duration <= 0) {
- self.destroy();
- }
- };
-});
var Missile = Container.expand(function () {
var self = Container.call(this);
- var missileGraphics = self.createAsset('missile', 'Missile Graphics', .5, .5);
+ var missileGraphics = self.attachAsset('missile', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
missileGraphics.scale.x *= -4;
missileGraphics.scale.y *= 4;
self.gameDuration = 0;
self.speed = -20 - self.gameDuration * 5;
- self.move = function () {
+ self._move_migrated = function () {
self.speed = -20 - self.gameDuration * 2.5;
self.x += self.speed;
};
});
+var SlowCloud = Container.expand(function () {
+ var self = Container.call(this);
+ var cloudGraphics = self.attachAsset('cloud', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ cloudGraphics.scale.x *= 2;
+ cloudGraphics.scale.y *= 2;
+ self.speed = (Math.random() * 1 + 1) * 2;
+ self._move_migrated = function () {
+ self.x -= self.speed;
+ if (self.x <= -cloudGraphics.width) {
+ self.x = 2048 + cloudGraphics.width;
+ self.y = Math.random() * 2732;
+ }
+ };
+});
var Superman = Container.expand(function () {
var self = Container.call(this);
- var supermanGraphics = self.createAsset('superman', 'Superman Graphics', .5, .5);
+ var supermanGraphics = self.attachAsset('superman', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.hitCount = 0;
- self.move = function (x, y) {
+ self._move_migrated = function (x, y) {
self.x = x;
self.y = y;
};
});
-var Game = Container.expand(function () {
- var self = Container.call(this);
- LK.stageContainer.setBackgroundColor(0x0000ff);
- var clouds = [];
- for (var i = 0; i < 3; i++) {
- var slowCloud = new SlowCloud();
- slowCloud.x = Math.random() * 2048;
- slowCloud.y = Math.random() * 2732;
- clouds.push(slowCloud);
- self.addChild(slowCloud);
+
+/****
+* Initialize Game
+****/
+var game = new LK.Game({
+ backgroundColor: 0x000000
+});
+
+/****
+* Game Code
+****/
+game.setBackgroundColor(0x0000ff);
+var clouds = [];
+for (var i = 0; i < 3; i++) {
+ var slowCloud = new SlowCloud();
+ slowCloud.x = Math.random() * 2048;
+ slowCloud.y = Math.random() * 2732;
+ clouds.push(slowCloud);
+ game.addChild(slowCloud);
+}
+for (var i = 0; i < 3; i++) {
+ var mediumCloud = new MediumCloud();
+ mediumCloud.x = Math.random() * 2048;
+ mediumCloud.y = Math.random() * 2732;
+ clouds.push(mediumCloud);
+ game.addChild(mediumCloud);
+}
+for (var i = 0; i < 3; i++) {
+ var fastCloud = new FastCloud();
+ fastCloud.x = Math.random() * 2048;
+ fastCloud.y = Math.random() * 2732;
+ clouds.push(fastCloud);
+ game.addChild(fastCloud);
+}
+var superman = game.addChild(new Superman());
+var missiles = [];
+superman.x = 100;
+superman.y = 2732 / 2;
+var isGameOver = false;
+var tickOffset = 0;
+var gameDuration = 0;
+var gameDurationText = new Text2('0', {
+ size: 150,
+ fill: '#ffffff'
+});
+gameDurationText.anchor.set(.5, 0);
+LK.gui.top.addChild(gameDurationText);
+LK.on('tick', function () {
+ if (isGameOver) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
}
- for (var i = 0; i < 3; i++) {
- var mediumCloud = new MediumCloud();
- mediumCloud.x = Math.random() * 2048;
- mediumCloud.y = Math.random() * 2732;
- clouds.push(mediumCloud);
- self.addChild(mediumCloud);
- }
- for (var i = 0; i < 3; i++) {
- var fastCloud = new FastCloud();
- fastCloud.x = Math.random() * 2048;
- fastCloud.y = Math.random() * 2732;
- clouds.push(fastCloud);
- self.addChild(fastCloud);
- }
- var superman = self.addChild(new Superman());
- var missiles = [];
- superman.x = 100;
- superman.y = 2732 / 2;
- var isGameOver = false;
- var tickOffset = 0;
- var gameDuration = 0;
- var gameDurationText = new Text2('0', {
- size: 150,
- fill: '#ffffff'
- });
- gameDurationText.anchor.set(.5, 0);
- LK.gui.topCenter.addChild(gameDurationText);
- LK.on('tick', function () {
- if (isGameOver) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- }
- for (var a = missiles.length - 1; a >= 0; a--) {
- if (missiles[a]) {
- missiles[a].move();
- if (missiles[a].x < -50) {
- missiles[a].destroy();
- missiles.splice(a, 1);
+ for (var a = missiles.length - 1; a >= 0; a--) {
+ if (missiles[a]) {
+ missiles[a]._move_migrated();
+ if (missiles[a].x < -50) {
+ missiles[a].destroy();
+ missiles.splice(a, 1);
+ }
+ if (superman.intersects(missiles[a])) {
+ var explosion = new Explosion();
+ explosion.x = missiles[a].x;
+ explosion.y = missiles[a].y;
+ game.addChild(explosion);
+ missiles[a].destroy();
+ missiles.splice(a, 1);
+ superman.hitCount += 1;
+ if (superman.hitCount >= 4) {
+ isGameOver = true;
}
- if (superman.intersects(missiles[a])) {
- var explosion = new Explosion();
- explosion.x = missiles[a].x;
- explosion.y = missiles[a].y;
- self.addChild(explosion);
- missiles[a].destroy();
- missiles.splice(a, 1);
- superman.hitCount += 1;
- if (superman.hitCount >= 4) {
- isGameOver = true;
- }
- }
}
}
- clouds.forEach(function (cloud) {
- cloud.move();
- });
- if (tickOffset++ % 60 == 0) {
- gameDuration++;
- gameDurationText.setText(gameDuration);
- }
- if (tickOffset % 30 == 0) {
- var newMissile = new Missile();
- newMissile.x = 2048;
- newMissile.y = Math.random() * 2732;
- newMissile.gameDuration = gameDuration;
- missiles.push(newMissile);
- self.addChild(newMissile);
- }
- self.children.forEach(function (child) {
- if (child instanceof Explosion) {
- child.tick();
- }
- });
+ }
+ clouds.forEach(function (cloud) {
+ cloud._move_migrated();
});
- var dragNode = null;
- stage.on('down', function (obj) {
- dragNode = superman;
- });
- function handleMove(obj) {
- var event = obj.event;
- var pos = event.getLocalPosition(self);
- if (dragNode) {
- dragNode.move(pos.x, pos.y);
- }
+ if (tickOffset++ % 60 == 0) {
+ gameDuration++;
+ gameDurationText.setText(gameDuration);
}
- stage.on('move', handleMove);
- stage.on('up', function (obj) {
- dragNode = null;
+ if (tickOffset % 30 == 0) {
+ var newMissile = new Missile();
+ newMissile.x = 2048;
+ newMissile.y = Math.random() * 2732;
+ newMissile.gameDuration = gameDuration;
+ missiles.push(newMissile);
+ game.addChild(newMissile);
+ }
+ game.children.forEach(function (child) {
+ if (child instanceof Explosion) {
+ child.tick();
+ }
});
});
+var dragNode = null;
+game.on('down', function (x, y, obj) {
+ dragNode = superman;
+});
+function handleMove(obj) {
+ var event = obj.event;
+ var pos = game.toLocal(event.global);
+ if (dragNode) {
+ dragNode._move_migrated(pos.x, pos.y);
+ }
+}
+game.on('move', function (x, y, obj) {
+ obj.event = obj;
+ handleMove(obj);
+});
+game.on('up', function (x, y, obj) {
+ dragNode = null;
+});
\ No newline at end of file
A sky with clouds, tileable Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
An explosion Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a puffy white cloud Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pumkin bomb. In-Game asset. 2d. High contrast. No shadows
flying pixel art green goblin. In-Game asset. 2d. High contrast. No shadows
flying pixel art hero. In-Game asset. 2d. High contrast. No shadows