User prompt
Add 1 bird
User prompt
Add more blocks and pigs
User prompt
Make hardest level
User prompt
Add level 3 and game will end after the level 3
User prompt
In level 2 when we pull and realese the sling the bird doesnt stop
User prompt
Make level 2 slingshot system same level 1 slingshot system
User prompt
Add level 2 and game will end after the level 2
User prompt
The game does not end when you pass level 1
User prompt
Make level 3
User prompt
Make level 2
User prompt
Add angry birds background
Code edit (1 edits merged)
Please save this source code
User prompt
Slingshot Siege
Initial prompt
Make a angry birds
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bird = Container.expand(function () {
var self = Container.call(this);
var birdGraphics = self.attachAsset('bird', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocityX = 0;
self.velocityY = 0;
self.launched = false;
self.gravity = 0.3;
self.bounce = 0.3;
self.update = function () {
if (self.launched) {
self.velocityY += self.gravity;
self.x += self.velocityX;
self.y += self.velocityY;
// Ground collision
if (self.y > 2600) {
self.y = 2600;
self.velocityY *= -self.bounce;
self.velocityX *= 0.8;
if (Math.abs(self.velocityY) < 2) {
self.velocityY = 0;
}
}
// Side boundaries
if (self.x < 0 || self.x > 2048) {
self.velocityX *= -self.bounce;
}
}
};
self.launch = function (velX, velY) {
self.launched = true;
self.velocityX = velX;
self.velocityY = velY;
LK.getSound('launch').play();
};
return self;
});
var Block = Container.expand(function (type) {
var self = Container.call(this);
var assetName = type + 'Block';
var blockGraphics = self.attachAsset(assetName, {
anchorX: 0.5,
anchorY: 0.5
});
self.type = type;
self.health = type === 'wood' ? 50 : type === 'stone' ? 100 : 30; // ice is weakest
self.destroyed = false;
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health <= 0 && !self.destroyed) {
self.destroyed = true;
LK.effects.flashObject(self, 0xff0000, 200);
LK.getSound('hit').play();
LK.setScore(LK.getScore() + 10);
scoreText.setText(LK.getScore());
}
};
return self;
});
var Pig = Container.expand(function () {
var self = Container.call(this);
var pigGraphics = self.attachAsset('pig', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 100;
self.destroyed = false;
self.takeDamage = function (damage) {
self.health -= damage;
if (self.health <= 0 && !self.destroyed) {
self.destroyed = true;
LK.effects.flashObject(self, 0xffff00, 300);
LK.getSound('destroy').play();
LK.setScore(LK.getScore() + 100);
scoreText.setText(LK.getScore());
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Sky blue background
});
/****
* Game Code
****/
// Game variables
var birds = [];
var pigs = [];
var blocks = [];
var currentBird = null;
var slingshot = null;
var isDragging = false;
var trajectoryDots = [];
var slingshotX = 200;
var slingshotY = 2400;
var birdsRemaining = 6;
var level = 1;
// UI Elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
var birdsText = new Text2('Birds: 6', {
size: 50,
fill: 0xFFFFFF
});
birdsText.anchor.set(0, 0);
birdsText.x = 100;
birdsText.y = 100;
LK.gui.topLeft.addChild(birdsText);
var levelText = new Text2('Level: 1', {
size: 50,
fill: 0xFFFFFF
});
levelText.anchor.set(1, 0);
levelText.x = -100;
levelText.y = 100;
LK.gui.topRight.addChild(levelText);
// Create ground
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 1,
x: 0,
y: 2732
}));
// Create clouds for background atmosphere
var cloud1 = game.addChild(LK.getAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5,
x: 300,
y: 400,
alpha: 0.8
}));
var cloud2 = game.addChild(LK.getAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5,
x: 800,
y: 300,
alpha: 0.7
}));
var cloud3 = game.addChild(LK.getAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5,
x: 1400,
y: 450,
alpha: 0.6
}));
var cloud4 = game.addChild(LK.getAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5,
x: 1800,
y: 350,
alpha: 0.8
}));
// Create slingshot
slingshot = game.addChild(LK.getAsset('slingshot', {
anchorX: 0.5,
anchorY: 1,
x: slingshotX,
y: slingshotY
}));
// Create level structures - HARDEST LEVEL
function createLevel1() {
// LEFT TOWER - Stone fortress with multiple pigs
// Base foundation
var baseBlock1 = game.addChild(new Block('stone'));
baseBlock1.x = 1200;
baseBlock1.y = 2580;
blocks.push(baseBlock1);
var baseBlock2 = game.addChild(new Block('stone'));
baseBlock2.x = 1320;
baseBlock2.y = 2580;
blocks.push(baseBlock2);
var baseBlock3 = game.addChild(new Block('stone'));
baseBlock3.x = 1440;
baseBlock3.y = 2580;
blocks.push(baseBlock3);
// First level walls
var wall1 = game.addChild(new Block('stone'));
wall1.x = 1200;
wall1.y = 2544;
blocks.push(wall1);
var wall2 = game.addChild(new Block('stone'));
wall2.x = 1440;
wall2.y = 2544;
blocks.push(wall2);
// Pig on first level
var pig1 = game.addChild(new Pig());
pig1.x = 1320;
pig1.y = 2520;
pigs.push(pig1);
// Second level roof
var roof1 = game.addChild(new Block('wood'));
roof1.x = 1260;
roof1.y = 2508;
blocks.push(roof1);
var roof2 = game.addChild(new Block('wood'));
roof2.x = 1380;
roof2.y = 2508;
blocks.push(roof2);
// Second level walls
var wall3 = game.addChild(new Block('ice'));
wall3.x = 1220;
wall3.y = 2472;
blocks.push(wall3);
var wall4 = game.addChild(new Block('ice'));
wall4.x = 1420;
wall4.y = 2472;
blocks.push(wall4);
// Pig on second level
var pig2 = game.addChild(new Pig());
pig2.x = 1320;
pig2.y = 2448;
pigs.push(pig2);
// Third level - smaller
var smallRoof1 = game.addChild(new Block('ice'));
smallRoof1.x = 1300;
smallRoof1.y = 2436;
blocks.push(smallRoof1);
var smallRoof2 = game.addChild(new Block('ice'));
smallRoof2.x = 1340;
smallRoof2.y = 2436;
blocks.push(smallRoof2);
// CENTER TOWER - Mixed materials fortress
// Base
var centerBase1 = game.addChild(new Block('stone'));
centerBase1.x = 1600;
centerBase1.y = 2580;
blocks.push(centerBase1);
var centerBase2 = game.addChild(new Block('stone'));
centerBase2.x = 1720;
centerBase2.y = 2580;
blocks.push(centerBase2);
var centerBase3 = game.addChild(new Block('stone'));
centerBase3.x = 1840;
centerBase3.y = 2580;
blocks.push(centerBase3);
// Vertical supports
var support1 = game.addChild(new Block('wood'));
support1.x = 1600;
support1.y = 2544;
blocks.push(support1);
var support2 = game.addChild(new Block('wood'));
support2.x = 1720;
support2.y = 2544;
blocks.push(support2);
var support3 = game.addChild(new Block('wood'));
support3.x = 1840;
support3.y = 2544;
blocks.push(support3);
// Pigs in center structure
var pig3 = game.addChild(new Pig());
pig3.x = 1660;
pig3.y = 2520;
pigs.push(pig3);
var pig4 = game.addChild(new Pig());
pig4.x = 1780;
pig4.y = 2520;
pigs.push(pig4);
// Second level platform
var platform1 = game.addChild(new Block('ice'));
platform1.x = 1620;
platform1.y = 2508;
blocks.push(platform1);
var platform2 = game.addChild(new Block('ice'));
platform2.x = 1740;
platform2.y = 2508;
blocks.push(platform2);
var platform3 = game.addChild(new Block('ice'));
platform3.x = 1800;
platform3.y = 2508;
blocks.push(platform3);
// Vertical walls second level
var centerWall1 = game.addChild(new Block('stone'));
centerWall1.x = 1620;
centerWall1.y = 2472;
blocks.push(centerWall1);
var centerWall2 = game.addChild(new Block('stone'));
centerWall2.x = 1800;
centerWall2.y = 2472;
blocks.push(centerWall2);
// Pig on second center level
var pig5 = game.addChild(new Pig());
pig5.x = 1710;
pig5.y = 2448;
pigs.push(pig5);
// Top roof center
var centerRoof = game.addChild(new Block('wood'));
centerRoof.x = 1710;
centerRoof.y = 2436;
blocks.push(centerRoof);
// RIGHT TOWER - Ice and wood combination
// Base blocks
var rightBase1 = game.addChild(new Block('wood'));
rightBase1.x = 1950;
rightBase1.y = 2580;
blocks.push(rightBase1);
var rightBase2 = game.addChild(new Block('wood'));
rightBase2.x = 1950;
rightBase2.y = 2544;
blocks.push(rightBase2);
// Protected pig behind ice walls
var iceWall1 = game.addChild(new Block('ice'));
iceWall1.x = 1890;
iceWall1.y = 2580;
blocks.push(iceWall1);
var iceWall2 = game.addChild(new Block('ice'));
iceWall2.x = 1890;
iceWall2.y = 2544;
blocks.push(iceWall2);
var pig6 = game.addChild(new Pig());
pig6.x = 1920;
pig6.y = 2520;
pigs.push(pig6);
// Outer protective wall
var outerWall1 = game.addChild(new Block('stone'));
outerWall1.x = 1860;
outerWall1.y = 2580;
blocks.push(outerWall1);
var outerWall2 = game.addChild(new Block('stone'));
outerWall2.x = 1860;
outerWall2.y = 2544;
blocks.push(outerWall2);
// HIGH TOWER - Hardest to reach pig
var highBase1 = game.addChild(new Block('stone'));
highBase1.x = 1500;
highBase1.y = 2580;
blocks.push(highBase1);
var highSupport1 = game.addChild(new Block('stone'));
highSupport1.x = 1500;
highSupport1.y = 2544;
blocks.push(highSupport1);
var highSupport2 = game.addChild(new Block('stone'));
highSupport2.x = 1500;
highSupport2.y = 2508;
blocks.push(highSupport2);
var highSupport3 = game.addChild(new Block('wood'));
highSupport3.x = 1500;
highSupport3.y = 2472;
blocks.push(highSupport3);
var highSupport4 = game.addChild(new Block('ice'));
highSupport4.x = 1500;
highSupport4.y = 2436;
blocks.push(highSupport4);
// Pig at very top - hardest to reach
var pig7 = game.addChild(new Pig());
pig7.x = 1500;
pig7.y = 2400;
pigs.push(pig7);
// UNDERGROUND PIG - Hidden behind multiple stone blocks
var underground1 = game.addChild(new Block('stone'));
underground1.x = 1100;
underground1.y = 2580;
blocks.push(underground1);
var underground2 = game.addChild(new Block('stone'));
underground2.x = 1100;
underground2.y = 2544;
blocks.push(underground2);
var underground3 = game.addChild(new Block('stone'));
underground3.x = 1040;
underground3.y = 2580;
blocks.push(underground3);
var underground4 = game.addChild(new Block('stone'));
underground4.x = 1040;
underground4.y = 2544;
blocks.push(underground4);
// Hidden pig - very hard to reach
var pig8 = game.addChild(new Pig());
pig8.x = 1070;
pig8.y = 2520;
pigs.push(pig8);
// CONNECTING BRIDGES - Make it even harder
var bridge1 = game.addChild(new Block('ice'));
bridge1.x = 1370;
bridge1.y = 2400;
blocks.push(bridge1);
var bridge2 = game.addChild(new Block('ice'));
bridge2.x = 1550;
bridge2.y = 2350;
blocks.push(bridge2);
var bridge3 = game.addChild(new Block('wood'));
bridge3.x = 1750;
bridge3.y = 2380;
blocks.push(bridge3);
}
// Initialize first bird
function createNewBird() {
if (birdsRemaining > 0) {
currentBird = game.addChild(new Bird());
currentBird.x = slingshotX;
currentBird.y = slingshotY - 100;
birds.push(currentBird);
}
}
// Trajectory calculation
function calculateTrajectory(startX, startY, velX, velY) {
var dots = [];
var x = startX;
var y = startY;
var vx = velX;
var vy = velY;
var gravity = 0.3;
for (var i = 0; i < 50; i += 3) {
dots.push({
x: x,
y: y
});
vx *= 0.99;
vy += gravity;
x += vx * 3;
y += vy * 3;
if (y > 2600 || x > 2048) break;
}
return dots;
}
// Clear trajectory dots
function clearTrajectory() {
for (var i = 0; i < trajectoryDots.length; i++) {
trajectoryDots[i].destroy();
}
trajectoryDots = [];
}
// Show trajectory dots
function showTrajectory(dots) {
clearTrajectory();
for (var i = 0; i < dots.length; i++) {
var dot = game.addChild(LK.getAsset('trajectory', {
anchorX: 0.5,
anchorY: 0.5,
x: dots[i].x,
y: dots[i].y,
alpha: 0.5
}));
trajectoryDots.push(dot);
}
}
// Check collisions
function checkCollisions() {
for (var i = 0; i < birds.length; i++) {
var bird = birds[i];
if (!bird.launched) continue;
// Check bird vs pigs
for (var j = 0; j < pigs.length; j++) {
var pig = pigs[j];
if (!pig.destroyed && bird.intersects(pig)) {
var damage = Math.abs(bird.velocityX) + Math.abs(bird.velocityY);
pig.takeDamage(damage * 2);
}
}
// Check bird vs blocks
for (var k = 0; k < blocks.length; k++) {
var block = blocks[k];
if (!block.destroyed && bird.intersects(block)) {
var damage = Math.abs(bird.velocityX) + Math.abs(bird.velocityY);
block.takeDamage(damage);
bird.velocityX *= 0.5;
bird.velocityY *= 0.5;
}
}
}
}
// Check win condition
function checkWinCondition() {
var allPigsDestroyed = true;
for (var i = 0; i < pigs.length; i++) {
if (!pigs[i].destroyed) {
allPigsDestroyed = false;
break;
}
}
if (allPigsDestroyed) {
LK.setTimeout(function () {
LK.showYouWin();
}, 1000);
} else if (birdsRemaining <= 0 && (!currentBird || currentBird.launched && Math.abs(currentBird.velocityX) < 1 && Math.abs(currentBird.velocityY) < 1)) {
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
}
}
// Game event handlers
game.down = function (x, y, obj) {
if (currentBird && !currentBird.launched) {
isDragging = true;
}
};
game.move = function (x, y, obj) {
if (isDragging && currentBird && !currentBird.launched) {
var maxDistance = 150;
var deltaX = slingshotX - x;
var deltaY = slingshotY - 100 - y;
var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
if (distance > maxDistance) {
deltaX = deltaX / distance * maxDistance;
deltaY = deltaY / distance * maxDistance;
}
currentBird.x = slingshotX - deltaX;
currentBird.y = slingshotY - 100 - deltaY;
// Show trajectory
var velX = deltaX * 0.2;
var velY = deltaY * 0.2;
var trajectoryPoints = calculateTrajectory(currentBird.x, currentBird.y, velX, velY);
showTrajectory(trajectoryPoints);
}
};
game.up = function (x, y, obj) {
if (isDragging && currentBird && !currentBird.launched) {
isDragging = false;
clearTrajectory();
var deltaX = slingshotX - currentBird.x;
var deltaY = slingshotY - 100 - currentBird.y;
if (Math.abs(deltaX) > 5 || Math.abs(deltaY) > 5) {
currentBird.launch(deltaX * 0.2, deltaY * 0.2);
birdsRemaining--;
birdsText.setText('Birds: ' + birdsRemaining);
LK.setTimeout(function () {
createNewBird();
}, 2000);
}
}
};
// Main game update
game.update = function () {
checkCollisions();
checkWinCondition();
// Remove destroyed objects
for (var i = blocks.length - 1; i >= 0; i--) {
if (blocks[i].destroyed) {
blocks[i].destroy();
blocks.splice(i, 1);
}
}
for (var j = pigs.length - 1; j >= 0; j--) {
if (pigs[j].destroyed) {
pigs[j].alpha = Math.max(0, pigs[j].alpha - 0.02);
if (pigs[j].alpha <= 0) {
pigs[j].destroy();
pigs.splice(j, 1);
}
}
}
};
// Initialize level
createLevel1();
createNewBird(); ===================================================================
--- original.js
+++ change.js
@@ -107,18 +107,18 @@
var isDragging = false;
var trajectoryDots = [];
var slingshotX = 200;
var slingshotY = 2400;
-var birdsRemaining = 3;
+var birdsRemaining = 6;
var level = 1;
// UI Elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreText);
-var birdsText = new Text2('Birds: 3', {
+var birdsText = new Text2('Birds: 6', {
size: 50,
fill: 0xFFFFFF
});
birdsText.anchor.set(0, 0);
@@ -175,230 +175,231 @@
anchorY: 1,
x: slingshotX,
y: slingshotY
}));
-// Create level structures
+// Create level structures - HARDEST LEVEL
function createLevel1() {
- // Create pigs
+ // LEFT TOWER - Stone fortress with multiple pigs
+ // Base foundation
+ var baseBlock1 = game.addChild(new Block('stone'));
+ baseBlock1.x = 1200;
+ baseBlock1.y = 2580;
+ blocks.push(baseBlock1);
+ var baseBlock2 = game.addChild(new Block('stone'));
+ baseBlock2.x = 1320;
+ baseBlock2.y = 2580;
+ blocks.push(baseBlock2);
+ var baseBlock3 = game.addChild(new Block('stone'));
+ baseBlock3.x = 1440;
+ baseBlock3.y = 2580;
+ blocks.push(baseBlock3);
+ // First level walls
+ var wall1 = game.addChild(new Block('stone'));
+ wall1.x = 1200;
+ wall1.y = 2544;
+ blocks.push(wall1);
+ var wall2 = game.addChild(new Block('stone'));
+ wall2.x = 1440;
+ wall2.y = 2544;
+ blocks.push(wall2);
+ // Pig on first level
var pig1 = game.addChild(new Pig());
- pig1.x = 1400;
- pig1.y = 2300;
+ pig1.x = 1320;
+ pig1.y = 2520;
pigs.push(pig1);
+ // Second level roof
+ var roof1 = game.addChild(new Block('wood'));
+ roof1.x = 1260;
+ roof1.y = 2508;
+ blocks.push(roof1);
+ var roof2 = game.addChild(new Block('wood'));
+ roof2.x = 1380;
+ roof2.y = 2508;
+ blocks.push(roof2);
+ // Second level walls
+ var wall3 = game.addChild(new Block('ice'));
+ wall3.x = 1220;
+ wall3.y = 2472;
+ blocks.push(wall3);
+ var wall4 = game.addChild(new Block('ice'));
+ wall4.x = 1420;
+ wall4.y = 2472;
+ blocks.push(wall4);
+ // Pig on second level
var pig2 = game.addChild(new Pig());
- pig2.x = 1600;
- pig2.y = 2200;
+ pig2.x = 1320;
+ pig2.y = 2448;
pigs.push(pig2);
- // Create structure
- var block1 = game.addChild(new Block('wood'));
- block1.x = 1300;
- block1.y = 2350;
- blocks.push(block1);
- var block2 = game.addChild(new Block('wood'));
- block2.x = 1500;
- block2.y = 2350;
- blocks.push(block2);
- var block3 = game.addChild(new Block('stone'));
- block3.x = 1400;
- block3.y = 2250;
- blocks.push(block3);
- var block4 = game.addChild(new Block('ice'));
- block4.x = 1600;
- block4.y = 2300;
- blocks.push(block4);
-}
-function createLevel2() {
- // Create more pigs for level 2
- var pig1 = game.addChild(new Pig());
- pig1.x = 1300;
- pig1.y = 2250;
- pigs.push(pig1);
- var pig2 = game.addChild(new Pig());
- pig2.x = 1500;
- pig2.y = 2150;
- pigs.push(pig2);
+ // Third level - smaller
+ var smallRoof1 = game.addChild(new Block('ice'));
+ smallRoof1.x = 1300;
+ smallRoof1.y = 2436;
+ blocks.push(smallRoof1);
+ var smallRoof2 = game.addChild(new Block('ice'));
+ smallRoof2.x = 1340;
+ smallRoof2.y = 2436;
+ blocks.push(smallRoof2);
+ // CENTER TOWER - Mixed materials fortress
+ // Base
+ var centerBase1 = game.addChild(new Block('stone'));
+ centerBase1.x = 1600;
+ centerBase1.y = 2580;
+ blocks.push(centerBase1);
+ var centerBase2 = game.addChild(new Block('stone'));
+ centerBase2.x = 1720;
+ centerBase2.y = 2580;
+ blocks.push(centerBase2);
+ var centerBase3 = game.addChild(new Block('stone'));
+ centerBase3.x = 1840;
+ centerBase3.y = 2580;
+ blocks.push(centerBase3);
+ // Vertical supports
+ var support1 = game.addChild(new Block('wood'));
+ support1.x = 1600;
+ support1.y = 2544;
+ blocks.push(support1);
+ var support2 = game.addChild(new Block('wood'));
+ support2.x = 1720;
+ support2.y = 2544;
+ blocks.push(support2);
+ var support3 = game.addChild(new Block('wood'));
+ support3.x = 1840;
+ support3.y = 2544;
+ blocks.push(support3);
+ // Pigs in center structure
var pig3 = game.addChild(new Pig());
- pig3.x = 1700;
- pig3.y = 2200;
+ pig3.x = 1660;
+ pig3.y = 2520;
pigs.push(pig3);
- // Create more complex structure for level 2
- var block1 = game.addChild(new Block('stone'));
- block1.x = 1200;
- block1.y = 2350;
- blocks.push(block1);
- var block2 = game.addChild(new Block('wood'));
- block2.x = 1320;
- block2.y = 2350;
- blocks.push(block2);
- var block3 = game.addChild(new Block('wood'));
- block3.x = 1440;
- block3.y = 2350;
- blocks.push(block3);
- var block4 = game.addChild(new Block('stone'));
- block4.x = 1560;
- block4.y = 2350;
- blocks.push(block4);
- var block5 = game.addChild(new Block('ice'));
- block5.x = 1680;
- block5.y = 2350;
- blocks.push(block5);
- var block6 = game.addChild(new Block('stone'));
- block6.x = 1800;
- block6.y = 2350;
- blocks.push(block6);
- // Second row
- var block7 = game.addChild(new Block('wood'));
- block7.x = 1260;
- block7.y = 2280;
- blocks.push(block7);
- var block8 = game.addChild(new Block('ice'));
- block8.x = 1380;
- block8.y = 2280;
- blocks.push(block8);
- var block9 = game.addChild(new Block('wood'));
- block9.x = 1500;
- block9.y = 2280;
- blocks.push(block9);
- var block10 = game.addChild(new Block('ice'));
- block10.x = 1620;
- block10.y = 2280;
- blocks.push(block10);
- var block11 = game.addChild(new Block('wood'));
- block11.x = 1740;
- block11.y = 2280;
- blocks.push(block11);
- // Third row
- var block12 = game.addChild(new Block('stone'));
- block12.x = 1400;
- block12.y = 2210;
- blocks.push(block12);
- var block13 = game.addChild(new Block('stone'));
- block13.x = 1600;
- block13.y = 2210;
- blocks.push(block13);
-}
-function createLevel3() {
- // Create 4 pigs for level 3
- var pig1 = game.addChild(new Pig());
- pig1.x = 1250;
- pig1.y = 2200;
- pigs.push(pig1);
- var pig2 = game.addChild(new Pig());
- pig2.x = 1450;
- pig2.y = 2100;
- pigs.push(pig2);
- var pig3 = game.addChild(new Pig());
- pig3.x = 1650;
- pig3.y = 2150;
- pigs.push(pig3);
var pig4 = game.addChild(new Pig());
- pig4.x = 1550;
- pig4.y = 2050;
+ pig4.x = 1780;
+ pig4.y = 2520;
pigs.push(pig4);
- // Create most complex structure for level 3 - bottom row
- var block1 = game.addChild(new Block('stone'));
- block1.x = 1100;
- block1.y = 2350;
- blocks.push(block1);
- var block2 = game.addChild(new Block('stone'));
- block2.x = 1220;
- block2.y = 2350;
- blocks.push(block2);
- var block3 = game.addChild(new Block('wood'));
- block3.x = 1340;
- block3.y = 2350;
- blocks.push(block3);
- var block4 = game.addChild(new Block('wood'));
- block4.x = 1460;
- block4.y = 2350;
- blocks.push(block4);
- var block5 = game.addChild(new Block('wood'));
- block5.x = 1580;
- block5.y = 2350;
- blocks.push(block5);
- var block6 = game.addChild(new Block('stone'));
- block6.x = 1700;
- block6.y = 2350;
- blocks.push(block6);
- var block7 = game.addChild(new Block('stone'));
- block7.x = 1820;
- block7.y = 2350;
- blocks.push(block7);
- // Second row
- var block8 = game.addChild(new Block('ice'));
- block8.x = 1160;
- block8.y = 2280;
- blocks.push(block8);
- var block9 = game.addChild(new Block('wood'));
- block9.x = 1280;
- block9.y = 2280;
- blocks.push(block9);
- var block10 = game.addChild(new Block('stone'));
- block10.x = 1400;
- block10.y = 2280;
- blocks.push(block10);
- var block11 = game.addChild(new Block('stone'));
- block11.x = 1520;
- block11.y = 2280;
- blocks.push(block11);
- var block12 = game.addChild(new Block('wood'));
- block12.x = 1640;
- block12.y = 2280;
- blocks.push(block12);
- var block13 = game.addChild(new Block('ice'));
- block13.x = 1760;
- block13.y = 2280;
- blocks.push(block13);
- // Third row
- var block14 = game.addChild(new Block('wood'));
- block14.x = 1220;
- block14.y = 2210;
- blocks.push(block14);
- var block15 = game.addChild(new Block('ice'));
- block15.x = 1340;
- block15.y = 2210;
- blocks.push(block15);
- var block16 = game.addChild(new Block('stone'));
- block16.x = 1460;
- block16.y = 2210;
- blocks.push(block16);
- var block17 = game.addChild(new Block('ice'));
- block17.x = 1580;
- block17.y = 2210;
- blocks.push(block17);
- var block18 = game.addChild(new Block('wood'));
- block18.x = 1700;
- block18.y = 2210;
- blocks.push(block18);
- // Fourth row
- var block19 = game.addChild(new Block('stone'));
- block19.x = 1280;
- block19.y = 2140;
- blocks.push(block19);
- var block20 = game.addChild(new Block('wood'));
- block20.x = 1400;
- block20.y = 2140;
- blocks.push(block20);
- var block21 = game.addChild(new Block('wood'));
- block21.x = 1520;
- block21.y = 2140;
- blocks.push(block21);
- var block22 = game.addChild(new Block('stone'));
- block22.x = 1640;
- block22.y = 2140;
- blocks.push(block22);
- // Top row
- var block23 = game.addChild(new Block('ice'));
- block23.x = 1340;
- block23.y = 2070;
- blocks.push(block23);
- var block24 = game.addChild(new Block('ice'));
- block24.x = 1460;
- block24.y = 2070;
- blocks.push(block24);
- var block25 = game.addChild(new Block('ice'));
- block25.x = 1580;
- block25.y = 2070;
- blocks.push(block25);
+ // Second level platform
+ var platform1 = game.addChild(new Block('ice'));
+ platform1.x = 1620;
+ platform1.y = 2508;
+ blocks.push(platform1);
+ var platform2 = game.addChild(new Block('ice'));
+ platform2.x = 1740;
+ platform2.y = 2508;
+ blocks.push(platform2);
+ var platform3 = game.addChild(new Block('ice'));
+ platform3.x = 1800;
+ platform3.y = 2508;
+ blocks.push(platform3);
+ // Vertical walls second level
+ var centerWall1 = game.addChild(new Block('stone'));
+ centerWall1.x = 1620;
+ centerWall1.y = 2472;
+ blocks.push(centerWall1);
+ var centerWall2 = game.addChild(new Block('stone'));
+ centerWall2.x = 1800;
+ centerWall2.y = 2472;
+ blocks.push(centerWall2);
+ // Pig on second center level
+ var pig5 = game.addChild(new Pig());
+ pig5.x = 1710;
+ pig5.y = 2448;
+ pigs.push(pig5);
+ // Top roof center
+ var centerRoof = game.addChild(new Block('wood'));
+ centerRoof.x = 1710;
+ centerRoof.y = 2436;
+ blocks.push(centerRoof);
+ // RIGHT TOWER - Ice and wood combination
+ // Base blocks
+ var rightBase1 = game.addChild(new Block('wood'));
+ rightBase1.x = 1950;
+ rightBase1.y = 2580;
+ blocks.push(rightBase1);
+ var rightBase2 = game.addChild(new Block('wood'));
+ rightBase2.x = 1950;
+ rightBase2.y = 2544;
+ blocks.push(rightBase2);
+ // Protected pig behind ice walls
+ var iceWall1 = game.addChild(new Block('ice'));
+ iceWall1.x = 1890;
+ iceWall1.y = 2580;
+ blocks.push(iceWall1);
+ var iceWall2 = game.addChild(new Block('ice'));
+ iceWall2.x = 1890;
+ iceWall2.y = 2544;
+ blocks.push(iceWall2);
+ var pig6 = game.addChild(new Pig());
+ pig6.x = 1920;
+ pig6.y = 2520;
+ pigs.push(pig6);
+ // Outer protective wall
+ var outerWall1 = game.addChild(new Block('stone'));
+ outerWall1.x = 1860;
+ outerWall1.y = 2580;
+ blocks.push(outerWall1);
+ var outerWall2 = game.addChild(new Block('stone'));
+ outerWall2.x = 1860;
+ outerWall2.y = 2544;
+ blocks.push(outerWall2);
+ // HIGH TOWER - Hardest to reach pig
+ var highBase1 = game.addChild(new Block('stone'));
+ highBase1.x = 1500;
+ highBase1.y = 2580;
+ blocks.push(highBase1);
+ var highSupport1 = game.addChild(new Block('stone'));
+ highSupport1.x = 1500;
+ highSupport1.y = 2544;
+ blocks.push(highSupport1);
+ var highSupport2 = game.addChild(new Block('stone'));
+ highSupport2.x = 1500;
+ highSupport2.y = 2508;
+ blocks.push(highSupport2);
+ var highSupport3 = game.addChild(new Block('wood'));
+ highSupport3.x = 1500;
+ highSupport3.y = 2472;
+ blocks.push(highSupport3);
+ var highSupport4 = game.addChild(new Block('ice'));
+ highSupport4.x = 1500;
+ highSupport4.y = 2436;
+ blocks.push(highSupport4);
+ // Pig at very top - hardest to reach
+ var pig7 = game.addChild(new Pig());
+ pig7.x = 1500;
+ pig7.y = 2400;
+ pigs.push(pig7);
+ // UNDERGROUND PIG - Hidden behind multiple stone blocks
+ var underground1 = game.addChild(new Block('stone'));
+ underground1.x = 1100;
+ underground1.y = 2580;
+ blocks.push(underground1);
+ var underground2 = game.addChild(new Block('stone'));
+ underground2.x = 1100;
+ underground2.y = 2544;
+ blocks.push(underground2);
+ var underground3 = game.addChild(new Block('stone'));
+ underground3.x = 1040;
+ underground3.y = 2580;
+ blocks.push(underground3);
+ var underground4 = game.addChild(new Block('stone'));
+ underground4.x = 1040;
+ underground4.y = 2544;
+ blocks.push(underground4);
+ // Hidden pig - very hard to reach
+ var pig8 = game.addChild(new Pig());
+ pig8.x = 1070;
+ pig8.y = 2520;
+ pigs.push(pig8);
+ // CONNECTING BRIDGES - Make it even harder
+ var bridge1 = game.addChild(new Block('ice'));
+ bridge1.x = 1370;
+ bridge1.y = 2400;
+ blocks.push(bridge1);
+ var bridge2 = game.addChild(new Block('ice'));
+ bridge2.x = 1550;
+ bridge2.y = 2350;
+ blocks.push(bridge2);
+ var bridge3 = game.addChild(new Block('wood'));
+ bridge3.x = 1750;
+ bridge3.y = 2380;
+ blocks.push(bridge3);
}
// Initialize first bird
function createNewBird() {
if (birdsRemaining > 0) {
@@ -484,45 +485,11 @@
break;
}
}
if (allPigsDestroyed) {
- if (level === 1) {
- LK.setTimeout(function () {
- // Progress to level 2
- level = 2;
- levelText.setText('Level: ' + level);
- birdsRemaining = 3;
- birdsText.setText('Birds: ' + birdsRemaining);
- // Clear existing birds
- for (var i = birds.length - 1; i >= 0; i--) {
- birds[i].destroy();
- birds.splice(i, 1);
- }
- currentBird = null;
- createLevel2();
- createNewBird();
- }, 1000);
- } else if (level === 2) {
- LK.setTimeout(function () {
- // Progress to level 3
- level = 3;
- levelText.setText('Level: ' + level);
- birdsRemaining = 3;
- birdsText.setText('Birds: ' + birdsRemaining);
- // Clear existing birds
- for (var i = birds.length - 1; i >= 0; i--) {
- birds[i].destroy();
- birds.splice(i, 1);
- }
- currentBird = null;
- createLevel3();
- createNewBird();
- }, 1000);
- } else if (level === 3) {
- LK.setTimeout(function () {
- LK.showYouWin();
- }, 1000);
- }
+ LK.setTimeout(function () {
+ LK.showYouWin();
+ }, 1000);
} else if (birdsRemaining <= 0 && (!currentBird || currentBird.launched && Math.abs(currentBird.velocityX) < 1 && Math.abs(currentBird.velocityY) < 1)) {
LK.setTimeout(function () {
LK.showGameOver();
}, 1000);
Green pig no angry. In-Game asset. 2d. High contrast. No shadows
Angry birds red. In-Game asset. 2d. High contrast. No shadows
Blue glass block. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Wood block. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Gray stone block. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Angry birds slingshot. In-Game asset. 2d. High contrast. No shadows
Cloud. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Angry birds 2 King pig. In-Game asset. 2d. High contrast. No shadows
Angry birds blue bird. In-Game asset. 2d. High contrast. No shadows
Angry birds vertical poster. In-Game asset. 2d. High contrast. No shadows
Angry birds logo. In-Game asset. 2d. High contrast. No shadows