User prompt
make enemy die with 1 hit
Code edit (10 edits merged)
Please save this source code
User prompt
make Grendizer stop tilting when cursor stop moving
Code edit (2 edits merged)
Please save this source code
User prompt
make Grendizer shoot atomatic
User prompt
make Grendizer tilt left and right with Horizontal by 3 with smooth animation
User prompt
make Grendizer tilt freely with mouse cursor direction
User prompt
make Grendizer tilt left and right with Horizontal
User prompt
make Grendizer rotate with animation
User prompt
adjust speed of Grendizer , enemy to 10
Code edit (1 edits merged)
Please save this source code
User prompt
make Grendizer move freely around the map with cursor direction
Code edit (1 edits merged)
Please save this source code
User prompt
adjust Grendizer movment to rotate by 0.09 on the direction of movement
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
make backround map
User prompt
make a backround assets
User prompt
when player get boosted enemy respawn increased by 5
User prompt
when player get boosted enemy increase speed by 5
User prompt
when player get boosted enemy respawn increased by 3
User prompt
FireBall kill enemy with 1 hit
User prompt
when player get boosted enemy respawn increased by 2
Code edit (5 edits merged)
Please save this source code
User prompt
reduse enemy respawn by 1
/**** * Classes ****/ // Define the Grendizer (player's character) class var Grendizer = Container.expand(function () { var self = Container.call(this); var grendizerGraphics = self.createAsset('grendizer', 'Player character', 0.5, 0.5); self.speed = 50; self.isBoosted = false; self.boostCounter = 0; // Counter for collected boosts self.moveLeft = function () { self.x = Math.max(self.width / 2, self.x - self.speed); self.rotation -= 0.09; }; self.moveRight = function () { self.x = Math.min(2048 - self.width / 2, self.x + self.speed); self.rotation += 0.09; }; self.update = function () { // Update logic for Grendizer }; }); // Define the Bullet class for Grendizer var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet', 0.5, 0.5); self.speed = -14; self.move = function () { self.y += self.speed; }; }); // Define the Enemy class var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy character', 0.5, 0.5); self.speed = player.isBoosted ? 21 : 16; self.hitCount = 0; // Counter for hits received self.move = function (playerX, playerY) { var directionX = playerX - self.x; var directionY = playerY - self.y; var magnitude = Math.sqrt(directionX * directionX + directionY * directionY); self.x += self.speed * (directionX / magnitude); self.y += self.speed * (directionY / magnitude); }; }); // Define the Boost class var Boost = Container.expand(function () { var self = Container.call(this); var boostGraphics = self.createAsset('boost', 'Boost item', 0.5, 0.5); self.speed = 7; self.move = function () { self.y += self.speed; }; }); // Define the FireBall class for Grendizer when boosted var FireBall = Container.expand(function () { var self = Container.call(this); var fireBallGraphics = self.createAsset('fireBall', 'Fire Ball', 0.5, 0.5); self.speed = -15; self.move = function () { self.y += self.speed; }; }); // Define the Explosion class var Explosion = Container.expand(function (x, y) { var self = Container.call(this); self.x = x; self.y = y; var exploGraphics = self.createAsset('explo', 'Explosion Graphics', 0.5, 0.5); self.addChild(exploGraphics); LK.setTimeout(function () { self.destroy(); }, 500); // Explosion lasts for 0.5 second }); // Define the Background class var Background = Container.expand(function () { var self = Container.call(this); var backgroundGraphics = self.createAsset('backgroundMap', 'Background Map', 0, 0); self.move = function () { // Background movement logic if needed in future }; }); /**** * Initialize Game ****/ // Initialize important asset arrays and score var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ // Initialize important asset arrays and score // Initialize important asset arrays and score var exploGraphics = LK.getAsset('explo', 'Explosion Graphics', 0.5, 0.5); var heroBullets = []; var enemies = []; var boosts = []; var score = 0; // Create the background map var background = game.addChild(new Background()); // Set the background to the bottom layer background.zIndex = -1; // Create the player's character and score display var player = game.addChild(new Grendizer()); var scoreText = new Text2('0', { size: 150, fill: "#ffffff" }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); player.x = 2048 / 2; player.y = 2732 - player.height; // Game tick event LK.on('tick', function () { // Update player player.update(); // Move and check hero bullets for (var i = heroBullets.length - 1; i >= 0; i--) { heroBullets[i].move(); if (heroBullets[i].y < -heroBullets[i].height) { heroBullets[i].destroy(); heroBullets.splice(i, 1); } } // Move and check enemies for (var j = enemies.length - 1; j >= 0; j--) { enemies[j].move(player.x, player.y); if (enemies[j].y > 2732 + enemies[j].height) { enemies[j].destroy(); enemies.splice(j, 1); } } // Move and check boosts for (var k = boosts.length - 1; k >= 0; k--) { boosts[k].move(); if (boosts[k].y > 2732 + boosts[k].height) { boosts[k].destroy(); boosts.splice(k, 1); } } // Spawn enemies and boosts var enemySpawnRate = player.isBoosted ? 22 : 60; if (LK.ticks % enemySpawnRate == 0) { var newEnemy = new Enemy(); newEnemy.x = Math.random() * (2048 - newEnemy.width) + newEnemy.width / 2; newEnemy.y = -newEnemy.height; enemies.push(newEnemy); game.addChild(newEnemy); } if (LK.ticks % 300 == 0) { var newBoost = new Boost(); newBoost.x = Math.random() * (2048 - newBoost.width) + newBoost.width / 2; newBoost.y = -newBoost.height; boosts.push(newBoost); game.addChild(newBoost); } // Check for collisions enemies.forEach(function (enemy) { if (player.intersects(enemy)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } heroBullets.forEach(function (bullet) { if (bullet.intersects(enemy)) { // Check if the bullet is a FireBall and destroy enemy with one hit if (bullet instanceof FireBall) { score += 10; scoreText.setText(score.toString()); // Create explosion when enemy is destroyed by a FireBall var explosion = game.addChild(new Explosion(enemy.x, enemy.y)); enemy.destroy(); enemies.splice(enemies.indexOf(enemy), 1); } else { // Increment hit counter for normal bullets enemy.hitCount++; } // Destroy bullet bullet.destroy(); heroBullets.splice(heroBullets.indexOf(bullet), 1); // Check if enemy has been hit three times if (enemy.hitCount >= 3) { // Increase score and create explosion score += 10; scoreText.setText(score.toString()); var explosion = game.addChild(new Explosion(enemy.x, enemy.y)); enemy.destroy(); enemies.splice(enemies.indexOf(enemy), 1); } // Check if player wins the game if (score >= 5000) { LK.effects.flashScreen(0x00ff00, 1000); LK.showGameOver(); } } }); }); boosts.forEach(function (boost) { if (player.intersects(boost)) { boost.destroy(); boosts.splice(boosts.indexOf(boost), 1); player.boostCounter++; if (player.boostCounter >= 7) { player.isBoosted = true; player.boostCounter = 0; // Reset the counter after getting boosted } } }); }); // Touch event listener for continuous player movement game.on('move', function (obj) { var touchPos = obj.event.getLocalPosition(game); player.x = touchPos.x; }); // Fire bullets game.on('down', function (obj) { var newBullet = player.isBoosted ? new FireBall() : new HeroBullet(); newBullet.x = player.x; newBullet.y = player.y - player.height / 2; heroBullets.push(newBullet); game.addChild(newBullet); });
===================================================================
--- original.js
+++ change.js
@@ -9,13 +9,13 @@
self.isBoosted = false;
self.boostCounter = 0; // Counter for collected boosts
self.moveLeft = function () {
self.x = Math.max(self.width / 2, self.x - self.speed);
- grendizerGraphics.rotation = -1.05;
+ self.rotation -= 0.09;
};
self.moveRight = function () {
self.x = Math.min(2048 - self.width / 2, self.x + self.speed);
- grendizerGraphics.rotation = 0.05;
+ self.rotation += 0.09;
};
self.update = function () {
// Update logic for Grendizer
};
mini ufo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
fire ball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
delete
blue fire ball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
moving dynamic crystal. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
dark space sky shooting game backround. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.