Code edit (2 edits merged)
Please save this source code
User prompt
put flags above assets
Code edit (7 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: Cannot read properties of undefined (reading 'y')' in or related to this line: 'if (game.children[i].y > 2732 || game.children[i].y < 0 || game.children[i].x > 2048 || game.children[i].x < 0) {' Line Number: 540
Code edit (1 edits merged)
Please save this source code
User prompt
destroy 'Bighorn', 'Cactus', 'Coyote', 'Joshua', 'Mojave', 'Rabbit', 'Roadrunner', 'Scorpion', 'Tumble', 'Yucca', 'gascan', 'lion', and 'tire' if they get to y=2200
User prompt
Please fix the bug: 'ReferenceError: Flag is not defined' in or related to this line: 'if (game.children[i].y > 2200 && !(game.children[i] instanceof Flag)) {' Line Number: 536
User prompt
Please fix the bug: 'ReferenceError: Flag is not defined' in or related to this line: 'if (game.children[i].y > 2200 && !(game.children[i] instanceof Flag)) {' Line Number: 536
User prompt
destroy any asset except flags if they get past y=2200
User prompt
DESTROY ANY ASSET THAT HITS Y=2200
User prompt
flash fuelTxt green when % increases by 2
User prompt
flash tiresTxt green when % increases by 2
User prompt
flash tiresTxt red for 1 second when the % drops by 3
User prompt
after 'airwrench' is played, play 'tirebonus'
User prompt
after 'liquid' is played, play 'gascanbonus'
User prompt
spawn gascan and tire between x=100 and x=2000
User prompt
tire and gascan spawn a minimum safe distance of 100
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
at distance 50, win game
User prompt
spawn fuel every 2.5 distance
User prompt
spawn tire every 2.5 distance
Code edit (2 edits merged)
Please save this source code
User prompt
spawn scorpion 50%
User prompt
spawn roadrunner 50%
/****
* Classes
****/
// Bighorn class to represent the randomly spawned Bighorn
var Bighorn = Container.expand(function () {
var self = Container.call(this);
var bighornGraphics = self.attachAsset('Bighorn', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Cactus class to represent the randomly spawned Cactus
var Cactus = Container.expand(function () {
var self = Container.call(this);
var cactusGraphics = self.attachAsset('Cactus', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Coyote class to represent the randomly spawned Coyote
var Coyote = Container.expand(function () {
var self = Container.call(this);
var coyoteGraphics = self.attachAsset('Coyote', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
//<Assets used in the game will automatically appear here>
// DuneBuggy class to represent the player's vehicle
var DuneBuggy = Container.expand(function () {
var self = Container.call(this);
var buggyGraphics = self.attachAsset('duneBuggy', {
anchorX: 0.5,
anchorY: 0.5
});
// Initialize previous position for rotation calculation
self.previousX = self.x;
self.previousY = self.y;
self.speed = 5;
self.update = function () {
// Keep the duneBuggy straight without rotation
buggyGraphics.rotation = 0; // Set rotation to 0 to keep it straight
// Store the current position for the next update
self.previousX = self.x;
self.previousY = self.y;
};
});
// GasCan class to represent the randomly spawned GasCan
var GasCan = Container.expand(function () {
var self = Container.call(this);
var gascanGraphics = self.attachAsset('gascan', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Joshua class to represent the randomly spawned Joshua
var Joshua = Container.expand(function () {
var self = Container.call(this);
var joshuaGraphics = self.attachAsset('Joshua', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Lion class to represent the randomly spawned Lion
var Lion = Container.expand(function () {
var self = Container.call(this);
var lionGraphics = self.attachAsset('lion', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Mojave class to represent the randomly spawned Mojave
var Mojave = Container.expand(function () {
var self = Container.call(this);
var mojaveGraphics = self.attachAsset('Mojave', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Rabbit class to represent the randomly spawned Rabbit
var Rabbit = Container.expand(function () {
var self = Container.call(this);
var rabbitGraphics = self.attachAsset('Rabbit', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Roadrunner class to represent the randomly spawned Roadrunner
var Roadrunner = Container.expand(function () {
var self = Container.call(this);
var roadrunnerGraphics = self.attachAsset('Roadrunner', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Scorpion class to represent the randomly spawned Scorpion
var Scorpion = Container.expand(function () {
var self = Container.call(this);
var scorpionGraphics = self.attachAsset('Scorpion', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Tire class to represent the randomly spawned Tire
var Tire = Container.expand(function () {
var self = Container.call(this);
var tireGraphics = self.attachAsset('tire', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Tumble class to represent the randomly spawned Tumble
var Tumble = Container.expand(function () {
var self = Container.call(this);
var tumbleGraphics = self.attachAsset('Tumble', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
// Yucca class to represent the randomly spawned Yucca
var Yucca = Container.expand(function () {
var self = Container.call(this);
var yuccaGraphics = self.attachAsset('Yucca', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({});
/****
* Game Code
****/
// Play 'yehaw' sound at the start of the game
LK.getSound('yehaw').play();
// Play 'music' on repeat at the start of the game
LK.playMusic('music', {
loop: true
});
// Add Flag to the lower left of the screen
var flag = LK.getAsset('Flag', {
anchorX: 0.5,
anchorY: 0.5,
x: 180,
// Adjusted to position the flag at the lower left
y: 2732 - 180 // Adjusted to position the flag at the lower left
});
game.addChild(flag);
// Add a second Flag to the right of the first flag
var secondFlag = LK.getAsset('Flag', {
anchorX: 0.5,
anchorY: 0.5,
x: 180 + 360,
// Positioned to the right of the first flag
y: 2732 - 180
});
game.addChild(secondFlag);
// Add a third Flag to the right of the second flag
var thirdFlag = LK.getAsset('Flag', {
anchorX: 0.5,
anchorY: 0.5,
x: 180 + 360 * 2,
// Positioned to the right of the second flag
y: 2732 - 180
});
game.addChild(thirdFlag);
// Add a fourth Flag to the right of the third flag
var fourthFlag = LK.getAsset('Flag', {
anchorX: 0.5,
anchorY: 0.5,
x: 180 + 360 * 3,
// Positioned to the right of the third flag
y: 2732 - 180
});
game.addChild(fourthFlag);
// Add a fifth Flag to the right of the fourth flag
var fifthFlag = LK.getAsset('Flag', {
anchorX: 0.5,
anchorY: 0.5,
x: 180 + 360 * 4,
// Positioned to the right of the fourth flag
y: 2732 - 180
});
game.addChild(fifthFlag);
// Add a sixth Flag to the right of the fifth flag
var sixthFlag = LK.getAsset('Flag', {
anchorX: 0.5,
anchorY: 0.5,
x: 180 + 360 * 5,
// Positioned to the right of the fifth flag
y: 2732 - 180
});
game.addChild(sixthFlag);
// Add track as the background
var track = LK.getAsset('track', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(track);
// Add GasCan
var gascan = new GasCan();
gascan.x = 512; // Position GasCan
gascan.y = 200;
if (!isOverlapping(gascan) && Math.abs(gascan.x - tire.x) >= 100) {
game.addChild(gascan);
gascan.zIndex = 10; // Ensure GasCan is above the track
}
// Add Tire
var tire = new Tire();
tire.x = 512; // Position Tire
tire.y = 200;
if (!isOverlapping(tire) && Math.abs(tire.x - gascan.x) >= 100) {
game.addChild(tire);
tire.zIndex = 10; // Ensure Tire is above the track
}
function isOverlapping(newObject) {
for (var i = 0; i < game.children.length; i++) {
if (game.children[i] !== newObject && game.children[i].intersects(newObject)) {
return true;
}
}
return false;
}
var duneBuggy = game.addChild(new DuneBuggy());
duneBuggy.x = 2048 / 2;
duneBuggy.y = 2000;
var obstacles = [];
var supplies = [];
var score = 0;
var scoreTxt = new Text2('Distance: 0', {
size: 120,
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
scoreTxt.x -= 0; // Move slightly to the left
scoreTxt.y += 0; // Move down a little bit
LK.gui.top.addChild(scoreTxt);
var tiresTxt = new Text2('Tires: 100%', {
size: 100,
fill: "#ffffff"
});
tiresTxt.anchor.set(0.5, 0);
tiresTxt.x -= 400; // Move tires text to the left
tiresTxt.y += 130; // Move tires text down
LK.gui.top.addChild(tiresTxt);
var fuelTxt = new Text2('Fuel:', {
size: 100,
fill: "#ffffff"
});
fuelTxt.anchor.set(0.5, 0);
fuelTxt.x -= -340; // Move fuel text to the left by 400
fuelTxt.y += 130; // Move fuel text down by 800
LK.gui.top.addChild(fuelTxt);
var distance = 0;
var fuel = 15; // Set initial fuel to 15 gallons
var tires = 100;
fuelTxt.setText('Fuel: ' + fuel + ' Gallons');
game.update = function () {
if (LK.ticks % 60 == 0) {
distance += 0.1;
scoreTxt.setText('Miles: ' + distance.toFixed(1));
if (distance % 2.5 < 0.1) {
LK.getSound('woohoo').play(); // Play 'woohoo' sound every 5 distance
}
if (distance % 2 < 0.1) {
fuel -= 1;
fuelTxt.setText('Fuel: ' + fuel + ' Gallons');
if (fuel <= 0) {
LK.showGameOver();
}
}
// Spawn Tire every 2.5 distance
if (distance >= 50) {
LK.showGameOver(); // Win the game when distance reaches 50
return;
}
if (distance % 2.5 < 0.1) {
var tire = new Tire();
tire.x = 100 + Math.random() * 1900; // Random x position between 100 and 2000
tire.y = 250;
if (!isOverlapping(tire)) {
game.addChild(tire);
}
// Spawn Fuel every 2.5 distance
var gascan = new GasCan();
gascan.x = 100 + Math.random() * 1900; // Random x position between 100 and 2000
gascan.y = 250;
if (!isOverlapping(gascan)) {
game.addChild(gascan);
}
}
// Spawn Bighorn, Cactus and Coyote at different intervals
if (LK.ticks % 20 == 0 && LK.ticks > 300) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var bighorn = new Bighorn();
bighorn.x = 500; // Keep x coordinate
bighorn.y = 250;
game.addChild(bighorn);
}
}
if (LK.ticks % 20 == 0 && LK.ticks > 300) {
if (Math.random() < 0.5) {
// 30% chance to spawn
var lion = new Lion();
lion.x = 300;
lion.y = 250;
game.addChild(lion);
}
}
if (LK.ticks % 20 == 0 && LK.ticks > 300) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var coyote = new Coyote();
coyote.x = 100;
coyote.y = 250;
game.addChild(coyote);
}
}
if (LK.ticks % 20 == 0 && LK.ticks > 350) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var cactus = new Cactus();
cactus.x = 700; // Keep x coordinate
cactus.y = 250;
game.addChild(cactus);
}
}
if (LK.ticks % 20 == 0 && LK.ticks > 450) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var joshua = new Joshua();
joshua.x = 900;
joshua.y = 250;
game.addChild(joshua);
}
}
if (LK.ticks % 20 == 0 && LK.ticks > 500) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var mojave = new Mojave();
mojave.x = 1100;
mojave.y = 250;
game.addChild(mojave);
}
}
if (LK.ticks % 20 == 0 && LK.ticks > 500) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var tumble = new Tumble();
tumble.x = 1300;
tumble.y = 250;
game.addChild(tumble);
}
}
if (LK.ticks % 20 == 0 && LK.ticks > 500) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var yucca = new Yucca();
yucca.x = 1500;
yucca.y = 250;
game.addChild(yucca);
}
}
if (LK.ticks % 20 == 0 && LK.ticks > 500) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var rabbit = new Rabbit();
rabbit.x = 1700;
rabbit.y = 250;
game.addChild(rabbit);
}
}
// Spawn Roadrunner at random intervals
if (LK.ticks % 20 == 0 && LK.ticks > 500) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var roadrunner = new Roadrunner();
roadrunner.x = 1900;
roadrunner.y = 250;
game.addChild(roadrunner);
}
}
// Spawn Scorpion at random intervals
if (LK.ticks % 20 == 0 && LK.ticks > 500) {
if (Math.random() < 0.5) {
// 50% chance to spawn
var scorpion = new Scorpion();
scorpion.x = 2000;
scorpion.y = 250;
game.addChild(scorpion);
}
}
// Check for collision between duneBuggy and Bighorn, Cactus, Coyote, Joshua, Mojave, Rabbit, Roadrunner, Scorpion, Snake, Spider, Tumble, Turtle, or Yucca
for (var i = game.children.length - 1; i >= 0; i--) {
if (game.children[i] instanceof Bighorn || game.children[i] instanceof Cactus || game.children[i] instanceof Coyote || game.children[i] instanceof Joshua || game.children[i] instanceof Mojave || game.children[i] instanceof Tumble || game.children[i] instanceof Yucca || game.children[i] instanceof Rabbit || game.children[i] instanceof Roadrunner || game.children[i] instanceof Scorpion || game.children[i] instanceof Lion) {
if (duneBuggy.intersects(game.children[i])) {
if (game.children[i] instanceof Bighorn) {
LK.getSound('sheep').play(); // Play 'sheep' sound
} else if (game.children[i] instanceof Cactus || game.children[i] instanceof Joshua || game.children[i] instanceof Mojave || game.children[i] instanceof Tumble || game.children[i] instanceof Yucca) {
LK.getSound('crash').play(); // Play 'crash' sound
} else if (game.children[i] instanceof Coyote) {
LK.getSound('yelp').play(); // Play 'yelp' sound
} else if (game.children[i] instanceof Rabbit) {
LK.getSound('rabbit').play(); // Play 'rabbit' sound
} else if (game.children[i] instanceof Roadrunner) {
LK.getSound('bird').play(); // Play 'bird' sound
} else if (game.children[i] instanceof Scorpion) {
LK.getSound('splat').play(); // Play 'splat' sound
} else if (game.children[i] instanceof Lion) {
LK.getSound('roar').play(); // Play 'roar' sound
}
tires -= 3; // decrease tires by 3%
tiresTxt.setText('Tires: ' + tires + '%'); // update tires text
LK.effects.flashObject(tiresTxt, 0xff0000, 1000); // flash tiresTxt red for 1 second
if (tires <= 0) {
LK.showGameOver(); // game over if tires reach 0
}
game.children[i].destroy(); // destroy Bighorn, Cactus, Coyote, Joshua, Mojave, Rabbit, Roadrunner, Scorpion, Snake, or Spider on collision
return; // return after destroying to prevent accessing it after destruction
}
} else if (game.children[i] instanceof GasCan && duneBuggy.intersects(game.children[i])) {
LK.getSound('liquid').play(); // Play 'liquid' sound
LK.getSound('gascanbonus').play(); // Play 'gascanbonus' sound
fuel = Math.min(fuel + 2, 15); // increase fuel by 2 gallons
fuelTxt.setText('Fuel: ' + fuel + ' Gallons'); // update fuel text
LK.effects.flashObject(fuelTxt, 0x00ff00, 1000); // flash fuelTxt green for 1 second
game.children[i].destroy(); // destroy GasCan on collision
return; // return after destroying to prevent accessing it after destruction
} else if (game.children[i] instanceof Tire && duneBuggy.intersects(game.children[i])) {
LK.getSound('airwrench').play(); // Play 'airwrench' sound
LK.getSound('tirebonus').play(); // Play 'tirebonus' sound
tires = Math.min(tires + 2, 100); // increase tires by 2%, max 100%
tiresTxt.setText('Tires: ' + tires + '%'); // update tires text
LK.effects.flashObject(tiresTxt, 0x00ff00, 1000); // flash tiresTxt green for 1 second
game.children[i].destroy(); // destroy Tire on collision
return; // return after destroying to prevent accessing it after destruction
}
// Destroy any asset that leaves the screen
if (game.children[i].y > 2050 || game.children[i].y < 0 || game.children[i].x > 2048 || game.children[i].x < 0) {
game.children[i].destroy(); // destroy if it leaves the screen
}
}
}
};
game.down = function (x, y, obj) {
duneBuggy.x = 2048 / 2;
};
game.move = function (x, y, obj) {
duneBuggy.x = Math.max(175, Math.min(1900, x));
};
game.up = function (x, y, obj) {
// No action needed on up event
}; ===================================================================
--- original.js
+++ change.js
@@ -7,13 +7,8 @@
var bighornGraphics = self.attachAsset('Bighorn', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveBighorn = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -bighornGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -24,13 +19,8 @@
var cactusGraphics = self.attachAsset('Cactus', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveCactus = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -cactusGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -41,13 +31,8 @@
var coyoteGraphics = self.attachAsset('Coyote', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveCoyote = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -coyoteGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -59,13 +44,8 @@
var buggyGraphics = self.attachAsset('duneBuggy', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveBuggy = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -buggyGraphics.height / 2
- });
// Initialize previous position for rotation calculation
self.previousX = self.x;
self.previousY = self.y;
self.speed = 5;
@@ -83,13 +63,8 @@
var gascanGraphics = self.attachAsset('gascan', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveGasCan = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -gascanGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -100,13 +75,8 @@
var joshuaGraphics = self.attachAsset('Joshua', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveJoshua = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -joshuaGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -117,13 +87,8 @@
var lionGraphics = self.attachAsset('lion', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveLion = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -lionGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -134,13 +99,8 @@
var mojaveGraphics = self.attachAsset('Mojave', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveMojave = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -mojaveGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -151,13 +111,8 @@
var rabbitGraphics = self.attachAsset('Rabbit', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveRabbit = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -rabbitGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -168,13 +123,8 @@
var roadrunnerGraphics = self.attachAsset('Roadrunner', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveRoadrunner = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -roadrunnerGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -185,13 +135,8 @@
var scorpionGraphics = self.attachAsset('Scorpion', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveScorpion = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -scorpionGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -202,13 +147,8 @@
var tireGraphics = self.attachAsset('tire', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveTire = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -tireGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -219,13 +159,8 @@
var tumbleGraphics = self.attachAsset('Tumble', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveTumble = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -tumbleGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -236,13 +171,8 @@
var yuccaGraphics = self.attachAsset('Yucca', {
anchorX: 0.5,
anchorY: 0.5
});
- var flagAboveYucca = self.attachAsset('Flag', {
- anchorX: 0.5,
- anchorY: 1.0,
- y: -yuccaGraphics.height / 2
- });
self.speed = 15;
self.update = function () {
self.y += self.speed;
};
@@ -563,9 +493,9 @@
game.children[i].destroy(); // destroy Tire on collision
return; // return after destroying to prevent accessing it after destruction
}
// Destroy any asset that leaves the screen
- if (game.children[i].y > 2732 || game.children[i].y < 0 || game.children[i].x > 2048 || game.children[i].x < 0) {
+ if (game.children[i].y > 2050 || game.children[i].y < 0 || game.children[i].x > 2048 || game.children[i].x < 0) {
game.children[i].destroy(); // destroy if it leaves the screen
}
}
}
sheep
Sound effect
crash
Sound effect
yelp
Sound effect
rabbit
Sound effect
runner
Sound effect
runner
Sound effect
roar
Sound effect
airwrench
Sound effect
liquid
Sound effect
music
Music
crash2
Sound effect
yehaw
Sound effect
woohoo
Sound effect
bird
Sound effect
splat
Sound effect
splat
Sound effect
gascanbonus
Sound effect
tirebonus
Sound effect