User prompt
encore plus vite
User prompt
une fois que la fée a passer une ligne de potion les potion doive tomber plus vite
User prompt
encore plus
User prompt
il faut que les potion bouge beaucoup plus !
User prompt
les potion doive bouger
User prompt
il faut qu'il y a plein de potion en même temp
User prompt
il dois y avoir de plus en plus de potion
User prompt
la fée dois être sur le curser
User prompt
la fée dois avoir trois vie si elle touche une potion elle perd un vie
Initial prompt
fairy
===================================================================
--- original.js
+++ change.js
@@ -1,46 +1,47 @@
-/****
+/****
* Classes
****/
// Fairy class
var Fairy = Container.expand(function () {
- var self = Container.call(this);
- var fairyGraphics = self.createAsset('fairy', 'Fairy character', 0.5, 0.5);
- self.speed = 5;
- self.moveLeft = function () {
- self.x = Math.max(self.width / 2, self.x - self.speed);
- };
- self.moveRight = function () {
- self.x = Math.min(2048 - self.width / 2, self.x + self.speed);
- };
- self.moveUp = function () {
- self.y = Math.max(self.height / 2, self.y - self.speed);
- };
- self.moveDown = function () {
- self.y = Math.min(2732 - self.height / 2, self.y + self.speed);
- };
+ var self = Container.call(this);
+ var fairyGraphics = self.createAsset('fairy', 'Fairy character', 0.5, 0.5);
+ self.lives = 3;
+ self.speed = 5;
+ self.moveLeft = function () {
+ self.x = Math.max(self.width / 2, self.x - self.speed);
+ };
+ self.moveRight = function () {
+ self.x = Math.min(2048 - self.width / 2, self.x + self.speed);
+ };
+ self.moveUp = function () {
+ self.y = Math.max(self.height / 2, self.y - self.speed);
+ };
+ self.moveDown = function () {
+ self.y = Math.min(2732 - self.height / 2, self.y + self.speed);
+ };
});
// Potion class
var Potion = Container.expand(function () {
- var self = Container.call(this);
- var potionGraphics = self.createAsset('potion', 'Witch potion', 0.5, 0.5);
- self.speed = 3;
- self.move = function () {
- self.y += self.speed;
- if (self.y > 2732 + self.height) {
- self.destroy();
- }
- };
+ var self = Container.call(this);
+ var potionGraphics = self.createAsset('potion', 'Witch potion', 0.5, 0.5);
+ self.speed = 3;
+ self.move = function () {
+ self.y += self.speed;
+ if (self.y > 2732 + self.height) {
+ self.destroy();
+ }
+ };
});
-/****
+/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x000000 // Init game with black background
+ backgroundColor: 0x000000 // Init game with black background
});
-/****
+/****
* Game Code
****/
// Initialize fairy
var fairy = game.addChild(new Fairy());
@@ -49,40 +50,46 @@
// Initialize potions array
var potions = [];
// Handle touch movement
function handleTouchMove(obj) {
- var touchPos = obj.event.getLocalPosition(game);
- if (touchPos.x < fairy.x) {
- fairy.moveLeft();
- } else if (touchPos.x > fairy.x) {
- fairy.moveRight();
- }
- if (touchPos.y < fairy.y) {
- fairy.moveUp();
- } else if (touchPos.y > fairy.y) {
- fairy.moveDown();
- }
+ var touchPos = obj.event.getLocalPosition(game);
+ if (touchPos.x < fairy.x) {
+ fairy.moveLeft();
+ } else if (touchPos.x > fairy.x) {
+ fairy.moveRight();
+ }
+ if (touchPos.y < fairy.y) {
+ fairy.moveUp();
+ } else if (touchPos.y > fairy.y) {
+ fairy.moveDown();
+ }
}
// Add touch move listener to the game
game.on('move', handleTouchMove);
// Game tick event
LK.on('tick', function () {
- // Move potions
- for (var i = potions.length - 1; i >= 0; i--) {
- potions[i].move();
- if (fairy.intersects(potions[i])) {
- // End game if fairy touches a potion
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- return;
- }
- }
- // Spawn potions
- if (LK.ticks % 120 === 0) {
- // Spawn a potion every 2 seconds
- var potion = new Potion();
- potion.x = Math.random() * (2048 - potion.width) + potion.width / 2;
- potion.y = -potion.height / 2;
- potions.push(potion);
- game.addChild(potion);
- }
+ // Move potions
+ for (var i = potions.length - 1; i >= 0; i--) {
+ potions[i].move();
+ if (fairy.intersects(potions[i])) {
+ // Decrease fairy's lives when touching a potion and end game if lives are 0
+ fairy.lives--;
+ LK.effects.flashObject(fairy, 0xff0000, 500);
+ if (fairy.lives <= 0) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ return;
+ }
+ potions[i].destroy();
+ potions.splice(i, 1);
+ }
+ }
+ // Spawn potions
+ if (LK.ticks % 120 === 0) {
+ // Spawn a potion every 2 seconds
+ var potion = new Potion();
+ potion.x = Math.random() * (2048 - potion.width) + potion.width / 2;
+ potion.y = -potion.height / 2;
+ potions.push(potion);
+ game.addChild(potion);
+ }
});
\ No newline at end of file
nothing
fairy. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
heart. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
un monde féerique. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
enleve ça
le même coeur mais vide