User prompt
Make touch cantrol to move left and write
User prompt
Make touch cantrol
User prompt
Make it big game with levels
User prompt
Make it hard tooo
User prompt
Make win screen
User prompt
Make kitten is flying and make touch cantrols
User prompt
Make he is flying plz
User prompt
Make it better
User prompt
Make a kitten
Initial prompt
Kitten force 2 FRVR
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Kitten class representing the player character
var Kitten = Container.expand(function () {
var self = Container.call(this);
var kittenGraphics = self.attachAsset('kitten', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 20;
self.dashDistance = 100;
self.dashCooldown = 2000; // 2 seconds cooldown
self.lastDashTime = 0;
self.update = function () {
// Move the kitten to the right
self.x += self.speed;
// If the kitten reaches the right edge of the screen, wrap around to the left
if (self.x > 2048) {
self.x = 0;
}
// Make the kitten fly up and down
if (self.y > 2732 - 200) {
self.speedY = -5;
} else if (self.y < 200) {
self.speedY = 5;
}
self.y += self.speedY;
// Make the kitten fly
self.y -= self.speed;
};
self.dash = function () {
var currentTime = Date.now();
// Check if the dash is off cooldown
if (currentTime - self.lastDashTime >= self.dashCooldown) {
// Dash to the right
self.x += self.dashDistance;
// If the kitten reaches the right edge of the screen, wrap around to the left
if (self.x > 2048) {
self.x = 0;
}
// Reset the dash cooldown
self.lastDashTime = currentTime;
// Update the dash cooldown display
dashCooldownTxt.setText(Math.round((self.dashCooldown - (currentTime - self.lastDashTime)) / 1000));
}
};
});
// Level class to handle level generation and progression
var Level = Container.expand(function () {
var self = Container.call(this);
self.level = 1;
self.obstacleCount = 10;
self.obstacles = [];
self.generateObstacles = function () {
for (var i = 0; i < self.obstacleCount; i++) {
var obstacle = new Obstacle();
obstacle.x = Math.random() * 2048;
obstacle.y = Math.random() * 2732;
self.obstacles.push(obstacle);
game.addChild(obstacle);
}
};
self.nextLevel = function () {
self.level++;
self.obstacleCount += 5;
for (var i = 0; i < self.obstacles.length; i++) {
game.removeChild(self.obstacles[i]);
}
self.obstacles = [];
self.generateObstacles();
};
});
// Obstacle class representing obstacles in the game
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.y = -self.height;
self.x = Math.random() * 2048;
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Light blue background
});
/****
* Game Code
****/
// Initialize game elements
var kitten = game.addChild(new Kitten());
// Position the kitten at the left edge of the screen
kitten.x = 0;
kitten.y = 2732 - 200;
// Initialize the Level class and generate the first level
var level = new Level();
level.generateObstacles();
// Handle touch events for dashing
game.down = function (x, y, obj) {
// Set the kitten's x coordinate to the touch event's x coordinate
kitten.x = x;
};
// Update game logic
game.update = function () {
for (var i = 0; i < level.obstacles.length; i++) {
level.obstacles[i].update();
if (kitten.intersects(level.obstacles[i])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
// Update the dash cooldown display
var currentTime = Date.now();
dashCooldownTxt.setText(Math.round((kitten.dashCooldown - (currentTime - kitten.lastDashTime)) / 1000));
};
// Score display
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Dash cooldown display
var dashCooldownTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
dashCooldownTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(dashCooldownTxt);
// Update score
function updateScore() {
var score = parseInt(scoreTxt.text) + 1;
scoreTxt.setText(score);
if (score >= 50) {
level.nextLevel();
scoreTxt.setText(0);
}
}
// Increment score every second
LK.setInterval(updateScore, 1000); ===================================================================
--- original.js
+++ change.js
@@ -109,15 +109,10 @@
var level = new Level();
level.generateObstacles();
// Handle touch events for dashing
game.down = function (x, y, obj) {
- // Dash when the screen is touched
- kitten.dash();
- // Make the kitten fly when the screen is touched
- kitten.y -= kitten.speed;
- // Set the kitten's x and y coordinates to the touch event's x and y coordinates
+ // Set the kitten's x coordinate to the touch event's x coordinate
kitten.x = x;
- kitten.y = y;
};
// Update game logic
game.update = function () {
for (var i = 0; i < level.obstacles.length; i++) {