User prompt
make the backround bigger so it fits the screen
User prompt
make the boing sound play when the player faps
User prompt
add a parralaxing backround
User prompt
no they should!
User prompt
the bottom ones to not spawn directly at the bottom.
User prompt
make them not spawn from the middle
User prompt
even bigger since im using a square image now
User prompt
MAKE THEM BIGGER
User prompt
Please fix the bug: 'ReferenceError: pipeGraphics is not defined' in or related to this line: 'pipe.y = Math.random() < 0.5 ? 0 : 2732 - pipeGraphics.height;' Line Number: 74
User prompt
ONLY MAKE THE GRASS CLIFFS SPAWN FROM UP AND DOWN, NO INBETWEENS.
User prompt
ADD PIPES BACK AND DONT MAKE THEM YELLOW SQUARES AND MAKE THEM GRASS CLIFF THINGYS
User prompt
REMOVE THE PIPES
User prompt
remove the limbs and face and blush since im using an image now
User prompt
add the limbs, the face, and blush to it too!
Initial prompt
Cube With Wings
===================================================================
--- original.js
+++ change.js
@@ -1,123 +1,193 @@
-/****
+/****
* Classes
-****/
+****/
//<Assets used in the game will automatically appear here>
// Define the FlappyBird class
var FlappyBird = Container.expand(function () {
- var self = Container.call(this);
- // Create and attach the bird asset
- var birdGraphics = self.attachAsset('bird', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.velocity = 0;
- self.gravity = 0.5;
- self.lift = -10;
- // Update function for the bird
- self.update = function () {
- self.velocity += self.gravity;
- self.y += self.velocity;
- // Prevent the bird from going off the screen
- if (self.y > 2732 - birdGraphics.height / 2) {
- self.y = 2732 - birdGraphics.height / 2;
- self.velocity = 0;
- }
- if (self.y < birdGraphics.height / 2) {
- self.y = birdGraphics.height / 2;
- self.velocity = 0;
- }
- };
- // Function to make the bird jump
- self.jump = function () {
- self.velocity = self.lift;
- };
+ var self = Container.call(this);
+ // Create and attach the bird asset
+ var birdGraphics = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Add left arm
+ var leftArm = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 20,
+ height: 60,
+ color: 0x000000
+ });
+ leftArm.x = -birdGraphics.width / 2 - 10;
+ leftArm.y = 0;
+ // Add right arm
+ var rightArm = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 20,
+ height: 60,
+ color: 0x000000
+ });
+ rightArm.x = birdGraphics.width / 2 + 10;
+ rightArm.y = 0;
+ // Add left leg
+ var leftLeg = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 20,
+ height: 60,
+ color: 0x000000
+ });
+ leftLeg.x = -birdGraphics.width / 4;
+ leftLeg.y = birdGraphics.height / 2 + 10;
+ // Add right leg
+ var rightLeg = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 20,
+ height: 60,
+ color: 0x000000
+ });
+ rightLeg.x = birdGraphics.width / 4;
+ rightLeg.y = birdGraphics.height / 2 + 10;
+ // Add face
+ var face = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 40,
+ height: 40,
+ color: 0xFFFFFF
+ });
+ face.x = 0;
+ face.y = -birdGraphics.height / 4;
+ // Add left blush
+ var leftBlush = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 20,
+ height: 20,
+ color: 0xFF69B4
+ });
+ leftBlush.x = -birdGraphics.width / 8;
+ leftBlush.y = -birdGraphics.height / 8;
+ // Add right blush
+ var rightBlush = self.attachAsset('bird', {
+ anchorX: 0.5,
+ anchorY: 0.5,
+ width: 20,
+ height: 20,
+ color: 0xFF69B4
+ });
+ rightBlush.x = birdGraphics.width / 8;
+ rightBlush.y = -birdGraphics.height / 8;
+ self.velocity = 0;
+ self.gravity = 0.5;
+ self.lift = -10;
+ // Update function for the bird
+ self.update = function () {
+ self.velocity += self.gravity;
+ self.y += self.velocity;
+ // Prevent the bird from going off the screen
+ if (self.y > 2732 - birdGraphics.height / 2) {
+ self.y = 2732 - birdGraphics.height / 2;
+ self.velocity = 0;
+ }
+ if (self.y < birdGraphics.height / 2) {
+ self.y = birdGraphics.height / 2;
+ self.velocity = 0;
+ }
+ };
+ // Function to make the bird jump
+ self.jump = function () {
+ self.velocity = self.lift;
+ };
});
// Define the Pipe class
var Pipe = Container.expand(function () {
- var self = Container.call(this);
- // Create and attach the pipe asset
- var pipeGraphics = self.attachAsset('pipe', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = -5;
- // Update function for the pipe
- self.update = function () {
- self.x += self.speed;
- // Remove the pipe if it goes off the screen
- if (self.x < -pipeGraphics.width / 2) {
- self.destroy();
- }
- };
+ var self = Container.call(this);
+ // Create and attach the pipe asset
+ var pipeGraphics = self.attachAsset('pipe', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = -5;
+ // Update function for the pipe
+ self.update = function () {
+ self.x += self.speed;
+ // Remove the pipe if it goes off the screen
+ if (self.x < -pipeGraphics.width / 2) {
+ self.destroy();
+ }
+ };
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x87CEEB // Init game with sky blue background
+ backgroundColor: 0x87CEEB // Init game with sky blue background
});
-/****
+/****
* Game Code
-****/
+****/
// Initialize game variables
var bird;
var pipes = [];
var score = 0;
var scoreTxt;
// Function to create a new pipe
function createPipe() {
- var pipe = new Pipe();
- pipe.x = 2048 + pipe.width / 2;
- pipe.y = Math.random() * (2732 - 400) + 200; // Random y position
- pipes.push(pipe);
- game.addChild(pipe);
+ var pipe = new Pipe();
+ pipe.x = 2048 + pipe.width / 2;
+ pipe.y = Math.random() * (2732 - 400) + 200; // Random y position
+ pipes.push(pipe);
+ game.addChild(pipe);
}
// Function to handle game over
function gameOver() {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
}
// Initialize the bird
bird = new FlappyBird();
bird.x = 2048 / 4;
bird.y = 2732 / 2;
game.addChild(bird);
// Initialize the score text
scoreTxt = new Text2('0', {
- size: 150,
- fill: "#ffffff"
+ size: 150,
+ fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Set up the game update function
game.update = function () {
- bird.update();
- // Update pipes
- for (var i = pipes.length - 1; i >= 0; i--) {
- pipes[i].update();
- // Check for collision with the bird
- if (bird.intersects(pipes[i])) {
- gameOver();
- }
- // Remove pipes that are off the screen
- if (pipes[i].x < -pipes[i].width / 2) {
- pipes.splice(i, 1);
- score++;
- scoreTxt.setText(score);
- }
- }
- // Create new pipes periodically
- if (LK.ticks % 90 == 0) {
- createPipe();
- }
+ bird.update();
+ // Update pipes
+ for (var i = pipes.length - 1; i >= 0; i--) {
+ pipes[i].update();
+ // Check for collision with the bird
+ if (bird.intersects(pipes[i])) {
+ gameOver();
+ }
+ // Remove pipes that are off the screen
+ if (pipes[i].x < -pipes[i].width / 2) {
+ pipes.splice(i, 1);
+ score++;
+ scoreTxt.setText(score);
+ }
+ }
+ // Create new pipes periodically
+ if (LK.ticks % 90 == 0) {
+ createPipe();
+ }
};
// Set up the game down event to make the bird jump
game.down = function (x, y, obj) {
- bird.jump();
+ bird.jump();
};
// Start the game
LK.setInterval(function () {
- createPipe();
+ createPipe();
}, 1500);
\ No newline at end of file