/**** * Classes ****/ var Bubble = Container.expand(function () { var self = Container.call(this); var bubbleGraphics = self.attachAsset('bubble', { anchorX: 0.5, anchorY: 0.5 }); bubbleGraphics.width *= 0.7; bubbleGraphics.height *= 0.7; self.speed = 45; self._move_migrated = function () { self.x += Math.cos(self.rotation) * self.speed; self.y += Math.sin(self.rotation) * self.speed; }; }); var BubbleUI = Container.expand(function () { var self = Container.call(this); self.bubbles = []; var bubble = self.attachAsset('bubble', { anchorY: 0.5 }); var totalWidth = 4 * (bubble.width + 10) - 10; self.x = (2048 - totalWidth) / 2; for (var i = 0; i < 4; i++) { var bubble = self.attachAsset('bubble', { anchorY: 0.5 }); bubble.x = i * (bubble.width + 10); bubble.y = 0; self.bubbles.push(bubble); self.addChild(bubble); } self.updateBubbles = function (lives) { for (var i = 0; i < self.bubbles.length; i++) { if (i < lives) { self.bubbles[i].tint = 0xFFFFFF; if (!self.bubbles[i].restored) { var lifeRestoration = new LifeRestorationAsset(); self.addChild(lifeRestoration); lifeRestoration.show(self.bubbles[i].x + self.bubbles[i].width / 2, self.bubbles[i].y - lifeRestoration.height / 2 + 65); self.bubbles[i].restored = true; } } else { self.bubbles[i].tint = 0x000000; self.bubbles[i].restored = false; } } }; self.y = 2732 - self.bubbles[0].height - 5; }); var DuckHoldingSign = Container.expand(function () { var self = Container.call(this); var duckGraphics = self.attachAsset('duck_holding_a_sign', { anchorX: 0.5, anchorY: 0.5 }); self.visible = false; self.show = function (x, y) { self.x = x; self.y = y; self.visible = true; LK.setTimeout(function () { self.visible = false; }, 1000); }; }); var LifeRestorationAsset = Container.expand(function () { var self = Container.call(this); var lifeRestorationGraphics = self.attachAsset('lifeRestoration', { anchorX: 0.5, anchorY: 0.5 }); self.show = function (x, y) { self.x = x; self.y = y; self.visible = true; LK.setTimeout(function () { self.destroy(); }, 500); }; }); var Shooter = Container.expand(function () { var self = Container.call(this); self.rotationAngle = 0; var shooterGraphics = self.attachAsset('cannon', { anchorX: 0.5, anchorY: 1 }); var cannonSize = Math.min(shooterGraphics.width, shooterGraphics.height) * 0.375; shooterGraphics.width = cannonSize; shooterGraphics.height = cannonSize; }); var Skater = Container.expand(function () { var self = Container.call(this); var skaterGraphics = self.attachAsset('skater', { anchorX: 0.5, anchorY: 0.5 }); self.direction = Math.random() * 2 * Math.PI; self.speed = 3; self.rotationSpeed = 0.05; self.isRotating = false; self.rotateTimer = 0; self.rotateDuration = 60; self._move_migrated = function () { var newX = self.x + Math.cos(self.direction) * self.speed; var newY = self.y + Math.sin(self.direction) * self.speed; if (newX > 1798 || newX < 300) { self.direction = Math.PI - self.direction; } if (newY > 2482 || newY < 250) { self.direction = -self.direction; } self.x = newX; self.y = newY; }; self._update_migrated = function () { if (self.isRotating) { self.rotation += self.rotationSpeed * 0.5; self.rotateTimer++; if (self.rotateTimer >= self.rotateDuration) { self.isRotating = false; self.rotateTimer = 0; self.direction = Math.random() * 2 * Math.PI; } } else if (Math.random() < 0.01) { self.isRotating = true; } self._move_migrated(); for (var i = 0; i < skaters.length; i++) { if (self !== skaters[i] && self.intersects(skaters[i])) { var angle = Math.atan2(skaters[i].y - self.y, skaters[i].x - self.x); self.direction = angle + Math.PI; skaters[i].direction = angle; // Play Bounce sound when skaters touch each other LK.getSound('Bounce').play(); } } var circleCenter = { x: 2048 / 2, y: 2732 / 2 }; var distanceToCenter = Math.sqrt(Math.pow(self.x - circleCenter.x, 2) + Math.pow(self.y - circleCenter.y, 2)); if (distanceToCenter < 400) { var angle = Math.atan2(circleCenter.y - self.y, circleCenter.x - self.x); self.direction = angle + Math.PI; } }; }); var Snowboarder = Container.expand(function () { var self = Container.call(this); var snowboarderGraphics = self.attachAsset('snowboarder', { anchorX: 0.5, anchorY: 0.5 }); self.direction = Math.random() * 2 * Math.PI; self.speed = 3; self.rotationSpeed = 0.05; self.isRotating = false; self.rotateTimer = 0; self.rotateDuration = 60; self._move_migrated = function () { var newX = self.x + Math.cos(self.direction) * self.speed; var newY = self.y + Math.sin(self.direction) * self.speed; if (newX > 1798 || newX < 300) { self.direction = Math.PI - self.direction; } if (newY > 2482 || newY < 250) { self.direction = -self.direction; } self.x = newX; self.y = newY; }; self._update_migrated = function () { if (self.isRotating) { self.rotation += self.rotationSpeed * 0.5; self.rotateTimer++; if (self.rotateTimer >= self.rotateDuration) { self.isRotating = false; self.rotateTimer = 0; self.direction = Math.random() * 2 * Math.PI; } } else if (Math.random() < 0.01) { self.isRotating = true; } self._move_migrated(); for (var i = 0; i < skaters.length; i++) { if (self !== skaters[i] && self.intersects(skaters[i])) { var angle = Math.atan2(skaters[i].y - self.y, skaters[i].x - self.x); self.direction = angle + Math.PI; skaters[i].direction = angle; // Play Bounce sound when snowboarders and skaters touch each other LK.getSound('Bounce').play(); } } var circleCenter = { x: 2048 / 2, y: 2732 / 2 }; var distanceToCenter = Math.sqrt(Math.pow(self.x - circleCenter.x, 2) + Math.pow(self.y - circleCenter.y, 2)); if (distanceToCenter < 400) { var angle = Math.atan2(circleCenter.y - self.y, circleCenter.x - self.x); self.direction = angle + Math.PI; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var skaters = []; LK.playMusic('backgroundMusic', { loop: true }); game.on('move', function (x, y, obj) { game.levelUp = function () { game.levelTransitionInProgress = true; game.level++; game.setLives(4); skaters.forEach(function (entity) { if (entity instanceof Snowboarder) { entity.destroy(); } }); skaters = skaters.filter(function (entity) { return !(entity instanceof Snowboarder); }); game.spawnSkaters(game.level); game.levelTransitionInProgress = false; // Play NewRound sound when a new round starts LK.getSound('NewRound').play(); game.levelTransitionInitiated = false; }; var event = obj; var pos = game.toLocal(event.global); var angle = Math.atan2(pos.y - shooter.y, pos.x - shooter.x) + Math.PI / 2; shooter.rotation = angle; }); game.on('up', function (x, y, obj) { if (game.lives > 0 && !game.levelTransitionInitiated && !game.levelTransitionInProgress) { var event = obj; var pos = game.toLocal(event.global); var newBubble = game.addChild(new Bubble()); newBubble.rotation = Math.atan2(pos.y - shooter.y, pos.x - shooter.x); newBubble.x = shooter.x; newBubble.y = shooter.y; bubbles.push(newBubble); if (game.lives > 0) { game.lives--; // Play Snowball sound LK.getSound('Snowball').play(); } bubbleUI.updateBubbles(game.lives); } }); game.level = 1; game.levelTransitionInitiated = false; game.levelTransitionInProgress = false; var bubbleUI = game.addChild(new BubbleUI()); game.setLives = function (lives) { game.lives = lives; bubbleUI.updateBubbles(game.lives); }; game.setLives(4); game.score = 0; var scoreText = new Text2(game.score.toString(), { size: 150, fill: "#ffffff", stroke: "#075079", strokeThickness: 11.25, font: "'Luckiest Guy', 'Arial Black', sans-serif" }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); game.spawnSkaters = function (level) { for (var i = 0; i < level + 4; i++) { var skater = game.addChild(new Skater()); do { skater.x = 300 + Math.random() * (2048 - 600); skater.y = 250 + Math.random() * (2732 - 500); } while (Math.sqrt(Math.pow(skater.x - 2048 / 2, 2) + Math.pow(skater.y - 2732 / 2, 2)) < 400); skaters.push(skater); } var numberOfSnowboarders = Math.max(0, Math.ceil((game.level - 1) / 2)); for (var sb = 0; sb < numberOfSnowboarders; sb++) { var snowboarder = game.addChild(new Snowboarder()); do { snowboarder.x = 300 + Math.random() * (2048 - 600); snowboarder.y = 250 + Math.random() * (2732 - 500); } while (Math.sqrt(Math.pow(snowboarder.x - 2048 / 2, 2) + Math.pow(snowboarder.y - 2732 / 2, 2)) < 400); skaters.push(snowboarder); } }; isGameOver = false; game.levelCompleted = true; if (!game.levelTransitionInitiated) { game.spawnSkaters(game.level); } var backgroundLayer2 = game.attachAsset('backgroundLayer2', { anchorX: 0.5, anchorY: 0.5 }); backgroundLayer2.width = 2048; backgroundLayer2.height = 2732; backgroundLayer2.x = 2048 / 2; backgroundLayer2.y = 2732 / 2; game.addChildAt(backgroundLayer2, 0); var background = game.attachAsset('background', { anchorX: 0.5, anchorY: 0.5 }); background.width = 2048; background.height = 2732; background.x = 2048 / 2; background.y = 2732 / 2; game.addChildAt(background, 1); var bubbles = []; var bubbleHitEdge = false; var shooter = game.addChild(new Shooter()); var duckHoldingSign = game.addChild(new DuckHoldingSign()); var currentCombo = 0; var lastBubbleHit = false; shooter.x = 2048 / 2; shooter.y = 2732 / 2; var circle = game.attachAsset('circle', { anchorX: 0.5, anchorY: 0.5 }); circle.width = 600; circle.height = 600; circle.alpha = 1; circle.x = 2048 / 2; circle.y = 2732 / 2; game.addChildAt(circle, 2); var isGameOver = false; var tickOffset = 0; LK.on('tick', function () { var levelCompleted = false; var gameOver = false; if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } for (var i = 0; i < skaters.length; i++) { skaters[i]._update_migrated(); } for (var a = bubbles.length - 1; a >= 0; a--) { bubbles[a]._move_migrated(); for (var s = skaters.length - 1; s >= 0; s--) { if (bubbles[a].intersects(skaters[s])) { if (skaters[s] instanceof Snowboarder) { isGameOver = true; } else if (skaters[s]) { var explosion = game.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5 }); explosion.x = skaters[s].x; explosion.y = skaters[s].y; game.addChild(explosion); LK.setTimeout(function () { explosion.destroy(); }, 100); // Play Hit sound when an enemy dies LK.getSound('Hit').play(); skaters[s].destroy(); skaters.splice(s, 1); if (!bubbles[a].skatersHit) { bubbles[a].skatersHit = []; } bubbles[a].skatersHit.push(skaters[s]); var skaterScore = bubbles[a].skatersHit.length; LK.setScore(LK.getScore() + skaterScore); if (skaterScore >= 2) { if (game.lives < 4) { game.lives++; // Play Regen sound when a life is refilled LK.getSound('Regen').play(); bubbleUI.updateBubbles(game.lives); } currentCombo++; duckHoldingSign.show(skaters[s].x, skaters[s].y); } else { currentCombo = 0; } scoreText.setText(LK.getScore().toString()); } var skaterCount = skaters.filter(function (entity) { return !(entity instanceof Snowboarder); }).length; break; } } if (bubbles[a].x > 2048 || bubbles[a].x < 0 || bubbles[a].y > 2732 || bubbles[a].y < 0 || !bubbles[a].parent) { bubbleHitEdge = true; if (!bubbles[a].skatersHit || bubbles[a].skatersHit.length < 2) { currentCombo = 0; } bubbles[a].destroy(); bubbles.splice(a, 1); var skaterCount = skaters.filter(function (entity) { return !(entity instanceof Snowboarder); }).length; if (skaterCount === 0 && !game.levelTransitionInitiated && !game.levelTransitionInProgress) { game.levelCompleted = true; game.levelTransitionInitiated = true; if (!game.levelTransitionInProgress) { LK.setScore(LK.getScore() + game.lives * 5); scoreText.setText(LK.getScore().toString()); game.levelUp(); } } else if (bubbles.length === 0 && game.lives === 0) { isGameOver = true; } } } var skaterCount = skaters.filter(function (entity) { return !(entity instanceof Snowboarder); }).length; if (skaterCount === 0 && bubbles.length === 0 && !game.levelTransitionInitiated && !game.levelTransitionInProgress) { game.levelCompleted = true; game.levelTransitionInitiated = true; LK.setTimeout(function () { if (!game.levelTransitionInProgress) { LK.setScore(LK.getScore() + game.lives * 5); scoreText.setText(LK.getScore().toString()); game.levelUp(); } }, 500); } if (!levelCompleted && game.lives === 0 && bubbles.length === 0 && !isGameOver) { gameOver = true; } if (gameOver) { isGameOver = true; LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } });
===================================================================
--- original.js
+++ change.js
@@ -49,8 +49,24 @@
}
};
self.y = 2732 - self.bubbles[0].height - 5;
});
+var DuckHoldingSign = Container.expand(function () {
+ var self = Container.call(this);
+ var duckGraphics = self.attachAsset('duck_holding_a_sign', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.visible = false;
+ self.show = function (x, y) {
+ self.x = x;
+ self.y = y;
+ self.visible = true;
+ LK.setTimeout(function () {
+ self.visible = false;
+ }, 1000);
+ };
+});
var LifeRestorationAsset = Container.expand(function () {
var self = Container.call(this);
var lifeRestorationGraphics = self.attachAsset('lifeRestoration', {
anchorX: 0.5,
@@ -309,8 +325,11 @@
game.addChildAt(background, 1);
var bubbles = [];
var bubbleHitEdge = false;
var shooter = game.addChild(new Shooter());
+var duckHoldingSign = game.addChild(new DuckHoldingSign());
+var currentCombo = 0;
+var lastBubbleHit = false;
shooter.x = 2048 / 2;
shooter.y = 2732 / 2;
var circle = game.attachAsset('circle', {
anchorX: 0.5,
@@ -367,8 +386,12 @@
// Play Regen sound when a life is refilled
LK.getSound('Regen').play();
bubbleUI.updateBubbles(game.lives);
}
+ currentCombo++;
+ duckHoldingSign.show(skaters[s].x, skaters[s].y);
+ } else {
+ currentCombo = 0;
}
scoreText.setText(LK.getScore().toString());
}
var skaterCount = skaters.filter(function (entity) {
@@ -378,8 +401,11 @@
}
}
if (bubbles[a].x > 2048 || bubbles[a].x < 0 || bubbles[a].y > 2732 || bubbles[a].y < 0 || !bubbles[a].parent) {
bubbleHitEdge = true;
+ if (!bubbles[a].skatersHit || bubbles[a].skatersHit.length < 2) {
+ currentCombo = 0;
+ }
bubbles[a].destroy();
bubbles.splice(a, 1);
var skaterCount = skaters.filter(function (entity) {
return !(entity instanceof Snowboarder);
floor of an ice skating ring. top-view. seen from above. Single Game Texture. In-Game asset. 2d. High contrast. No shadows. pixelated.8 bit. game background
snowboarder. top-view. gta 2. seen from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit
snowball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit
frosty pipe tube. top-view. seen from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8-bit
dusty snow puff. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit
green plus sign. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit
frost circle arena. seen from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit
angry penguin snowboarder wearing a red santa hat. top-view. gta 2. seen from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit
angry penguin snowboarder wearing a red santa hat. top-view. gta 2. seen from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit
duck holding a sign written "combo". Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. duck holding a sign written "combo". Cartoon.
Giant angry penguin snowboarder wearing a red santa hat. top-view. gta 2. seen from above. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. pixelated. 8 bit. A
8-bit Pinguin_skater_features. Make a text written above (your way). A
Make a 8-bit achievement. Title:cool, being embarrassed. description:lose in stage 1
Make a 8-bit achievement. Title:I'm enjoying watching! description:make a ×3 hit combo
Make a 8-bit achievement. Title:poor duck! description:make a ×5 hit combo
Make a 8-bit secret achievement. Title:isekai quartet description:hit the snowball at a penguin in a position of a character positioned in the isekai quartet logo
Make a button achievements. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Coin icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Heart icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.