User prompt
reduit l'alpha sur le MuzzleFlash
User prompt
Met le MuzzleFlash derriere le hero
User prompt
met le MuzzleFlash en arriere plan
User prompt
Deplace le MuzzleFlash plus proche du canon
User prompt
lors d'un tir fait appareitre un texture autour du canon pendant 0.5seconde, texture en arriere plan comme la lumiere
Code edit (1 edits merged)
Please save this source code
User prompt
cache la torche
User prompt
oriente la texture du hero vers la position de la souris
User prompt
oriente le hero vers la position de la souris
User prompt
Oriente le hero vers la souris
User prompt
masque la texture torch
User prompt
masque la torche et oriente le hero en fonction de la sourie
User prompt
Fix Bug: 'ReferenceError: type is not defined' in this line: 'var bloodGraphics = self.createBloodSplatter(type);' Line Number: 23
User prompt
pivote de maniere aleatoire la tache de sang quand tu la créer
User prompt
quand un zombie meurt la prend aléatoirement une tache de sang parmis un log de 3 taches
Code edit (4 edits merged)
Please save this source code
User prompt
met les taches de sang en arriere plan et fait les disparaitre si la torche ne les eclairent pas
User prompt
Met une trace de sang à l'emplacement des zombies qui meurt
Code edit (3 edits merged)
Please save this source code
User prompt
Affiche le message reloading pendant le rechargement
User prompt
Le hero ne doit pas pouvoir tiré pendant le rechargement de 3secondes
User prompt
affiche un nombre de munition dans le chargeur en bas à droite de l'ecran et limite le chargeur à 20 coups, apres il faut attendre 3 secondes pour recharger les munitions
Code edit (1 edits merged)
Please save this source code
User prompt
Les dommage de la balles doivent être un random entre 20 et 50
Code edit (1 edits merged)
Please save this source code
/**** * Classes ****/ var BloodSplatter = Container.expand(function (type) { var self = Container.call(this); self.createBloodSplatter = function (type) { var assetName; switch (type) { case 1: assetName = 'bloodSplatter1'; break; case 2: assetName = 'bloodSplatter2'; break; case 3: assetName = 'bloodSplatter3'; break; default: assetName = 'bloodSplatter1'; } return self.createAsset(assetName, 'Blood splatter', 0.5, 0.5); }; var bloodGraphics = self.createBloodSplatter(type); bloodGraphics.rotation = Math.random() * Math.PI * 2; self.visible = false; }); var AmmoDisplay = Container.expand(function () { var self = Container.call(this); self.ammoText = new Text2('Ammo: 20', { size: 100, fill: "#ffffff" }); self.ammoText.anchor.set(1, 1); self.updateAmmo = function (ammoCount) { self.ammoText.setText('Ammo: ' + ammoCount); }; LK.gui.bottomRight.addChild(self.ammoText); }); // Define the Hero class var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero character', 0.5, 0.5); self.ammo = 20; self.reloadTime = null; self.torchGraphics = self.createAsset('torch', 'Hero torch', 0.5, 0); self.torchGraphics.visible = false; self.orientTorch = function (mousePos) { var angle = Math.atan2(mousePos.y - self.y, mousePos.x - self.x); self.torchGraphics.rotation = angle; self.torchGraphics.visible = true; }; self.speed = 5; self.move = function (direction) { self.x += direction.x * self.speed; self.y += direction.y * self.speed; }; self.shoot = function (mousePos) { if (self.ammo > 0 && (!self.lastShotTime || LK.ticks - self.lastShotTime >= 20) && (!self.reloadTime || LK.ticks - self.reloadTime >= 180)) { var bullet = new HeroBullet(); bullet.x = self.x; bullet.y = self.y; var angle = Math.atan2(mousePos.y - self.y, mousePos.x - self.x); bullet.rotation = angle; bullets.push(bullet); game.addChild(bullet); self.lastShotTime = LK.ticks; self.ammo--; ammoDisplay.updateAmmo(self.ammo); } else if (self.ammo === 0 && (!self.reloadTime || LK.ticks - self.reloadTime >= 180)) { self.ammo = 20; ammoDisplay.updateAmmo(self.ammo); self.reloadTime = LK.ticks; } }; }); // Define the TorchLight class var TorchLight = Container.expand(function () { var self = Container.call(this); var lightGraphics = self.createAsset('torchLight', 'Torch light zone', 0.5, 1); self.updatePosition = function (heroPos, torchAngle) { self.x = heroPos.x; self.y = heroPos.y; self.rotation = torchAngle + Math.PI / 2; // Adjust the size and shape of the light zone // Adjust the size and shape of the light zone to simulate a cone of light lightGraphics.width = 600; // Width of the light cone lightGraphics.height = 8000; // Length of the light cone // Set the alpha to a lower value to simulate light lightGraphics.alpha = 0.3; // Set the pivot to the bottom center of the light cone lightGraphics.pivot.x = 0; lightGraphics.pivot.y = 0; }; }); // Define the HeroBullet class var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero bullet', 0.5, 1); self.speed = 30; self.move = function () { self.x += Math.cos(self.rotation) * self.speed; self.y += Math.sin(self.rotation) * self.speed; }; }); // Define the Zombie class var Zombie = Container.expand(function () { var self = Container.call(this); var zombieGraphics = self.createAsset('zombie', 'Zombie enemy', 0.5, 0.5); self.speed = 1; self.health = 50; self.healthBar = self.createAsset('healthBar', 'Zombie health bar', 0.5, 0); self.healthBar.width = self.health * 7; self.healthBar.height = 15; self.healthBar.y = -110; self.move = function (heroPos, torchAngle) { var angleToHero = Math.atan2(heroPos.y - self.y, heroPos.x - self.x); self.x += Math.cos(angleToHero) * self.speed; self.y += Math.sin(angleToHero) * self.speed; if (heroPos) { var angleToZombie = Math.atan2(self.y - heroPos.y, self.x - heroPos.x); var angleDifference = Math.abs(torchAngle - angleToZombie); if (angleDifference < 0.12) { // Assuming torch has a cone of visibility of 0.5 radians self.visible = true; } else { self.visible = false; } } self.healthBar.width = self.health * 10; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 // Init game with black background }); /**** * Game Code ****/ // Initialize important asset arrays var torchLight = game.addChild(new TorchLight()); var bullets = []; var zombies = []; var hero; var isGameOver = false; var ammoDisplay = new AmmoDisplay(); // Create the hero hero = game.addChild(new Hero()); hero.x = 2048 / 2; hero.y = 2732 - 100; // Position hero near the bottom of the screen // Game logic and event handlers LK.on('keydown', function (obj) { var direction = { x: 0, y: 0 }; var e = obj.event; switch (e.keyCode) { case 37: // left arrow direction.x = -1; break; case 39: // right arrow direction.x = 1; break; case 38: // up arrow direction.y = -1; break; case 40: // down arrow direction.y = 1; break; } hero.move(direction); }); LK.on('tick', function () { if (isGameOver) { LK.showGameOver(); return; } // Move bullets and check for off-screen for (var i = bullets.length - 1; i >= 0; i--) { if (bullets[i]) { bullets[i].move(); for (var j = zombies.length - 1; j >= 0; j--) { if (bullets[i] && bullets[i].intersects(zombies[j])) { bullets[i].destroy(); bullets.splice(i, 1); zombies[j].health -= Math.floor(Math.random() * (20 + 1)) + 20; if (zombies[j].health <= 0) { var bloodSplatterType = Math.floor(Math.random() * 3) + 1; // Randomly choose a blood splatter type between 1 and 3 var bloodSplatter = new BloodSplatter(bloodSplatterType); bloodSplatter.x = zombies[j].x; bloodSplatter.y = zombies[j].y; game.addChildAt(bloodSplatter, 0); zombies[j].destroy(); zombies.splice(j, 1); } break; } } if (bullets[i] && (bullets[i].x < 0 || bullets[i].x > 2048 || bullets[i].y < 0 || bullets[i].y > 2732)) { bullets[i].destroy(); bullets.splice(i, 1); } } } // Handle torch orientation and make zombies visible if illuminated var torchPos = { x: hero.x, y: hero.y }; var torchAngle = hero.torchGraphics.rotation; // Update torch light position var heroPos = { x: hero.x, y: hero.y }; var torchAngle = hero.torchGraphics.rotation; torchLight.updatePosition(heroPos, torchAngle); // Update visibility of blood splatters based on torch light for (var i = game.children.length - 1; i >= 0; i--) { var obj = game.children[i]; if (obj instanceof BloodSplatter) { var distanceToTorch = Math.sqrt(Math.pow(obj.x - hero.x, 2) + Math.pow(obj.y - hero.y, 2)); var angleToTorch = Math.atan2(obj.y - hero.y, obj.x - hero.x) - torchAngle; // Check if within torch light angle and range if (distanceToTorch <= 8000 && Math.abs(angleToTorch) <= 0.12) { obj.visible = true; } else { obj.visible = false; } } } // Move zombies and check for collision with hero for (var j = zombies.length - 1; j >= 0; j--) { zombies[j].move(torchPos, torchAngle); if (zombies[j].y > 2732) { zombies[j].destroy(); zombies.splice(j, 1); } else if (zombies[j].intersects(hero) && zombies[j].visible) { isGameOver = true; } } game.on('move', function (obj) { var mousePos = obj.event.getLocalPosition(game); hero.orientTorch(mousePos); }); game.on('down', function (obj) { var mousePos = obj.event.getLocalPosition(game); hero.shoot(mousePos); }); // Spawn zombies if (LK.ticks % 120 == 0) { // Spawn a zombie every 2 seconds var zombie = new Zombie(); zombie.x = Math.random() * 2048; zombie.y = -50; // Start off-screen zombies.push(zombie); game.addChild(zombie); } });
===================================================================
--- original.js
+++ change.js
@@ -1,8 +1,8 @@
/****
* Classes
****/
-var BloodSplatter = Container.expand(function () {
+var BloodSplatter = Container.expand(function (type) {
var self = Container.call(this);
self.createBloodSplatter = function (type) {
var assetName;
switch (type) {
Un zombie en 2D vue du dessus. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Bullet. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top down shooter blood. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top down shooter blood texture. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
top down character with gun de dos. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. topdown shooter
top down robot with gun. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows. topdown shooter
2d top down zombie boss. Single Game Texture. In-Game asset. 2d. no background. High contrast. No shadows.
weapon reload 2d icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Dark background horror. 2d. Blank background. High contrast. No shadows.
replace robot by wall
barbelé militaire 2d
Arrière plan sombre d'horreur avec un angle vu depuis le haut. 2d. Blank background. High contrast. No shadows.