User prompt
envantere tıkladıktan sonra açıldıktan sonra tekrar kapatmak için kırmızı çarpı ekle ona tıklayarak inventory tıklayarak açılan ekran kapansın
User prompt
Please fix the issue with the inventory button not responding to mouse clicks in the overworld screen. I want the inventory button to open the inventory UI when the player clicks on it using the mouse. Here's what you should do step by step:
User prompt
inventory butonu aktif et tıklandığında gri renkte 4x4= 16 kare haneli bir minecraft tarzı bir envanter açılsın ekranın önüne düşen itemler o hanelerde gözüksün ve tıklanınca karaktere otomatik eklenip envanterden kaybolsun.bu sistemi oluştur
User prompt
inventoryButton objesini global olarak tanımla (var inventoryButton = null; gibi). setupOverworld() fonksiyonu içinde butonu sahneye ekle. game.down fonksiyonu içinde inventoryButton’a tıklanıp tıklanmadığını kontrol eden kodu ekle. ✅ Örnek Düzgün Çalışan Envanter Buton Sistemi: 1. Global tanım: js Kopyala Düzenle var inventoryButton = null; 2. setupOverworld() içinde butonu oluştur: js Kopyala Düzenle inventoryButton = game.attachAsset('backButton', { anchorX: 0.5, anchorY: 0.5, x: 2048 - 100, y: 200 }); 3. game.down içinde kontrol: js Kopyala Düzenle game.down = function (x, y, obj) { if (currentState === 'overworld') { // Envanter butonuna tıklanırsa var invLocal = inventoryButton.toLocal({ x, y }); if (invLocal.x >= -60 && invLocal.x <= 60 && invLocal.y >= -30 && invLocal.y <= 30) { currentState = 'inventory'; setupInventory(); return; }
User prompt
Please add a mouse-controlled inventory system to my game. The system should activate only when the player is on the overworld map screen, after completing a dungeon. The goal is to allow the player to click on an inventory button on screen to open the inventory and manually equip items by clicking. ✅ SYSTEM FEATURES TO IMPLEMENT: 📍 1. Inventory Button: Add a visible “Inventory” button on the overworld map screen (top-left or top-right). When the player clicks this button with the mouse, open a full inventory UI panel. 📂 2. Inventory Panel: Show a grid of all collected items (stored in gameData.inventory). Show the player’s current equipment on the left (helmet, boots, armor, gloves, bow, ring, necklace). Each item should display: Type (e.g. helmet) Rarity (color-coded) Bonus stats (health, damage, defense) 🖱️ 3. Manual Equip by Clicking: When a player clicks on an item in the inventory grid, highlight it. Then, when they click on the correct equipment slot, assign that item to the character. After equipping, call: js Kopyala Düzenle playerCharacter.calculateStats(); 🔧 CODE CHANGES NEEDED: 1. giveLoot() function: Change it so items are not auto-equipped. Instead, push each item to the player’s inventory: js Kopyala Düzenle gameData.inventory.push({ type, rarity, healthBonus, damageBonus, defenseBonus }); 2. game.down function: Add mouse click detection for: Clicking on the inventory button to open/close the inventory. Clicking on inventory items to select. Clicking on equipment slots to equip selected item. 🛠️ OPTIONAL: Add a close “X” button to hide the inventory. Tooltip on hover (or tap) to show item stats. Prevent duplicate item types from being equipped. This will allow the player to: Finish a dungeon. Return to the overworld. Click on the “Inventory” button. See all collected items. Equip any item they want by clicking on it and on the equipment slot.
User prompt
ch1 den ch10 a kadar asset oluşturur musun
User prompt
Please update the combat logic in my current game as follows: ✅ Objective: A dungeon should now be completed after exactly 15 enemies have spawned and all of them are killed. Enemies should not appear all at once. They should spawn over time, like in a wave. Once all 15 enemies have spawned and there are no more enemies left alive, the dungeon should be marked as completed. 🔧 What to Change: Update the condition that checks for dungeon completion. Replace: js Kopyala Düzenle if (enemiesKilled >= targetKills && enemies.length === 0) With: js Kopyala Düzenle if (totalEnemiesSpawned >= 15 && enemies.length === 0) Define a new variable (if not already defined): js Kopyala Düzenle var totalEnemiesSpawned = 0; In your spawnEnemy() function or wherever new enemies are added, increase this value: js Kopyala Düzenle totalEnemiesSpawned++; Set targetKills = 15 at the start of combat. Optionally, adjust the timer logic so that enemies are spawned with a delay (e.g., every 1 second) until 15 are created. This way, the dungeon is completed only after all 15 enemies have appeared and been defeated.
User prompt
eğer varsa rast gele item düşme komut kodlarını kaldır onun yerine önceden belirnen loot sistemini kullanacağız detaylar; Dungeon and Loot System per Map Each map contains 10 dungeons, divided by difficulty: 4 Easy 3 Normal 2 Hard 1 Very Hard 🎁 LOOT DROP RULES 🟢 Easy Dungeons (4 total) Only 1 of the 4 Easy dungeons will drop loot. That 1 is selected randomly each time a new map starts. Loot dropped: Map 1 → common helmet Map 2 → rare helmet Map 3 → epic helmet Map 4 → legendary helmet 🟡 Normal Dungeons (3 total) Loot is based on the order the dungeons are entered: First Normal dungeon entered → boots Second Normal dungeon entered → gloves Third Normal dungeon → no loot Rarity depends on the current map: Map 1 → common Map 2 → rare Map 3 → epic Map 4 → legendary 🔴 Hard Dungeons (2 total) Based on entry order: First Hard dungeon → armor Second Hard dungeon → ring Rarity by map: Map 1 → common Map 2 → rare Map 3 → epic Map 4 → legendary 🔥 Very Hard Dungeon (1 total) Always drops the same item: → bow Rarity depends on map: Map 1 → rare Map 2 → epic Map 3 → legendary map 4 very hard dungeon is final if we pass this dungeon.game finish as winner One-Time Loot Rule Each item can be obtained only once. Even if a dungeon is replayed, its assigned loot will not drop again. Loot tracking is handled with a gameData.givenLoot object. Let me know if you'd like me to generate the full getFixedLoot() and giveLoot() functions based on this structure in code. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
level kaç olduğu yazsın level barın altında
User prompt
oyun level bar ekler misin canavar kestikçe artan ve leveli gösteren
User prompt
yükleme ekranında kalıyor oyun
User prompt
oyun başlatılmıyor
User prompt
1. Dungeon Count Bug (Easy Mode): After completing the first Easy dungeon, only 2 Easy dungeons remain visible instead of 3. ➤ Please ensure that there are always 4 Easy dungeons on the map at the start. As each is completed, it should disappear one-by-one, not two-at-once. ➤ Check the logic in the loop where completedDungeons is used to skip rendering. Ensure it tracks the exact count and doesn’t remove extra dungeons accidentally. 2. Dungeon Positions Consistency: Dungeon positions are random every time setupOverworld() runs. ➤ I want dungeon positions to be randomized once per map, but then saved and not changed again when the player re-enters the map. ➤ Please add a way to cache the generated positions per map (e.g. in a mapDungeonPositions object indexed by mapNumber). ➤ Only randomize if positions don’t already exist for that map. 3. Dungeon Completion Before Enemy Kill Limit: Currently, the dungeon is marked complete as soon as enough enemies spawn, not when they are all killed. ➤ Fix this so that completeDungeon() is called only after: The player kills the required number of enemies AND All active enemies on screen are dead (enemies.length === 0) 4. Add Visual Level Bar to UI: ➤ Add a new bar to display the player's level progress toward the next level (like an experience bar). It should sit below the “Level: X” text in overworld and combat modes. The bar should scale from 0 to 100% based on playerCharacter.experience / levelUpThreshold. Optional: color the bar blue or purple. ➤ Make sure it updates dynamically when experience changes (e.g. after enemy kills). These changes will improve dungeon visibility, progression accuracy, and the player's sense of advancement. Please preserve existing logic structure and naming conventions (e.g., currentMap, dungeons, playerCharacter, gameData, etc.). ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
base damage 5 to 10
User prompt
I want to customize enemy damage based on their type. Please update the Enemy class accordingly: In the enemyStats object, add a damage field for each enemy type: js Kopyala Düzenle basic: { ..., damage: 20 }, fast: { ..., damage: 20 }, tank: { ..., damage: 30 }, archer: { ..., damage: 50 }, boss: { ..., damage: 100 } In the Enemy constructor, assign the damage value: js Kopyala Düzenle self.damage = stats.damage; Then go to the collision section inside game.update, where enemies damage the player: Replace this line: js Kopyala Düzenle playerCharacter.health -= Math.max(1, 10 - playerCharacter.defense); With this: js Kopyala Düzenle playerCharacter.health -= Math.max(1, enemy.damage - playerCharacter.defense); This will allow each enemy type to deal appropriate damage, reduced by the player's defense. and main hero starting damage raise 3 to 5
User prompt
I want to show all 10 dungeons on the overworld map from the beginning: 4 Easy 3 Normal 2 Hard 1 VeryHard But only allow interaction based on progression: Easy dungeons should be clickable (enabled) from the start Normal, Hard, and Very Hard should be visible but disabled (unclickable) until enough easier dungeons are completed: Normal unlocks after 4 Easy dungeons completed Hard unlocks after 3 Normal dungeons completed Very Hard unlocks after 2 Hard dungeons completed Additionally: Completed dungeons should disappear from the map after finishing them. Locked dungeons should have a dimmed tint or visual effect to show they are locked. Inside the Dungeon container, set self.down = null if the dungeon is locked (not unlocked yet). Please implement this logic by updating setupOverworld() and Dungeon creation logic. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
I am creating a 2D game with dungeon progression. I want to completely remove the random loot drop logic and instead implement a fixed, sequential loot system based on the dungeon's difficulty, index, and current map number. Here's exactly what I need: 🔁 Dungeon Rules (per map): Each map has: 4 Easy dungeons 3 Normal dungeons 2 Hard dungeons 1 Very Hard dungeon 🧠 Fixed Loot Drop Logic: Only 1 of the Easy dungeons (randomly selected once per map) should drop a helmet. Normal: 1st dungeon drops boots 2nd dungeon drops gloves 3rd dungeon drops nothing Hard: 1st dungeon drops gloves 2nd dungeon drops armor Very Hard: Drops a bow with one tier higher rarity 🎯 Loot Rarity per Map: Map 1 = common Map 2 = rare Map 3 = epic Map 4 = legendary Very Hard bow always drops one tier above map rarity 🔧 Requirements: Remove or disable the dropLoot(x, y, difficulty) function (or only use it for extra random loot in boss waves, not main items). Make completeDungeon(mapNumber, difficulty, index) the only place where loot is given. Inside completeDungeon(), use getFixedLoot(mapNumber, difficulty, index) to determine if an item should drop. If getFixedLoot() returns an item, pass it to giveLoot(type, rarity) to equip it to the player. Ensure completeDungeon() is triggered when a dungeon is completed. Persist loot info in storage so that the same loot isn't dropped twice. Optional: Keep random dropLoot() only for boss or bonus loot, but don’t allow it to replace fixed item logic. Please help refactor or insert this logic in a clean and modular way using standard Upit structures like Container, Character, LootItem, storage, etc. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
restart admin butonu ekle
User prompt
I'm working on a 2D game in Upit where the player uses arrows to attack enemies. Currently, enemies die too quickly. I want to adjust the arrow damage system so that: Each arrow deals exactly 3 base damage by default. This value can still be increased later by level or equipment bonuses. Update the playerCharacter.damage so that it is initialized to 3. Please update the game logic to reflect this base damage. Use standard Upit conventions (playerCharacter, damage, etc.), and ensure consistency across combat mechanics.
User prompt
I am building a 2D game with multiple overworld maps and dungeon progression. I need a loot and dungeon-locking system with the following rules: Each map has 10 dungeons: 4 Easy 3 Normal 2 Hard 1 Very Hard Progression is gated: All Easy dungeons must be completed to unlock Normal All Normal dungeons must be completed to unlock Hard All Hard dungeons must be completed to unlock Very Hard When Very Hard is cleared, move to the next overworld map Loot Drop Rules: From Easy dungeons, only 1 random dungeon should drop a helmet From Normal dungeons: 1st dungeon: boots 2nd dungeon: gloves 3rd dungeon: no drop From Hard dungeons: 1st dungeon: gloves 2nd dungeon: armor From the Very Hard dungeon: a bow with one tier higher rarity Item Rarity Progression per map: Map 1: common Map 2: rare Map 3: epic Map 4: legendary Each item should only drop once per map, and dungeons should be removed after completion. Please generate the JavaScript code compatible with Upit Engine that implements: Controlled loot drops as described Progression locking between difficulty levels Map switching logic after clearing all dungeons Using storage to keep track of which fixed loot was already given Resetting state correctly on new map Use LK, Container, and LootItem structures as standard in Upit Engine. Keep it modular and clear. ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
arrowlar başlangıçta 2 hasar versin düşmana
Code edit (1 edits merged)
Please save this source code
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
/****
* 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 = 5;
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 = 10;
self.defense = 0;
// 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 = 10 + self.level * 2;
self.defense = 0 + self.level * 1;
// 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();
}
// Update level bar if in combat
if (currentState === 'combat') {
updateLevelBar();
}
};
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) {
// Track entry order for normal and hard dungeons
if (difficulty === 'normal' || difficulty === 'hard') {
var orderKey = 'map' + currentMap + '_' + difficulty + '_order';
if (!gameData.dungeonEntryOrder[orderKey]) {
gameData.dungeonEntryOrder[orderKey] = [];
}
// Add this dungeon index to entry order if not already present
if (gameData.dungeonEntryOrder[orderKey].indexOf(index) === -1) {
gameData.dungeonEntryOrder[orderKey].push(index);
}
}
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.6,
tint: 0xFFFFFF,
experience: 10,
damage: 20
},
fast: {
health: 30,
speed: 2.4,
tint: 0x00FF00,
experience: 15,
damage: 20
},
tank: {
health: 120,
speed: 1,
tint: 0xFF0000,
experience: 25,
damage: 30
},
archer: {
health: 40,
speed: 3,
tint: 0x0000FF,
experience: 20,
damage: 50
},
boss: {
health: 400,
speed: 1,
tint: 0xFF00FF,
experience: 50,
damage: 100
}
};
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;
self.damage = stats.damage;
// 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);
};
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 = 15;
var totalEnemiesSpawned = 0;
var maxEnergy = 5;
var currentEnergy = 5;
var energyRegenTimer = 1;
var energyRegenDelay = 50; // 0.3 seconds at 60fps
var isRegeneratingEnergy = false;
var wasEnergyDepleted = false;
var energyBar = null;
var energyBarBg = null;
var levelBarBg = null;
var levelBarFill = null;
var experienceText = null;
var levelBarText = null;
// 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,
completedDungeons: storage.completedDungeons || {},
givenLoot: storage.givenLoot || {},
dungeonEntryOrder: storage.dungeonEntryOrder || {}
};
// 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();
// Load dungeon progression
gameData.completedDungeons = storage.completedDungeons || {};
gameData.givenLoot = storage.givenLoot || {};
currentMap = storage.unlockedMaps || 1;
// 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 allDifficulties = ['easy', 'easy', 'easy', 'easy', 'normal', 'normal', 'normal', 'hard', 'hard', 'veryHard'];
// 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;
}
// Create all 10 dungeons but control their interaction based on progression
var difficultyIndices = {
easy: 0,
normal: 0,
hard: 0,
veryHard: 0
};
for (var i = 0; i < allDifficulties.length; i++) {
var difficulty = allDifficulties[i];
var dungeonIndex = difficultyIndices[difficulty];
var completedCount = getCompletedDungeonsForDifficulty(currentMap, difficulty);
var isUnlocked = isDifficultyUnlocked(currentMap, difficulty);
var isCompleted = dungeonIndex < completedCount;
// Skip creating completed dungeons (they should disappear)
if (isCompleted) {
difficultyIndices[difficulty]++;
continue;
}
var dungeon = new Dungeon(difficulty, dungeonIndex);
difficultyIndices[difficulty]++;
// Apply visual effects based on lock status
if (!isUnlocked) {
// Dim locked dungeons
dungeon.children[0].tint = 0x666666;
dungeon.children[0].alpha = 0.5;
// Disable interaction for locked dungeons
dungeon.down = null;
}
// 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);
// Add map indicator
var mapText = new Text2('Map: ' + currentMap + ' (' + getMapRarity(currentMap) + ')', {
size: 40,
fill: 0xFFFFFF
});
mapText.x = 50;
mapText.y = 100;
game.addChild(mapText);
healthText.setText('Health: ' + playerCharacter.health + '/' + playerCharacter.maxHealth);
healthText.x = 50;
healthText.y = 200;
game.addChild(healthText);
// Add restart admin button
var restartButton = game.attachAsset('backButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 - 100,
y: 100
});
}
// 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 = 15;
totalEnemiesSpawned = 0;
// Add energy bar UI
energyBarBg = game.attachAsset('energyBarBg', {
anchorX: 0,
anchorY: 0,
x: 50,
y: 2000
});
energyBar = game.attachAsset('energyBar', {
anchorX: 0,
anchorY: 0,
x: 50,
y: 2000
});
// Reset energy system
currentEnergy = maxEnergy;
energyRegenTimer = 1;
isRegeneratingEnergy = false;
wasEnergyDepleted = false;
updateEnergyBar();
// Add level bar UI
levelBarBg = game.attachAsset('levelBarBg', {
anchorX: 0,
anchorY: 0,
x: 50,
y: 2050
});
levelBarFill = game.attachAsset('levelBarFill', {
anchorX: 0,
anchorY: 0,
x: 50,
y: 2050
});
experienceText = new Text2('XP: 0/100', {
size: 30,
fill: 0xFFFFFF
});
experienceText.x = 50;
experienceText.y = 2080;
game.addChild(experienceText);
// Add level text below the level bar
levelBarText = new Text2('Level: ' + playerCharacter.level, {
size: 30,
fill: 0xFFFFFF
});
levelBarText.x = 50;
levelBarText.y = 2110;
game.addChild(levelBarText);
updateLevelBar();
// Add UI
updateCombatUI();
}
function updateEnergyBar() {
if (energyBar) {
var energyPercentage = currentEnergy / maxEnergy;
energyBar.width = 300 * energyPercentage;
// Change color based on energy level
if (energyPercentage > 0.6) {
energyBar.tint = 0xFFD700; // Green
} else if (energyPercentage > 0.3) {
energyBar.tint = 0xffff00; // Yellow
} else {
energyBar.tint = 0xff0000; // Red
}
}
}
function updateLevelBar() {
if (levelBarFill && experienceText) {
var levelUpThreshold = playerCharacter.level * 100;
var experiencePercentage = playerCharacter.experience / levelUpThreshold;
levelBarFill.width = 400 * experiencePercentage;
// Update experience text
experienceText.setText('XP: ' + playerCharacter.experience + '/' + levelUpThreshold);
// Update level text
if (levelBarText) {
levelBarText.setText('Level: ' + playerCharacter.level);
}
}
}
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);
// Update level bar
updateLevelBar();
}
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 getMapRarity(mapNumber) {
var rarities = ['common', 'rare', 'epic', 'legendary'];
return rarities[Math.min(mapNumber - 1, 3)];
}
function getDungeonProgressionKey(mapNumber, difficulty) {
return 'map' + mapNumber + '_' + difficulty;
}
function getCompletedDungeonsForDifficulty(mapNumber, difficulty) {
var key = getDungeonProgressionKey(mapNumber, difficulty);
return gameData.completedDungeons[key] || 0;
}
function isDifficultyUnlocked(mapNumber, difficulty) {
if (difficulty === 'easy') return true;
if (difficulty === 'normal') return getCompletedDungeonsForDifficulty(mapNumber, 'easy') >= 4;
if (difficulty === 'hard') return getCompletedDungeonsForDifficulty(mapNumber, 'normal') >= 3;
if (difficulty === 'veryHard') return getCompletedDungeonsForDifficulty(mapNumber, 'hard') >= 2;
return false;
}
function completeDungeon(mapNumber, difficulty, index) {
var key = getDungeonProgressionKey(mapNumber, difficulty);
gameData.completedDungeons[key] = (gameData.completedDungeons[key] || 0) + 1;
// Give fixed loot based on difficulty and completion order
var lootKey = 'map' + mapNumber + '_' + difficulty + '_' + index;
if (!gameData.givenLoot[lootKey]) {
var loot = getFixedLoot(mapNumber, difficulty, index);
if (loot) {
giveLoot(loot.type, loot.rarity);
gameData.givenLoot[lootKey] = true;
}
}
// Check if we should advance to next map or win the game
if (difficulty === 'veryHard' && getCompletedDungeonsForDifficulty(mapNumber, 'veryHard') >= 1) {
// Map 4 Very Hard completion wins the game
if (mapNumber === 4) {
LK.showYouWin();
return;
}
gameData.unlockedMaps = Math.max(gameData.unlockedMaps, mapNumber + 1);
currentMap = mapNumber + 1;
// Reset dungeon completion and loot tracking for new map
resetMapProgress(mapNumber + 1);
}
saveGameData();
}
function getFixedLoot(mapNumber, difficulty, index) {
var rarity = getMapRarity(mapNumber);
if (difficulty === 'easy') {
// Only 1 of the Easy dungeons drops helmet - use a fixed random selection per map
var helmetKey = 'map' + mapNumber + '_helmet_dungeon';
var helmetDungeonIndex = gameData.givenLoot[helmetKey];
if (helmetDungeonIndex === undefined) {
// First time determining which easy dungeon drops helmet
helmetDungeonIndex = Math.floor(Math.random() * 4);
gameData.givenLoot[helmetKey] = helmetDungeonIndex;
}
if (index === helmetDungeonIndex) {
return {
type: 'helmet',
rarity: rarity
};
}
} else if (difficulty === 'normal') {
// Loot based on entry order, not dungeon index
var orderKey = 'map' + mapNumber + '_normal_order';
var entryOrder = gameData.dungeonEntryOrder[orderKey] || [];
var entryPosition = entryOrder.indexOf(index);
if (entryPosition === 0) return {
type: 'boots',
rarity: rarity
};
if (entryPosition === 1) return {
type: 'gloves',
rarity: rarity
};
// Third normal dungeon entered has no drop
} else if (difficulty === 'hard') {
// Loot based on entry order, not dungeon index
var orderKey = 'map' + mapNumber + '_hard_order';
var entryOrder = gameData.dungeonEntryOrder[orderKey] || [];
var entryPosition = entryOrder.indexOf(index);
if (entryPosition === 0) return {
type: 'armor',
rarity: rarity
};
if (entryPosition === 1) return {
type: 'ring',
rarity: rarity
};
} else if (difficulty === 'veryHard') {
// VeryHard bow gets higher rarity than map base rarity
var rarities = ['common', 'rare', 'epic', 'legendary'];
var currentIndex = rarities.indexOf(rarity);
var bowRarity = rarities[Math.min(currentIndex + 1, 3)];
return {
type: 'bow',
rarity: bowRarity
};
}
return null;
}
function giveLoot(type, rarity) {
// Create a proper loot item with stats
var multiplier = {
common: 1,
rare: 2,
epic: 3,
legendary: 5
};
var loot = {
type: type,
rarity: rarity,
healthBonus: Math.floor(Math.random() * 20 * multiplier[rarity]),
damageBonus: Math.floor(Math.random() * 10 * multiplier[rarity]),
defenseBonus: Math.floor(Math.random() * 5 * multiplier[rarity])
};
playerCharacter.equipment[type] = loot;
playerCharacter.calculateStats();
LK.getSound('lootDrop').play();
}
function resetMapProgress(mapNumber) {
// Don't reset progress, just ensure we're tracking the new map
}
function saveGameData() {
storage.level = playerCharacter.level;
storage.experience = playerCharacter.experience;
storage.unlockedMaps = gameData.unlockedMaps;
storage.completedDungeons = gameData.completedDungeons;
storage.givenLoot = gameData.givenLoot;
storage.dungeonEntryOrder = gameData.dungeonEntryOrder;
// 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 restart button (positioned at top right)
if (x >= 2048 - 160 && x <= 2048 - 40 && y >= 70 && y <= 130) {
// Reset all game data
storage.level = 1;
storage.experience = 0;
storage.unlockedMaps = 1;
storage.completedDungeons = {};
storage.givenLoot = {};
storage.dungeonEntryOrder = {};
storage.equipmentHelmetType = null;
storage.equipmentBootsType = null;
storage.equipmentArmorType = null;
storage.equipmentBowType = null;
storage.equipmentNecklaceType = null;
storage.equipmentRingType = null;
storage.equipmentGlovesType = null;
// Reset game state
currentMap = 1;
playerCharacter.level = 1;
playerCharacter.experience = 0;
playerCharacter.health = 100;
playerCharacter.maxHealth = 100;
playerCharacter.equipment = {
helmet: null,
boots: null,
armor: null,
bow: null,
necklace: null,
ring: null,
gloves: null
};
playerCharacter.calculateStats();
gameData.level = 1;
gameData.experience = 0;
gameData.unlockedMaps = 1;
gameData.completedDungeons = {};
gameData.givenLoot = {};
gameData.dungeonEntryOrder = {};
gameData.equipment = playerCharacter.equipment;
setupOverworld();
return;
}
// 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 only if enemies are present and energy available
// If energy was depleted (0), only allow shooting when fully regenerated
var canShoot = enemies.length > 0 && currentEnergy > 0 && (!wasEnergyDepleted || currentEnergy === maxEnergy);
if (canShoot) {
var arrow = new Arrow();
arrow.x = playerCharacter.x + 50;
arrow.y = playerCharacter.y;
arrows.push(arrow);
game.addChild(arrow);
LK.getSound('shoot').play();
// Consume energy
currentEnergy--;
// Check if energy is now depleted
if (currentEnergy === 0) {
wasEnergyDepleted = true;
}
// Reset regeneration timer
energyRegenTimer = 0;
isRegeneratingEnergy = false;
updateEnergyBar();
}
}
}
};
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++;
// Energy regeneration system
if (currentEnergy < maxEnergy) {
energyRegenTimer++;
if (energyRegenTimer >= energyRegenDelay && !isRegeneratingEnergy) {
isRegeneratingEnergy = true;
}
if (isRegeneratingEnergy) {
// Regenerate energy over time using tween
tween(this, {}, {
duration: 200,
onFinish: function onFinish() {
if (currentEnergy < maxEnergy) {
currentEnergy++;
updateEnergyBar();
// Continue regenerating if not at max
if (currentEnergy < maxEnergy) {
energyRegenTimer = energyRegenDelay;
} else {
isRegeneratingEnergy = false;
wasEnergyDepleted = false; // Reset depletion flag when fully regenerated
}
}
}
});
isRegeneratingEnergy = false;
}
}
// Arrows are now fired on click instead of automatically
// Spawn enemies from right side
if (combatTimer - lastEnemySpawn > 120 && totalEnemiesSpawned < 15) {
// 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);
totalEnemiesSpawned++;
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 (totalEnemiesSpawned >= 15 && enemies.length === 0) {
completeDungeon(currentMap, currentDungeon.difficulty, currentDungeon.index);
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, enemy.damage - 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
@@ -308,9 +308,10 @@
var lastEnemySpawn = 0;
var lastArrowShot = 0;
var combatTimer = 0;
var enemiesKilled = 0;
-var targetKills = 10;
+var targetKills = 15;
+var totalEnemiesSpawned = 0;
var maxEnergy = 5;
var currentEnergy = 5;
var energyRegenTimer = 1;
var energyRegenDelay = 50; // 0.3 seconds at 60fps
@@ -562,9 +563,10 @@
lastEnemySpawn = 0;
lastArrowShot = 0;
combatTimer = 0;
enemiesKilled = 0;
- targetKills = 10;
+ targetKills = 15;
+ totalEnemiesSpawned = 0;
// Add energy bar UI
energyBarBg = game.attachAsset('energyBarBg', {
anchorX: 0,
anchorY: 0,
@@ -1023,9 +1025,9 @@
}
}
// Arrows are now fired on click instead of automatically
// Spawn enemies from right side
- if (combatTimer - lastEnemySpawn > 120 && enemiesKilled < targetKills) {
+ if (combatTimer - lastEnemySpawn > 120 && totalEnemiesSpawned < 15) {
// Define enemy types available for each difficulty
var enemyTypesByDifficulty = {
easy: ['basic', 'fast'],
normal: ['basic', 'fast', 'tank'],
@@ -1038,8 +1040,9 @@
enemy.x = 1900;
enemy.y = 1800;
enemies.push(enemy);
game.addChild(enemy);
+ totalEnemiesSpawned++;
lastEnemySpawn = combatTimer;
}
// Update arrows
for (var i = arrows.length - 1; i >= 0; i--) {
@@ -1074,9 +1077,9 @@
enemy.destroy();
enemies.splice(j, 1);
enemiesKilled++;
// Check win condition
- if (enemiesKilled >= targetKills) {
+ if (totalEnemiesSpawned >= 15 && enemies.length === 0) {
completeDungeon(currentMap, currentDungeon.difficulty, currentDungeon.index);
LK.setTimeout(function () {
currentState = 'overworld';
setupOverworld();
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