Code edit (3 edits merged)
Please save this source code
User prompt
enerji barı tamamen biterse full dolana kadar ok atılamasın
User prompt
Enerji barı eklesin oyuna ve ok attıkça azalsın enerji ard arda 5 ok atınca enerji barı bitsin ve dolana kadar tekrar kullanılamasın ama her ok attıktan sonra 0.3 sn beklenirse otomatik dolmaya başlasın. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
ekranda enemy gözükmüyorsa ok atılamasın
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'storage.equipmentRing = playerCharacter.equipment.ring;' Line Number: 534 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (2 edits merged)
Please save this source code
User prompt
enemy tipleri farklı assetlerde olun hepsi için ayrı kordinant ayarlanabilsin
User prompt
5 farklı enemy tipi olsun zindan zorluğuna göre dağılsın easy dungunlarda sadece en kolay 2 farklı tip olsun normal zindanlarda 3 farklı tip olsun hard zindanlarda 4 farklı enemy tipi olsun very hard zindanlarda 5 farklı enemy tipi olsun enemy zorluklarıda bu zrluklara göre sıralansın
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'storage.equipment = playerCharacter.equipment;' Line Number: 472 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'FFFFFF is not defined' in or related to this line: 'var difficultyText = new Text2(difficultyNames[difficulty], {' Line Number: 156
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'storage.gameData = {' Line Number: 470 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
Code edit (1 edits merged)
Please save this source code
User prompt
In the current combat setup, arrows are supposed to automatically target and hit enemies. However, due to how the direction is calculated only once at arrow creation time, arrows often miss moving or distant enemies. Please modify the Arrow class so that each arrow dynamically updates its direction every frame to continuously track and move toward the nearest enemy. This should simulate a homing arrow behavior. If there are no enemies, the arrow can travel in a default rightward direction or disappear after a short distance. The targeting logic should: Find the closest enemy each frame Recalculate the direction vector toward that enemy Smoothly rotate and move the arrow toward it Please ensure the arrow doesn't jitter when reaching the target and properly removes itself if it goes off-screen or hits an enemy. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
zindanların üstünde kırmızı renkte zorluk dereceleri yazsın
User prompt
her biir zindan arasında en az 300 birim boşluk olsun
User prompt
her bir zindan birbirinden en az 300 birim uzak olsun
User prompt
zindanlar random dağılırken ana karakterin ilk durduğu yerden 300 er birim uzakta olsun en yakın zindan ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
dungeonlar haritaya dağılırken birbirilerine uzak olsunlar
User prompt
dungeonların arasındaki mesafeler x ve y kordinatları bakımından en az 200 birim uzakta olacak şekilde random dağılsınlar
User prompt
haritalardaki 10 dungeonun kordinatlarını haritaya random dağıt
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Arrow = Container.expand(function () { var self = Container.call(this); var arrowGraphics = self.attachAsset('arrow', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.velocityX = 1; // Default rightward direction self.velocityY = 0; self.update = function () { // Find closest enemy for homing behavior var closestEnemy = null; var closestDistance = Infinity; for (var i = 0; i < enemies.length; i++) { var enemy = enemies[i]; var dx = enemy.x - self.x; var dy = enemy.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < closestDistance) { closestDistance = distance; closestEnemy = enemy; } } // Update direction toward closest enemy, or continue rightward if no enemies if (closestEnemy && closestDistance > 10) { // Avoid jitter when very close var dx = closestEnemy.x - self.x; var dy = closestEnemy.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); self.velocityX = dx / distance * self.speed; self.velocityY = dy / distance * self.speed; // Rotate arrow to face direction arrowGraphics.rotation = Math.atan2(dy, dx); } else if (!closestEnemy) { // No enemies, travel rightward self.velocityX = self.speed; self.velocityY = 0; arrowGraphics.rotation = 0; } // Move arrow self.x += self.velocityX; self.y += self.velocityY; }; return self; }); var Character = Container.expand(function () { var self = Container.call(this); var characterGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); // Character stats self.level = 1; self.experience = 0; self.health = 100; self.maxHealth = 100; self.damage = 20; self.defense = 5; // Equipment slots self.equipment = { helmet: null, boots: null, armor: null, bow: null, necklace: null, ring: null, gloves: null }; self.calculateStats = function () { self.maxHealth = 100 + self.level * 10; self.damage = 20 + self.level * 5; self.defense = 5 + self.level * 2; // Add equipment bonuses for (var slot in self.equipment) { if (self.equipment[slot]) { var item = self.equipment[slot]; self.maxHealth += item.healthBonus || 0; self.damage += item.damageBonus || 0; self.defense += item.defenseBonus || 0; } } if (self.health > self.maxHealth) { self.health = self.maxHealth; } }; self.gainExperience = function (amount) { self.experience += amount; var levelUpThreshold = self.level * 100; if (self.experience >= levelUpThreshold) { self.level++; self.experience -= levelUpThreshold; self.calculateStats(); self.health = self.maxHealth; LK.getSound('levelUp').play(); } }; return self; }); var Dungeon = Container.expand(function (difficulty, index) { var self = Container.call(this); var dungeonGraphics = self.attachAsset('dungeon', { anchorX: 0.5, anchorY: 0.5 }); self.difficulty = difficulty; self.index = index; self.isHovered = false; // Difficulty colors var colors = { easy: 0x90EE90, normal: 0xFFD700, hard: 0xFF8C00, veryHard: 0xFF4500 }; dungeonGraphics.tint = colors[difficulty]; // Add difficulty text var difficultyNames = { easy: 'EASY', normal: 'NORMAL', hard: 'HARD', veryHard: 'VERY HARD' }; var difficultyText = new Text2(difficultyNames[difficulty], { size: 50, fill: 0xFFFFFF }); difficultyText.anchor.set(0.5, 1); difficultyText.x = 0; difficultyText.y = -80; self.addChild(difficultyText); self.down = function (x, y, obj) { currentState = 'combat'; currentDungeon = self; setupCombat(); }; return self; }); var Enemy = Container.expand(function (difficulty, enemyType) { var self = Container.call(this); // Select appropriate asset based on enemy type var assetName = 'enemyBasic'; // default if (enemyType === 'basic') { assetName = 'enemyBasic'; } else if (enemyType === 'fast') { assetName = 'enemyFast'; } else if (enemyType === 'tank') { assetName = 'enemyTank'; } else if (enemyType === 'archer') { assetName = 'enemyArcher'; } else if (enemyType === 'boss') { assetName = 'enemyBoss'; } var enemyGraphics = self.attachAsset(assetName, { anchorX: 0.5, anchorY: 0.5 }); self.enemyType = enemyType || 'basic'; self.difficulty = difficulty; // Base stats for different enemy types var enemyStats = { basic: { health: 50, speed: 1, tint: 0xFFFFFF, experience: 10 }, fast: { health: 30, speed: 2, tint: 0x00FF00, experience: 15 }, tank: { health: 120, speed: 0.5, tint: 0xFF0000, experience: 25 }, archer: { health: 40, speed: 1.5, tint: 0x0000FF, experience: 20 }, boss: { health: 200, speed: 0.8, tint: 0xFF00FF, experience: 50 } }; var stats = enemyStats[self.enemyType]; var healthMultiplier = { easy: 1, normal: 2, hard: 4, veryHard: 8 }; self.maxHealth = stats.health * healthMultiplier[difficulty]; self.health = self.maxHealth; self.speed = stats.speed; self.experienceReward = stats.experience; // Apply visual tint based on enemy type enemyGraphics.tint = stats.tint; self.update = function () { self.x -= self.speed; }; self.takeDamage = function (damage) { self.health -= damage; if (self.health <= 0) { self.die(); } }; self.die = function () { LK.getSound('enemyDeath').play(); playerCharacter.gainExperience(self.experienceReward); // Drop loot if (Math.random() < 0.3) { dropLoot(self.x, self.y, self.difficulty); } }; return self; }); var LootItem = Container.expand(function (type, rarity, x, y) { var self = Container.call(this); var lootGraphics = self.attachAsset(type, { anchorX: 0.5, anchorY: 0.5 }); self.type = type; self.rarity = rarity; // Rarity colors var rarityColors = { common: 0x808080, rare: 0x4169e1, epic: 0x8a2be2, legendary: 0xffd700 }; lootGraphics.tint = rarityColors[rarity]; // Generate random stats based on rarity var multiplier = { common: 1, rare: 2, epic: 3, legendary: 5 }; self.healthBonus = Math.floor(Math.random() * 20 * multiplier[rarity]); self.damageBonus = Math.floor(Math.random() * 10 * multiplier[rarity]); self.defenseBonus = Math.floor(Math.random() * 5 * multiplier[rarity]); self.x = x; self.y = y; self.down = function (x, y, obj) { collectLoot(self); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ // Sounds // UI assets // Loot assets // Combat assets // Character and world assets // Game state var currentState = 'overworld'; // 'overworld', 'combat', 'inventory' var currentMap = 1; var currentDungeon = null; var playerCharacter = new Character(); var dungeons = []; var arrows = []; var enemies = []; var lootItems = []; var lastEnemySpawn = 0; var lastArrowShot = 0; var combatTimer = 0; var enemiesKilled = 0; var targetKills = 10; // UI elements var levelText = new Text2('Level: 1', { size: 40, fill: 0xFFFFFF }); var healthText = new Text2('Health: 100/100', { size: 40, fill: 0xFFFFFF }); var backButton = null; // Initialize storage with defaults var gameData = { level: storage.level || 1, experience: storage.experience || 0, equipment: { helmet: null, boots: null, armor: null, bow: null, necklace: null, ring: null, gloves: null }, unlockedMaps: storage.unlockedMaps || 1 }; // Load equipment from storage if (storage.equipmentHelmetType) { gameData.equipment.helmet = { type: storage.equipmentHelmetType, rarity: storage.equipmentHelmetRarity, healthBonus: storage.equipmentHelmetHealthBonus, damageBonus: storage.equipmentHelmetDamageBonus, defenseBonus: storage.equipmentHelmetDefenseBonus }; } if (storage.equipmentBootsType) { gameData.equipment.boots = { type: storage.equipmentBootsType, rarity: storage.equipmentBootsRarity, healthBonus: storage.equipmentBootsHealthBonus, damageBonus: storage.equipmentBootsDamageBonus, defenseBonus: storage.equipmentBootsDefenseBonus }; } if (storage.equipmentArmorType) { gameData.equipment.armor = { type: storage.equipmentArmorType, rarity: storage.equipmentArmorRarity, healthBonus: storage.equipmentArmorHealthBonus, damageBonus: storage.equipmentArmorDamageBonus, defenseBonus: storage.equipmentArmorDefenseBonus }; } if (storage.equipmentBowType) { gameData.equipment.bow = { type: storage.equipmentBowType, rarity: storage.equipmentBowRarity, healthBonus: storage.equipmentBowHealthBonus, damageBonus: storage.equipmentBowDamageBonus, defenseBonus: storage.equipmentBowDefenseBonus }; } if (storage.equipmentNecklaceType) { gameData.equipment.necklace = { type: storage.equipmentNecklaceType, rarity: storage.equipmentNecklaceRarity, healthBonus: storage.equipmentNecklaceHealthBonus, damageBonus: storage.equipmentNecklaceDamageBonus, defenseBonus: storage.equipmentNecklaceDefenseBonus }; } if (storage.equipmentRingType) { gameData.equipment.ring = { type: storage.equipmentRingType, rarity: storage.equipmentRingRarity, healthBonus: storage.equipmentRingHealthBonus, damageBonus: storage.equipmentRingDamageBonus, defenseBonus: storage.equipmentRingDefenseBonus }; } if (storage.equipmentGlovesType) { gameData.equipment.gloves = { type: storage.equipmentGlovesType, rarity: storage.equipmentGlovesRarity, healthBonus: storage.equipmentGlovesHealthBonus, damageBonus: storage.equipmentGlovesDamageBonus, defenseBonus: storage.equipmentGlovesDefenseBonus }; } // Load saved data playerCharacter.level = gameData.level; playerCharacter.experience = gameData.experience; playerCharacter.equipment = gameData.equipment; playerCharacter.calculateStats(); // Setup overworld function setupOverworld() { game.removeChildren(); // Add background var background = game.attachAsset('mapBackground', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); // Add character at center playerCharacter.x = 1024; playerCharacter.y = 1366; game.addChild(playerCharacter); // Create dungeons in isometric grid dungeons = []; var difficulties = ['easy', 'easy', 'easy', 'easy', 'normal', 'normal', 'normal', 'hard', 'hard', 'veryHard']; // Shuffle the difficulties array to randomize placement function shuffleArray(array) { for (var i = array.length - 1; i > 0; i--) { var j = Math.floor(Math.random() * (i + 1)); var temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } // Function to check if position is valid (at least 300 units away from existing dungeons and 300 from player) function isValidPosition(x, y, existingDungeons) { // Check distance from player starting position (1024, 1366) var playerStartX = 1024; var playerStartY = 1366; var distanceFromPlayer = Math.sqrt(Math.pow(x - playerStartX, 2) + Math.pow(y - playerStartY, 2)); if (distanceFromPlayer < 300) { return false; } // Check distance from existing dungeons using Euclidean distance for (var i = 0; i < existingDungeons.length; i++) { var dx = x - existingDungeons[i].x; var dy = y - existingDungeons[i].y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 300) { return false; } } return true; } difficulties = shuffleArray(difficulties); for (var i = 0; i < 10; i++) { var dungeon = new Dungeon(difficulties[i], i); // Find valid position with minimum distance requirement var validPosition = false; var attempts = 0; while (!validPosition && attempts < 100) { var testX = 150 + Math.random() * (2048 - 300); // 150 to 1898 var testY = 400 + Math.random() * (2732 - 800); // 400 to 2332 if (isValidPosition(testX, testY, dungeons)) { dungeon.x = testX; dungeon.y = testY; validPosition = true; } attempts++; } // If no valid position found after 100 attempts, place anyway if (!validPosition) { dungeon.x = 150 + Math.random() * (2048 - 300); dungeon.y = 400 + Math.random() * (2732 - 800); } dungeons.push(dungeon); game.addChild(dungeon); } // Add UI levelText.setText('Level: ' + playerCharacter.level); levelText.x = 50; levelText.y = 150; game.addChild(levelText); healthText.setText('Health: ' + playerCharacter.health + '/' + playerCharacter.maxHealth); healthText.x = 50; healthText.y = 200; game.addChild(healthText); } // Setup combat function setupCombat() { game.removeChildren(); // Add combat background var combatBg = game.attachAsset('combatBackground', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); // Position character fixed on left side for side-scrolling playerCharacter.x = 200; playerCharacter.y = 1866; game.addChild(playerCharacter); // Add back button backButton = game.attachAsset('backButton', { anchorX: 0.5, anchorY: 0.5, x: 100, y: 50 }); // Reset combat variables arrows = []; enemies = []; lootItems = []; lastEnemySpawn = 0; lastArrowShot = 0; combatTimer = 0; enemiesKilled = 0; targetKills = 10; // Add UI updateCombatUI(); } function updateCombatUI() { if (levelText.parent) { levelText.parent.removeChild(levelText); } if (healthText.parent) { healthText.parent.removeChild(healthText); } levelText.setText('Level: ' + playerCharacter.level); levelText.x = 50; levelText.y = 150; game.addChild(levelText); healthText.setText('Health: ' + playerCharacter.health + '/' + playerCharacter.maxHealth); healthText.x = 50; healthText.y = 200; game.addChild(healthText); } function dropLoot(x, y, difficulty) { var lootTypes = ['helmet', 'boots', 'armor', 'bow', 'necklace', 'ring', 'gloves']; var rarities = ['common', 'rare', 'epic', 'legendary']; // Better drop rates for higher difficulties var rarityChances = { easy: [0.7, 0.25, 0.00, 0.00], normal: [0.5, 0.35, 0.04, 0.00], hard: [0.3, 0.4, 0.15, 0.05], veryHard: [0.1, 0.3, 0.4, 0.2] }; var type = lootTypes[Math.floor(Math.random() * lootTypes.length)]; var rarity = 'common'; var rand = Math.random(); var chances = rarityChances[difficulty]; if (rand > chances[0] + chances[1] + chances[2]) { rarity = 'legendary'; } else if (rand > chances[0] + chances[1]) { rarity = 'epic'; } else if (rand > chances[0]) { rarity = 'rare'; } var loot = new LootItem(type, rarity, x, y); lootItems.push(loot); game.addChild(loot); LK.getSound('lootDrop').play(); } function collectLoot(loot) { // Equip the item playerCharacter.equipment[loot.type] = loot; playerCharacter.calculateStats(); // Remove from game loot.destroy(); var index = lootItems.indexOf(loot); if (index > -1) { lootItems.splice(index, 1); } // Save game data saveGameData(); updateCombatUI(); } function saveGameData() { storage.level = playerCharacter.level; storage.experience = playerCharacter.experience; storage.unlockedMaps = gameData.unlockedMaps; // Save equipment properties individually - only save if equipment exists if (playerCharacter.equipment.helmet) { storage.equipmentHelmetType = playerCharacter.equipment.helmet.type; storage.equipmentHelmetRarity = playerCharacter.equipment.helmet.rarity; storage.equipmentHelmetHealthBonus = playerCharacter.equipment.helmet.healthBonus; storage.equipmentHelmetDamageBonus = playerCharacter.equipment.helmet.damageBonus; storage.equipmentHelmetDefenseBonus = playerCharacter.equipment.helmet.defenseBonus; } else { storage.equipmentHelmetType = null; } if (playerCharacter.equipment.boots) { storage.equipmentBootsType = playerCharacter.equipment.boots.type; storage.equipmentBootsRarity = playerCharacter.equipment.boots.rarity; storage.equipmentBootsHealthBonus = playerCharacter.equipment.boots.healthBonus; storage.equipmentBootsDamageBonus = playerCharacter.equipment.boots.damageBonus; storage.equipmentBootsDefenseBonus = playerCharacter.equipment.boots.defenseBonus; } else { storage.equipmentBootsType = null; } if (playerCharacter.equipment.armor) { storage.equipmentArmorType = playerCharacter.equipment.armor.type; storage.equipmentArmorRarity = playerCharacter.equipment.armor.rarity; storage.equipmentArmorHealthBonus = playerCharacter.equipment.armor.healthBonus; storage.equipmentArmorDamageBonus = playerCharacter.equipment.armor.damageBonus; storage.equipmentArmorDefenseBonus = playerCharacter.equipment.armor.defenseBonus; } else { storage.equipmentArmorType = null; } if (playerCharacter.equipment.bow) { storage.equipmentBowType = playerCharacter.equipment.bow.type; storage.equipmentBowRarity = playerCharacter.equipment.bow.rarity; storage.equipmentBowHealthBonus = playerCharacter.equipment.bow.healthBonus; storage.equipmentBowDamageBonus = playerCharacter.equipment.bow.damageBonus; storage.equipmentBowDefenseBonus = playerCharacter.equipment.bow.defenseBonus; } else { storage.equipmentBowType = null; } if (playerCharacter.equipment.necklace) { storage.equipmentNecklaceType = playerCharacter.equipment.necklace.type; storage.equipmentNecklaceRarity = playerCharacter.equipment.necklace.rarity; storage.equipmentNecklaceHealthBonus = playerCharacter.equipment.necklace.healthBonus; storage.equipmentNecklaceDamageBonus = playerCharacter.equipment.necklace.damageBonus; storage.equipmentNecklaceDefenseBonus = playerCharacter.equipment.necklace.defenseBonus; } else { storage.equipmentNecklaceType = null; } if (playerCharacter.equipment.ring) { storage.equipmentRingType = playerCharacter.equipment.ring.type; storage.equipmentRingRarity = playerCharacter.equipment.ring.rarity; storage.equipmentRingHealthBonus = playerCharacter.equipment.ring.healthBonus; storage.equipmentRingDamageBonus = playerCharacter.equipment.ring.damageBonus; storage.equipmentRingDefenseBonus = playerCharacter.equipment.ring.defenseBonus; } else { storage.equipmentRingType = null; } if (playerCharacter.equipment.gloves) { storage.equipmentGlovesType = playerCharacter.equipment.gloves.type; storage.equipmentGlovesRarity = playerCharacter.equipment.gloves.rarity; storage.equipmentGlovesHealthBonus = playerCharacter.equipment.gloves.healthBonus; storage.equipmentGlovesDamageBonus = playerCharacter.equipment.gloves.damageBonus; storage.equipmentGlovesDefenseBonus = playerCharacter.equipment.gloves.defenseBonus; } else { storage.equipmentGlovesType = null; } } // Game input handlers var draggedCharacter = null; var dragOffset = { x: 0, y: 0 }; game.down = function (x, y, obj) { if (currentState === 'overworld') { // Check if clicking on character var localPos = playerCharacter.toLocal({ x: x, y: y }); if (localPos.x >= -40 && localPos.x <= 40 && localPos.y >= -40 && localPos.y <= 40) { draggedCharacter = playerCharacter; dragOffset.x = x - playerCharacter.x; dragOffset.y = y - playerCharacter.y; } } else if (currentState === 'combat' && backButton) { // Check if obj and obj.position exist, otherwise use x,y coordinates var localPos; if (obj && obj.position) { localPos = backButton.toLocal(obj.position); } else { // Convert game coordinates to local coordinates localPos = backButton.toLocal({ x: x, y: y }); } if (localPos.x >= -60 && localPos.x <= 60 && localPos.y >= -30 && localPos.y <= 30) { currentState = 'overworld'; setupOverworld(); } else { // Click to shoot - create homing arrow var arrow = new Arrow(); arrow.x = playerCharacter.x + 50; arrow.y = playerCharacter.y; arrows.push(arrow); game.addChild(arrow); LK.getSound('shoot').play(); } } }; game.move = function (x, y, obj) { if (currentState === 'overworld' && draggedCharacter) { draggedCharacter.x = x - dragOffset.x; draggedCharacter.y = y - dragOffset.y; } }; game.up = function (x, y, obj) { if (currentState === 'overworld' && draggedCharacter) { // Check if character is dropped on any dungeon for (var i = 0; i < dungeons.length; i++) { var dungeon = dungeons[i]; if (draggedCharacter.intersects(dungeon)) { currentState = 'combat'; currentDungeon = dungeon; setupCombat(); break; } } draggedCharacter = null; } }; // Main game update loop game.update = function () { if (currentState === 'overworld') { // Overworld updates } else if (currentState === 'combat') { combatTimer++; // Arrows are now fired on click instead of automatically // Spawn enemies from right side if (combatTimer - lastEnemySpawn > 120 && enemiesKilled < targetKills) { // Define enemy types available for each difficulty var enemyTypesByDifficulty = { easy: ['basic', 'fast'], normal: ['basic', 'fast', 'tank'], hard: ['basic', 'fast', 'tank', 'archer'], veryHard: ['basic', 'fast', 'tank', 'archer', 'boss'] }; var availableTypes = enemyTypesByDifficulty[currentDungeon.difficulty]; var randomType = availableTypes[Math.floor(Math.random() * availableTypes.length)]; var enemy = new Enemy(currentDungeon.difficulty, randomType); enemy.x = 1900; enemy.y = 1800; enemies.push(enemy); game.addChild(enemy); lastEnemySpawn = combatTimer; } // Update arrows for (var i = arrows.length - 1; i >= 0; i--) { var arrow = arrows[i]; // Remove arrows that go off screen in any direction if (arrow.x > 2100 || arrow.x < -100 || arrow.y > 2800 || arrow.y < -100) { arrow.destroy(); arrows.splice(i, 1); continue; } // Check collision with enemies for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (arrow.intersects(enemy)) { enemy.takeDamage(playerCharacter.damage); // Add visual feedback with tween tween(enemy.children[0], { tint: 0xFF0000 }, { duration: 200, onFinish: function onFinish() { tween(enemy.children[0], { tint: 0xFFFFFF }, { duration: 200 }); } }); arrow.destroy(); arrows.splice(i, 1); if (enemy.health <= 0) { enemy.destroy(); enemies.splice(j, 1); enemiesKilled++; // Check win condition if (enemiesKilled >= targetKills) { LK.setTimeout(function () { currentState = 'overworld'; setupOverworld(); }, 1000); } } break; } } } // Update enemies for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; if (enemy.x < -100) { enemy.destroy(); enemies.splice(i, 1); continue; } // Check collision with player if (enemy.intersects(playerCharacter)) { playerCharacter.health -= Math.max(1, 10 - playerCharacter.defense); enemy.destroy(); enemies.splice(i, 1); if (playerCharacter.health <= 0) { LK.showGameOver(); } updateCombatUI(); } } // Update loot items (simple gravity effect) for (var i = 0; i < lootItems.length; i++) { var loot = lootItems[i]; if (loot.y < 1366) { loot.y += 2; } } } }; // Initialize the game setupOverworld();
===================================================================
--- original.js
+++ change.js
@@ -307,18 +307,82 @@
var gameData = {
level: storage.level || 1,
experience: storage.experience || 0,
equipment: {
- helmet: storage.equipmentHelmet || null,
- boots: storage.equipmentBoots || null,
- armor: storage.equipmentArmor || null,
- bow: storage.equipmentBow || null,
- necklace: storage.equipmentNecklace || null,
- ring: storage.equipmentRing || null,
- gloves: storage.equipmentGloves || null
+ helmet: null,
+ boots: null,
+ armor: null,
+ bow: null,
+ necklace: null,
+ ring: null,
+ gloves: null
},
unlockedMaps: storage.unlockedMaps || 1
};
+// Load equipment from storage
+if (storage.equipmentHelmetType) {
+ gameData.equipment.helmet = {
+ type: storage.equipmentHelmetType,
+ rarity: storage.equipmentHelmetRarity,
+ healthBonus: storage.equipmentHelmetHealthBonus,
+ damageBonus: storage.equipmentHelmetDamageBonus,
+ defenseBonus: storage.equipmentHelmetDefenseBonus
+ };
+}
+if (storage.equipmentBootsType) {
+ gameData.equipment.boots = {
+ type: storage.equipmentBootsType,
+ rarity: storage.equipmentBootsRarity,
+ healthBonus: storage.equipmentBootsHealthBonus,
+ damageBonus: storage.equipmentBootsDamageBonus,
+ defenseBonus: storage.equipmentBootsDefenseBonus
+ };
+}
+if (storage.equipmentArmorType) {
+ gameData.equipment.armor = {
+ type: storage.equipmentArmorType,
+ rarity: storage.equipmentArmorRarity,
+ healthBonus: storage.equipmentArmorHealthBonus,
+ damageBonus: storage.equipmentArmorDamageBonus,
+ defenseBonus: storage.equipmentArmorDefenseBonus
+ };
+}
+if (storage.equipmentBowType) {
+ gameData.equipment.bow = {
+ type: storage.equipmentBowType,
+ rarity: storage.equipmentBowRarity,
+ healthBonus: storage.equipmentBowHealthBonus,
+ damageBonus: storage.equipmentBowDamageBonus,
+ defenseBonus: storage.equipmentBowDefenseBonus
+ };
+}
+if (storage.equipmentNecklaceType) {
+ gameData.equipment.necklace = {
+ type: storage.equipmentNecklaceType,
+ rarity: storage.equipmentNecklaceRarity,
+ healthBonus: storage.equipmentNecklaceHealthBonus,
+ damageBonus: storage.equipmentNecklaceDamageBonus,
+ defenseBonus: storage.equipmentNecklaceDefenseBonus
+ };
+}
+if (storage.equipmentRingType) {
+ gameData.equipment.ring = {
+ type: storage.equipmentRingType,
+ rarity: storage.equipmentRingRarity,
+ healthBonus: storage.equipmentRingHealthBonus,
+ damageBonus: storage.equipmentRingDamageBonus,
+ defenseBonus: storage.equipmentRingDefenseBonus
+ };
+}
+if (storage.equipmentGlovesType) {
+ gameData.equipment.gloves = {
+ type: storage.equipmentGlovesType,
+ rarity: storage.equipmentGlovesRarity,
+ healthBonus: storage.equipmentGlovesHealthBonus,
+ damageBonus: storage.equipmentGlovesDamageBonus,
+ defenseBonus: storage.equipmentGlovesDefenseBonus
+ };
+}
// Load saved data
playerCharacter.level = gameData.level;
playerCharacter.experience = gameData.experience;
playerCharacter.equipment = gameData.equipment;
@@ -496,16 +560,72 @@
function saveGameData() {
storage.level = playerCharacter.level;
storage.experience = playerCharacter.experience;
storage.unlockedMaps = gameData.unlockedMaps;
- // Save equipment properties individually
- storage.equipmentHelmet = playerCharacter.equipment.helmet;
- storage.equipmentBoots = playerCharacter.equipment.boots;
- storage.equipmentArmor = playerCharacter.equipment.armor;
- storage.equipmentBow = playerCharacter.equipment.bow;
- storage.equipmentNecklace = playerCharacter.equipment.necklace;
- storage.equipmentRing = playerCharacter.equipment.ring;
- storage.equipmentGloves = playerCharacter.equipment.gloves;
+ // Save equipment properties individually - only save if equipment exists
+ if (playerCharacter.equipment.helmet) {
+ storage.equipmentHelmetType = playerCharacter.equipment.helmet.type;
+ storage.equipmentHelmetRarity = playerCharacter.equipment.helmet.rarity;
+ storage.equipmentHelmetHealthBonus = playerCharacter.equipment.helmet.healthBonus;
+ storage.equipmentHelmetDamageBonus = playerCharacter.equipment.helmet.damageBonus;
+ storage.equipmentHelmetDefenseBonus = playerCharacter.equipment.helmet.defenseBonus;
+ } else {
+ storage.equipmentHelmetType = null;
+ }
+ if (playerCharacter.equipment.boots) {
+ storage.equipmentBootsType = playerCharacter.equipment.boots.type;
+ storage.equipmentBootsRarity = playerCharacter.equipment.boots.rarity;
+ storage.equipmentBootsHealthBonus = playerCharacter.equipment.boots.healthBonus;
+ storage.equipmentBootsDamageBonus = playerCharacter.equipment.boots.damageBonus;
+ storage.equipmentBootsDefenseBonus = playerCharacter.equipment.boots.defenseBonus;
+ } else {
+ storage.equipmentBootsType = null;
+ }
+ if (playerCharacter.equipment.armor) {
+ storage.equipmentArmorType = playerCharacter.equipment.armor.type;
+ storage.equipmentArmorRarity = playerCharacter.equipment.armor.rarity;
+ storage.equipmentArmorHealthBonus = playerCharacter.equipment.armor.healthBonus;
+ storage.equipmentArmorDamageBonus = playerCharacter.equipment.armor.damageBonus;
+ storage.equipmentArmorDefenseBonus = playerCharacter.equipment.armor.defenseBonus;
+ } else {
+ storage.equipmentArmorType = null;
+ }
+ if (playerCharacter.equipment.bow) {
+ storage.equipmentBowType = playerCharacter.equipment.bow.type;
+ storage.equipmentBowRarity = playerCharacter.equipment.bow.rarity;
+ storage.equipmentBowHealthBonus = playerCharacter.equipment.bow.healthBonus;
+ storage.equipmentBowDamageBonus = playerCharacter.equipment.bow.damageBonus;
+ storage.equipmentBowDefenseBonus = playerCharacter.equipment.bow.defenseBonus;
+ } else {
+ storage.equipmentBowType = null;
+ }
+ if (playerCharacter.equipment.necklace) {
+ storage.equipmentNecklaceType = playerCharacter.equipment.necklace.type;
+ storage.equipmentNecklaceRarity = playerCharacter.equipment.necklace.rarity;
+ storage.equipmentNecklaceHealthBonus = playerCharacter.equipment.necklace.healthBonus;
+ storage.equipmentNecklaceDamageBonus = playerCharacter.equipment.necklace.damageBonus;
+ storage.equipmentNecklaceDefenseBonus = playerCharacter.equipment.necklace.defenseBonus;
+ } else {
+ storage.equipmentNecklaceType = null;
+ }
+ if (playerCharacter.equipment.ring) {
+ storage.equipmentRingType = playerCharacter.equipment.ring.type;
+ storage.equipmentRingRarity = playerCharacter.equipment.ring.rarity;
+ storage.equipmentRingHealthBonus = playerCharacter.equipment.ring.healthBonus;
+ storage.equipmentRingDamageBonus = playerCharacter.equipment.ring.damageBonus;
+ storage.equipmentRingDefenseBonus = playerCharacter.equipment.ring.defenseBonus;
+ } else {
+ storage.equipmentRingType = null;
+ }
+ if (playerCharacter.equipment.gloves) {
+ storage.equipmentGlovesType = playerCharacter.equipment.gloves.type;
+ storage.equipmentGlovesRarity = playerCharacter.equipment.gloves.rarity;
+ storage.equipmentGlovesHealthBonus = playerCharacter.equipment.gloves.healthBonus;
+ storage.equipmentGlovesDamageBonus = playerCharacter.equipment.gloves.damageBonus;
+ storage.equipmentGlovesDefenseBonus = playerCharacter.equipment.gloves.defenseBonus;
+ } else {
+ storage.equipmentGlovesType = null;
+ }
}
// Game input handlers
var draggedCharacter = null;
var dragOffset = {
arrow. In-Game asset. 2d. High contrast. No shadows
pixel necklace. In-Game asset. 2d. High contrast. No shadows
mağaranın hafif üstünden görünüşü olsun
brown pixel 2dd game boots. In-Game asset. 2d. High contrast. No shadows
pixel brown game helmet. In-Game asset. 2d. High contrast. No shadows
pixel brown gloves. In-Game asset. 2d. High contrast. No shadows
pixel gold ring for 2d game. In-Game asset. 2d. High contrast. No shadows
blue pixel bow for 2d game archer. In-Game asset. 2d. High contrast. No shadows
brown pixel light armor for 2d games. In-Game asset. 2d. High contrast. No shadows
kahve rengi kask ekle karaktere
karaktere kahverengi bot giydir bileklerine kadar
kahverengi eldiven giydir karaktere
kahverengi hafif zırh giydir karaktere
karakter elinde tuttuğu yayı mavi yap
kaskı mavi yap
adamın sadece ayakakbılarını mavi renge çevirir misin
adamın eldivenlerini mavi renge çevirir misin
koyu kahverengi olan bütün zırhı kaskı yayı ayakkabıyı eldiveni mavi renk yapar mısın
yayı parlak mor renk yapar mısın
kaskıda parlak mor renk yapar mısın
ayakkabıları da parlak mor renk yapar mısın
koyu kahverengi olan bütün zırhı kaskı yayı ayakkabıyı eldiveni parlak mor renk yapar mısın
yayı parlak altın rengi yapar mısın
kaskını parlak altın rengine çevirir misin
ayakkabılarını parlak altın rengine çevirir misin
eldivenlerini parlak altın rengine çevirir misin
koyu kahverengi olan bütün zırhını kaskını ayakkabısını eldivenini parlak yayını altın rengine çevirir misin
eldivenlerini parlak mor renk yapar mısın
demon rabbit with red eyes. In-Game asset. 2d. High contrast. No shadows
sağ üst köşeye çevresinde eski tahta çitler olan çok küçük bir köy ekle
sağ üst köşeye bir kasaba ekle
sağ üst köşeye surla çevrili bir şehir ekle
sağ üstteki şehrin grafik açısından boyutunu çok değiştirmeden belki sadece biraz daha uzaktan bakar gibi ama çok daha gelişmiş bir şehre dönüştürür müsün
bu zindan girişini bir tık daha korkutucu göster mesela etrafındaki taşlarında üstünde kemikler en üst ortadaki taşında kemikten bir hayvvan başı gibi
mağaranın grafik ayarları ve boyutunu bozmadan taşların üzerinden lavlar akıyor gibi gözüksün zindan girişinin ortasındada kırmızı korkutucu bir sihirli geçit olsun
zindan girişi taşlarının üstüne mavi maden damarları gibi çizgiler ekle
kemik görünümünde bir kurt. In-Game asset. 2d. High contrast. No shadows
kemikten bir şovalye istiyorum biraz kambur dursun. In-Game asset. 2d. High contrast. No shadows
yıldırımlarla kaplı bir canavar istiyorum hafif kambur duruşlu biraz zombi gibi. In-Game asset. 2d. High contrast. No shadows
lavlarla kaplı bir canavar istiyorum kambur ve biraz iri yapılı. In-Game asset. 2d. High contrast. No shadows
kemikten oluşsun
yıldırımdan bir kartala dönüştür
sağdan sola doğru uçuyor gibi bir görüntü olsun
sağdan sola yürüyen bir cehennem şeytanı. In-Game asset. 2d. High contrast. No shadows
güçlü ve iri yapılı şeytan kral sağdan sola yürüyormuş gibi. In-Game asset. 2d. High contrast. No shadows
ölümsüz kemikler kralı sağdan sola yürüyor gibi. In-Game asset. 2d. High contrast. No shadows
aslan ve insan karışımı yıldırımla kaplı bir canavar kralı sağdan sola yürüyen. In-Game asset. 2d. High contrast. No shadows
Images Sounds Music Images › map1man map1man Size 200 × 200 Aspect Ratio Preserve Aspect Ratio Shape Box Color #365bb5 bastonlu yaşlı uzun sakallı kambur kel bir dede sağdan sola yürüyen üstünde ortaçağ fakir köylerinde köyün muhtarı kıyafeti olsun. In-Game asset. 2d. High contrast. No shadows. In-Game asset. 2d. High contrast. No shadows
şovalye kıyafetli orta yaşlı bir adam belinde kılıcıyla sağdan sola yürür gibi. In-Game asset. 2d. High contrast. No shadows
bir orta çağ şehrinin soylu dükü görünümünde yap orta yaşlarda sağdan solda yürür gibi. In-Game asset. 2d. High contrast. No shadows
bir imparatorluğun kralı , sağdan sola yürür gibi. In-Game asset. 2d. High contrast. No shadows