User prompt
увеличь скорость падения метеоритов
User prompt
замедли вращение
User prompt
постепенно увеличивай темп игры
User prompt
бомба не исчезает
User prompt
задний фон движется сверху вниз
User prompt
взрываясь бомба уничтожает метеорит, метеорит пропадает, остается облако обломков метеорита которые летят по инерции
User prompt
бомба взрывается через 15 секунд
User prompt
после приземления героя на метеорит, герой ставит на него бомбу, бомба взрывается через 5 секунд после прыжка героя с метеорита
User prompt
Звезды на фоне создают эффект бесконечного полета
User prompt
Fix Bug: 'Uncaught Error: [object Object]addChildAt: The index 1 supplied is out of bounds 0' in this line: 'gameContainer.addChildAt(newStar, 1);' Line Number: 104
User prompt
Fix Bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'addChildAt')' in this line: 'gameContainer.addChildAt(newStar, 1);' Line Number: 102
User prompt
Fix Bug: 'Uncaught TypeError: game.spawnStar is not a function' in this line: 'game.spawnStar();' Line Number: 99
User prompt
создай задний фон как звезды летят в космосе создавая иллюзию скорости
Remix started
Copy Santa Jumper
===================================================================
--- original.js
+++ change.js
@@ -1,5 +1,20 @@
-var houseAssets = ['house1', 'house2', 'house3', 'house4', 'house5', 'house6', 'house7', 'house8', 'house9', 'house10'];
+/****
+* Classes
+****/
+var Star = Container.expand(function () {
+ var self = Container.call(this);
+ var starGraphics = self.createAsset('star', 'Star graphics', 0.5, 0.5);
+ self.speed = Math.random() * 5 + 1;
+ self.move = function () {
+ self.y += self.speed;
+ if (self.y > 2732) {
+ self.y = -starGraphics.height;
+ self.x = Math.random() * 2048;
+ self.speed = Math.random() * 5 + 1;
+ }
+ };
+});
var Santa = Container.expand(function () {
var self = Container.call(this);
var santaGraphics = self.createAsset('santa', 'Santa character', .5, .5);
self.speed = 10;
@@ -60,70 +75,98 @@
var self = Container.call(this);
var randomHouseIndex = Math.floor(Math.random() * houseAssets.length);
var houseGraphics = self.createAsset(houseAssets[randomHouseIndex], 'House object', .5, .5);
self.rotationStep = Math.random() * 0.02 - 0.01;
- if (self.rotationStep > 0 && self.rotationStep < 0.01) self.rotationStep = 0.01;
- if (self.rotationStep < 0 && self.rotationStep > -0.01) self.rotationStep = -0.01;
+ if (self.rotationStep > 0 && self.rotationStep < 0.01) {
+ self.rotationStep = 0.01;
+ }
+ if (self.rotationStep < 0 && self.rotationStep > -0.01) {
+ self.rotationStep = -0.01;
+ }
});
-var Game = Container.expand(function () {
- var self = Container.call(this);
- var background = self.createAsset('background', 'Background image', .5, .5);
- background.x = 2048 / 2;
- background.y = 2732 / 2;
- self.addChildAt(background, 0);
- LK.stageContainer.setBackgroundColor(0x000000);
- var gameContainer = new Container();
- self.addChild(gameContainer);
- var santa = gameContainer.addChild(new Santa());
- santa.x = 2048 / 2;
- santa.y = 2732 - 300;
- var houses = [];
- var houseSpeed = -2;
- self.spawnHouse = function () {
- var newHouse = new House();
- newHouse.rotation = Math.random() * Math.PI * 2;
- newHouse.scale.set(Math.random() * 0.5 + 0.5);
- if (houses.length === 0) {
- newHouse.x = 2048 / 2;
- newHouse.y = 2732 / 2;
- } else {
- var lastHouseY = houses[houses.length - 1].y;
- var gameHeightThird = 2732 / 3;
- newHouse.y = lastHouseY - (Math.random() * gameHeightThird + gameHeightThird);
- newHouse.x = Math.random() * (2048 - 600) + 300;
- }
- houses.push(newHouse);
- gameContainer.addChildAt(newHouse, 0);
- };
- var isGameOver = false;
- for (var i = 0; i < 8; i++) {
- self.spawnHouse();
+
+/****
+* Initialize Game
+****/
+var game = new LK.Game({
+ backgroundColor: 0x000000
+});
+
+/****
+* Game Code
+****/
+var stars = [];
+for (var i = 0; i < 50; i++) {
+ game.spawnStar();
+}
+var houseAssets = ['house1', 'house2', 'house3', 'house4', 'house5', 'house6', 'house7', 'house8', 'house9', 'house10'];
+var background = game.createAsset('background', 'Background image', .5, .5);
+background.x = 2048 / 2;
+background.y = 2732 / 2;
+game.addChildAt(background, 0);
+game.setBackgroundColor(0x000000);
+var gameContainer = new Container();
+game.addChild(gameContainer);
+var santa = gameContainer.addChild(new Santa());
+santa.x = 2048 / 2;
+santa.y = 2732 - 300;
+var houses = [];
+var houseSpeed = -2;
+game.spawnHouse = function () {
+ var newHouse = new House();
+ newHouse.rotation = Math.random() * Math.PI * 2;
+ newHouse.scale.set(Math.random() * 0.5 + 0.5);
+ if (houses.length === 0) {
+ newHouse.x = 2048 / 2;
+ newHouse.y = 2732 / 2;
+ } else {
+ var lastHouseY = houses[houses.length - 1].y;
+ var gameHeightThird = 2732 / 3;
+ newHouse.y = lastHouseY - (Math.random() * gameHeightThird + gameHeightThird);
+ newHouse.x = Math.random() * (2048 - 600) + 300;
}
- stage.on('down', function (obj) {
- santa.jump();
- });
- var tickOffset = 0;
- LK.on('tick', function () {
- if (isGameOver) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- } else {
- santa.move(houses);
- }
- for (var a = houses.length - 1; a >= 0; a--) {
- if (santa.firstJump) {
- houses[a].y -= houseSpeed;
+ houses.push(newHouse);
+ gameContainer.addChildAt(newHouse, 0);
+};
+game.spawnStar = function () {
+ var newStar = new Star();
+ newStar.x = Math.random() * 2048;
+ newStar.y = Math.random() * 2732;
+ gameContainer.addChildAt(newStar, 1);
+};
+var isGameOver = false;
+for (var i = 0; i < 8; i++) {
+ game.spawnHouse();
+}
+game.on('down', function (obj) {
+ santa.jump();
+});
+var tickOffset = 0;
+LK.on('tick', function () {
+ if (isGameOver) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ } else {
+ santa.move(houses);
+ for (var s = 0; s < gameContainer.children.length; s++) {
+ if (gameContainer.children[s] instanceof Star) {
+ gameContainer.children[s].move();
}
- houses[a].rotation += houses[a].rotationStep;
- if (houses[a].x < -50 || houses[a].y > 2732 + houses[a].height) {
- houses[a].destroy();
- houses.splice(a, 1);
- self.spawnHouse();
- }
}
- var santaScreenX = santa.x;
- var santaScreenY = santa.y + gameContainer.y;
- if ((santaScreenX < 0 || santaScreenX > 2048 || santaScreenY < 0) && santa.hasJumped || santa.y > 2732) {
- isGameOver = true;
+ }
+ for (var a = houses.length - 1; a >= 0; a--) {
+ if (santa.firstJump) {
+ houses[a].y -= houseSpeed;
}
- });
-});
+ houses[a].rotation += houses[a].rotationStep;
+ if (houses[a].x < -50 || houses[a].y > 2732 + houses[a].height) {
+ houses[a].destroy();
+ houses.splice(a, 1);
+ game.spawnHouse();
+ }
+ }
+ var santaScreenX = santa.x;
+ var santaScreenY = santa.y + gameContainer.y;
+ if ((santaScreenX < 0 || santaScreenX > 2048 || santaScreenY < 0) && santa.hasJumped || santa.y > 2732) {
+ isGameOver = true;
+ }
+});
\ No newline at end of file
космонавт. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
астероид. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
красная взрывчатка с таймером. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.