User prompt
Bombayı aldıktan sonra yanımdaki canavarlar patlasın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Yerde özel güçler atsın şansa göre 50 ihtmal gibi mesala bomba
User prompt
Kılıçları da birazcık daha büyük yapar mısın
User prompt
Kılıçlar da birazcık daha büyük yapar mısın
User prompt
Playeri birazcık daha büyük yapar mısın
User prompt
Kılıçlar playerin eline tam otursun
User prompt
Statü arka planı güzel bir görsel eklemek istiyorum
User prompt
Playeri birazcık daha büyük yapar mısın
User prompt
Keşke biraz insan hareket etse yürütürken sağ sol bakacak
User prompt
Player büyük yapar mısın biraz
User prompt
Tam. Ekrana olarak otursun
User prompt
hareket ettirmek için hareket oku ekler misiniz
User prompt
Hareket etmiyor player
User prompt
Hareket etmiyor
User prompt
Player insan gibi hareket ettirmek istiyorum yapar mısın
User prompt
Coinle bir şeyler alalım menüye shop ekler misiniz
User prompt
Coini şansa göre atsın
User prompt
Coin ekler misin
User prompt
Statünün arka planını kaldır
User prompt
Statüyü başka menü ekleyebilir misiniz
User prompt
Statü artması güç hız can basma gibi ekler misiniz
User prompt
Bossu farklı bir yaratık yapacam
User prompt
Her 10 level de boss gelsin istiyorum
User prompt
Daha düzgün hareket ettirmek istiyorum
User prompt
Satü ekler misiniz
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Monster = Container.expand(function () { var self = Container.call(this); // Define methods on self self.updateHealthBar = function () { var healthPercentage = Math.max(0, self.hp / self.maxHp); // Ensure non-negative percentage self.healthBarCurrent.width = self.maxHealthBarWidth * healthPercentage; }; self.takeDamage = function (damage) { self.hp -= damage; LK.effects.flashObject(self, 0xFF0000, 200); self.updateHealthBar(); // Update health bar display if (self.hp <= 0) { self.die(); } }; self.die = function () { var xpOrb = new XPOrb(); xpOrb.x = self.x; xpOrb.y = self.y; xpOrb.xpValue = self.xpValue; game.addChild(xpOrb); xpOrbs.push(xpOrb); var index = monsters.indexOf(self); if (index > -1) { monsters.splice(index, 1); } self.destroy(); // This will also destroy child health bars }; self.update = function () { var dx = player.x - self.x; var dy = player.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } if (distance < 50) { player.hp -= 0.2; // Player takes less damage if (player.hp <= 0) { LK.showGameOver(); } } }; // Constructor logic var monsterGraphics = self.attachAsset('monster', { anchorX: 0.5, anchorY: 0.5, scaleX: 2.0, // Increased from 1.5 scaleY: 2.0 // Increased from 1.5 }); self.hp = 30; self.maxHp = 30; self.speed = 1; self.xpValue = 25; self.level = Math.floor(Math.random() * 5) + 1; // Random level between 1-5 // Health bar properties and initialization self.maxHealthBarWidth = monsterGraphics.width * 0.8; // Health bar width relative to monster width self.healthBarHeight = 8; var healthBarGap = 5; // Gap between monster and health bar // Position health bar above the monster graphics self.healthBarOffsetY = -(monsterGraphics.height / 2) - self.healthBarHeight / 2 - healthBarGap; self.healthBarBackground = self.attachAsset('monster_hp_bg', { shape: 'box', width: self.maxHealthBarWidth, height: self.healthBarHeight, color: 0x550000, // Dark red for background anchorX: 0.5, // Center the background bar horizontally anchorY: 0.5, // Center the background bar vertically x: 0, // Centered horizontally relative to the monster y: self.healthBarOffsetY // Positioned above the monster }); self.healthBarCurrent = self.attachAsset('monster_hp_fg', { shape: 'box', width: self.maxHealthBarWidth, // Initial full width height: self.healthBarHeight, color: 0x00FF00, // Green for current health anchorX: 0, // Align left edge of the current health bar anchorY: 0.5, // Center the current health bar vertically // Position its left edge to align with the left edge of the background bar x: -self.maxHealthBarWidth / 2, y: self.healthBarOffsetY // Positioned above the monster }); // Monster level text self.levelText = new Text2('Lv.' + self.level, { size: 16, fill: 0xFFFFFF }); self.levelText.anchor.set(0.5, 0.5); self.levelText.x = 0; self.levelText.y = self.healthBarOffsetY - 20; // Position above health bar self.addChild(self.levelText); self.updateHealthBar(); // Initial call to set health bar width correctly return self; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.2, scaleY: 1.2 }); self.level = 1; self.xp = 0; self.xpToNext = 100; self.hp = 100; self.maxHp = 100; self.damage = 10; self.attackCooldown = 0; self.sword = null; self.vx = 0; // Horizontal velocity self.vy = 0; // Vertical velocity self.createSword = function () { if (self.sword) { self.removeChild(self.sword); } var swordType = 'woodenSword'; var baseDamage = 10; // Calculate damage increase every 5 levels var damageMultiplier = Math.floor(self.level / 5); var damage = baseDamage + damageMultiplier * 5; if (self.level >= 20) { swordType = 'steelSword'; } else if (self.level >= 10) { swordType = 'ironSword'; } self.damage = damage; self.sword = self.attachAsset(swordType, { anchorX: 0, anchorY: 0.5, x: 45, y: 0 }); }; self.gainXP = function (amount) { self.xp += amount; if (self.xp >= self.xpToNext) { self.levelUp(); } }; self.levelUp = function () { self.level++; self.xp = 0; self.xpToNext = self.level * 100; // self.maxHp remains at 100, as per the "health up to 100" requirement. self.hp = self.maxHp; // Restore HP to the current maxHp (which is 100). if (self.level % 10 === 0) { self.createSword(); } LK.getSound('levelUp').play(); LK.effects.flashObject(self, 0xFFD700, 500); }; self.attack = function () { if (self.attackCooldown <= 0) { self.attackCooldown = 30; LK.getSound('attack').play(); if (self.sword) { tween(self.sword, { rotation: Math.PI / 4 }, { duration: 150, easing: tween.easeOut }); tween(self.sword, { rotation: 0 }, { duration: 150, easing: tween.easeIn }); } for (var i = monsters.length - 1; i >= 0; i--) { // Iterate backwards var monster = monsters[i]; var distance = Math.sqrt((self.x - monster.x) * (self.x - monster.x) + (self.y - monster.y) * (self.y - monster.y)); if (distance < 120) { // Increased attack range from 100 to 120 monster.takeDamage(self.damage); } } } }; self.update = function () { if (self.attackCooldown > 0) { self.attackCooldown--; } // Auto attack - attack every 30 frames (0.5 seconds) if (self.attackCooldown <= 0) { // Check if there are monsters nearby to attack var foundNearbyMonster = false; for (var i = 0; i < monsters.length; i++) { var monster = monsters[i]; var distance = Math.sqrt((self.x - monster.x) * (self.x - monster.x) + (self.y - monster.y) * (self.y - monster.y)); if (distance < 120) { foundNearbyMonster = true; break; } } if (foundNearbyMonster) { self.attack(); } } }; self.createSword(); return self; }); var XPOrb = Container.expand(function () { var self = Container.call(this); var orbGraphics = self.attachAsset('xpOrb', { anchorX: 0.5, anchorY: 0.5 }); self.xpValue = 25; self.magnetSpeed = 3; self.collected = false; self.update = function () { if (self.collected) return; var dx = player.x - self.x; var dy = player.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 80) { self.x += dx / distance * self.magnetSpeed; self.y += dy / distance * self.magnetSpeed; if (distance < 30) { self.collect(); } } }; self.collect = function () { if (self.collected) return; self.collected = true; player.gainXP(self.xpValue); LK.getSound('xpPickup').play(); var index = xpOrbs.indexOf(self); if (index > -1) { xpOrbs.splice(index, 1); } self.destroy(); }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2F4F2F }); /**** * Game Code ****/ // Add the dungeon background first so it's behind all other game elements var dungeonBackgroundDisplay = game.addChild(LK.getAsset('dungeonBackground', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 // The asset is defined with width 2048 and height 2732, // so it will automatically cover the full game screen. })); var player; var monsters = []; var xpOrbs = []; var moveDirection = { x: 0, y: 0 }; var spawnTimer = 0; // Player movement physics constants var playerAcceleration = 0.5; // How quickly the player speeds up var playerMaxSpeed = 6; // Maximum speed of the player (same as previous constant speed) var playerFriction = 0.9; // How quickly the player slows down (0-1, lower is stronger friction) player = game.addChild(new Player()); player.x = 1024; player.y = 1366; var levelText = new Text2('Level: 1', { size: 40, fill: 0xFFFFFF }); levelText.anchor.set(0, 0); LK.gui.topLeft.addChild(levelText); levelText.x = 120; levelText.y = 20; var xpText = new Text2('XP: 0/100', { size: 30, fill: 0xFFD700 }); xpText.anchor.set(0, 0); LK.gui.topLeft.addChild(xpText); xpText.x = 120; xpText.y = 70; var hpText = new Text2('HP: 100/100', { size: 30, fill: 0xFF4500 }); hpText.anchor.set(0, 0); LK.gui.topLeft.addChild(hpText); hpText.x = 120; hpText.y = 110; var statusText = new Text2('Statü: ' + player.damage, { size: 30, fill: 0xFFFFFF // White color for the status text }); statusText.anchor.set(0, 0); LK.gui.topLeft.addChild(statusText); statusText.x = 120; statusText.y = 150; // Positioned below hpText game.down = function (x, y, obj) { var dx = x - player.x; var dy = y - player.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { moveDirection.x = dx / distance; moveDirection.y = dy / distance; } }; game.up = function (x, y, obj) { moveDirection.x = 0; moveDirection.y = 0; }; function spawnMonster() { var monster = new Monster(); var side = Math.floor(Math.random() * 4); if (side === 0) { monster.x = Math.random() * 2048; monster.y = -50; } else if (side === 1) { monster.x = 2098; monster.y = Math.random() * 2732; } else if (side === 2) { monster.x = Math.random() * 2048; monster.y = 2782; } else { monster.x = -50; monster.y = Math.random() * 2732; } game.addChild(monster); monsters.push(monster); } game.update = function () { spawnTimer++; if (spawnTimer >= 120) { spawnMonster(); spawnTimer = 0; } // Player movement logic using acceleration and friction // Horizontal movement if (moveDirection.x !== 0) { player.vx += moveDirection.x * playerAcceleration; // Clamp velocity to maxSpeed if (player.vx > playerMaxSpeed) player.vx = playerMaxSpeed; if (player.vx < -playerMaxSpeed) player.vx = -playerMaxSpeed; } else { player.vx *= playerFriction; // If velocity is very small, set to 0 to stop movement completely if (Math.abs(player.vx) < 0.1) player.vx = 0; } // Vertical movement if (moveDirection.y !== 0) { player.vy += moveDirection.y * playerAcceleration; // Clamp velocity to maxSpeed if (player.vy > playerMaxSpeed) player.vy = playerMaxSpeed; if (player.vy < -playerMaxSpeed) player.vy = -playerMaxSpeed; } else { player.vy *= playerFriction; // If velocity is very small, set to 0 to stop movement completely if (Math.abs(player.vy) < 0.1) player.vy = 0; } // Calculate new potential position var newX = player.x + player.vx; var newY = player.y + player.vy; // Boundary checks and position update for X // The boundaries (40, 2008, etc.) are assumed to be for the player's center (x,y) if (newX >= 40 && newX <= 2008) { player.x = newX; } else { player.vx = 0; // Stop horizontal movement if hitting a boundary // Snap player to the boundary edge if (newX < 40) player.x = 40;else if (newX > 2008) player.x = 2008; } // Boundary checks and position update for Y if (newY >= 40 && newY <= 2692) { player.y = newY; } else { player.vy = 0; // Stop vertical movement if hitting a boundary // Snap player to the boundary edge if (newY < 40) player.y = 40;else if (newY > 2692) player.y = 2692; } for (var i = monsters.length - 1; i >= 0; i--) { var monster = monsters[i]; if (monster.x < -100 || monster.x > 2148 || monster.y < -100 || monster.y > 2832) { monster.destroy(); monsters.splice(i, 1); } } for (var j = xpOrbs.length - 1; j >= 0; j--) { var orb = xpOrbs[j]; if (orb.x < -50 || orb.x > 2098 || orb.y < -50 || orb.y > 2782) { orb.destroy(); xpOrbs.splice(j, 1); } } levelText.setText('Level: ' + player.level); xpText.setText('XP: ' + player.xp + '/' + player.xpToNext); hpText.setText('HP: ' + Math.max(0, Math.floor(player.hp)) + '/' + player.maxHp); statusText.setText('Statü: ' + player.damage); };
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
var Monster = Container.expand(function () {
var self = Container.call(this);
// Define methods on self
self.updateHealthBar = function () {
var healthPercentage = Math.max(0, self.hp / self.maxHp); // Ensure non-negative percentage
self.healthBarCurrent.width = self.maxHealthBarWidth * healthPercentage;
};
self.takeDamage = function (damage) {
self.hp -= damage;
LK.effects.flashObject(self, 0xFF0000, 200);
self.updateHealthBar(); // Update health bar display
if (self.hp <= 0) {
self.die();
}
};
self.die = function () {
var xpOrb = new XPOrb();
xpOrb.x = self.x;
xpOrb.y = self.y;
xpOrb.xpValue = self.xpValue;
game.addChild(xpOrb);
xpOrbs.push(xpOrb);
var index = monsters.indexOf(self);
if (index > -1) {
monsters.splice(index, 1);
}
self.destroy(); // This will also destroy child health bars
};
self.update = function () {
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
self.x += dx / distance * self.speed;
self.y += dy / distance * self.speed;
}
if (distance < 50) {
player.hp -= 0.2; // Player takes less damage
if (player.hp <= 0) {
LK.showGameOver();
}
}
};
// Constructor logic
var monsterGraphics = self.attachAsset('monster', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.0,
// Increased from 1.5
scaleY: 2.0 // Increased from 1.5
});
self.hp = 30;
self.maxHp = 30;
self.speed = 1;
self.xpValue = 25;
self.level = Math.floor(Math.random() * 5) + 1; // Random level between 1-5
// Health bar properties and initialization
self.maxHealthBarWidth = monsterGraphics.width * 0.8; // Health bar width relative to monster width
self.healthBarHeight = 8;
var healthBarGap = 5; // Gap between monster and health bar
// Position health bar above the monster graphics
self.healthBarOffsetY = -(monsterGraphics.height / 2) - self.healthBarHeight / 2 - healthBarGap;
self.healthBarBackground = self.attachAsset('monster_hp_bg', {
shape: 'box',
width: self.maxHealthBarWidth,
height: self.healthBarHeight,
color: 0x550000,
// Dark red for background
anchorX: 0.5,
// Center the background bar horizontally
anchorY: 0.5,
// Center the background bar vertically
x: 0,
// Centered horizontally relative to the monster
y: self.healthBarOffsetY // Positioned above the monster
});
self.healthBarCurrent = self.attachAsset('monster_hp_fg', {
shape: 'box',
width: self.maxHealthBarWidth,
// Initial full width
height: self.healthBarHeight,
color: 0x00FF00,
// Green for current health
anchorX: 0,
// Align left edge of the current health bar
anchorY: 0.5,
// Center the current health bar vertically
// Position its left edge to align with the left edge of the background bar
x: -self.maxHealthBarWidth / 2,
y: self.healthBarOffsetY // Positioned above the monster
});
// Monster level text
self.levelText = new Text2('Lv.' + self.level, {
size: 16,
fill: 0xFFFFFF
});
self.levelText.anchor.set(0.5, 0.5);
self.levelText.x = 0;
self.levelText.y = self.healthBarOffsetY - 20; // Position above health bar
self.addChild(self.levelText);
self.updateHealthBar(); // Initial call to set health bar width correctly
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.2,
scaleY: 1.2
});
self.level = 1;
self.xp = 0;
self.xpToNext = 100;
self.hp = 100;
self.maxHp = 100;
self.damage = 10;
self.attackCooldown = 0;
self.sword = null;
self.vx = 0; // Horizontal velocity
self.vy = 0; // Vertical velocity
self.createSword = function () {
if (self.sword) {
self.removeChild(self.sword);
}
var swordType = 'woodenSword';
var baseDamage = 10;
// Calculate damage increase every 5 levels
var damageMultiplier = Math.floor(self.level / 5);
var damage = baseDamage + damageMultiplier * 5;
if (self.level >= 20) {
swordType = 'steelSword';
} else if (self.level >= 10) {
swordType = 'ironSword';
}
self.damage = damage;
self.sword = self.attachAsset(swordType, {
anchorX: 0,
anchorY: 0.5,
x: 45,
y: 0
});
};
self.gainXP = function (amount) {
self.xp += amount;
if (self.xp >= self.xpToNext) {
self.levelUp();
}
};
self.levelUp = function () {
self.level++;
self.xp = 0;
self.xpToNext = self.level * 100;
// self.maxHp remains at 100, as per the "health up to 100" requirement.
self.hp = self.maxHp; // Restore HP to the current maxHp (which is 100).
if (self.level % 10 === 0) {
self.createSword();
}
LK.getSound('levelUp').play();
LK.effects.flashObject(self, 0xFFD700, 500);
};
self.attack = function () {
if (self.attackCooldown <= 0) {
self.attackCooldown = 30;
LK.getSound('attack').play();
if (self.sword) {
tween(self.sword, {
rotation: Math.PI / 4
}, {
duration: 150,
easing: tween.easeOut
});
tween(self.sword, {
rotation: 0
}, {
duration: 150,
easing: tween.easeIn
});
}
for (var i = monsters.length - 1; i >= 0; i--) {
// Iterate backwards
var monster = monsters[i];
var distance = Math.sqrt((self.x - monster.x) * (self.x - monster.x) + (self.y - monster.y) * (self.y - monster.y));
if (distance < 120) {
// Increased attack range from 100 to 120
monster.takeDamage(self.damage);
}
}
}
};
self.update = function () {
if (self.attackCooldown > 0) {
self.attackCooldown--;
}
// Auto attack - attack every 30 frames (0.5 seconds)
if (self.attackCooldown <= 0) {
// Check if there are monsters nearby to attack
var foundNearbyMonster = false;
for (var i = 0; i < monsters.length; i++) {
var monster = monsters[i];
var distance = Math.sqrt((self.x - monster.x) * (self.x - monster.x) + (self.y - monster.y) * (self.y - monster.y));
if (distance < 120) {
foundNearbyMonster = true;
break;
}
}
if (foundNearbyMonster) {
self.attack();
}
}
};
self.createSword();
return self;
});
var XPOrb = Container.expand(function () {
var self = Container.call(this);
var orbGraphics = self.attachAsset('xpOrb', {
anchorX: 0.5,
anchorY: 0.5
});
self.xpValue = 25;
self.magnetSpeed = 3;
self.collected = false;
self.update = function () {
if (self.collected) return;
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 80) {
self.x += dx / distance * self.magnetSpeed;
self.y += dy / distance * self.magnetSpeed;
if (distance < 30) {
self.collect();
}
}
};
self.collect = function () {
if (self.collected) return;
self.collected = true;
player.gainXP(self.xpValue);
LK.getSound('xpPickup').play();
var index = xpOrbs.indexOf(self);
if (index > -1) {
xpOrbs.splice(index, 1);
}
self.destroy();
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2F4F2F
});
/****
* Game Code
****/
// Add the dungeon background first so it's behind all other game elements
var dungeonBackgroundDisplay = game.addChild(LK.getAsset('dungeonBackground', {
anchorX: 0.0,
anchorY: 0.0,
x: 0,
y: 0
// The asset is defined with width 2048 and height 2732,
// so it will automatically cover the full game screen.
}));
var player;
var monsters = [];
var xpOrbs = [];
var moveDirection = {
x: 0,
y: 0
};
var spawnTimer = 0;
// Player movement physics constants
var playerAcceleration = 0.5; // How quickly the player speeds up
var playerMaxSpeed = 6; // Maximum speed of the player (same as previous constant speed)
var playerFriction = 0.9; // How quickly the player slows down (0-1, lower is stronger friction)
player = game.addChild(new Player());
player.x = 1024;
player.y = 1366;
var levelText = new Text2('Level: 1', {
size: 40,
fill: 0xFFFFFF
});
levelText.anchor.set(0, 0);
LK.gui.topLeft.addChild(levelText);
levelText.x = 120;
levelText.y = 20;
var xpText = new Text2('XP: 0/100', {
size: 30,
fill: 0xFFD700
});
xpText.anchor.set(0, 0);
LK.gui.topLeft.addChild(xpText);
xpText.x = 120;
xpText.y = 70;
var hpText = new Text2('HP: 100/100', {
size: 30,
fill: 0xFF4500
});
hpText.anchor.set(0, 0);
LK.gui.topLeft.addChild(hpText);
hpText.x = 120;
hpText.y = 110;
var statusText = new Text2('Statü: ' + player.damage, {
size: 30,
fill: 0xFFFFFF // White color for the status text
});
statusText.anchor.set(0, 0);
LK.gui.topLeft.addChild(statusText);
statusText.x = 120;
statusText.y = 150; // Positioned below hpText
game.down = function (x, y, obj) {
var dx = x - player.x;
var dy = y - player.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
moveDirection.x = dx / distance;
moveDirection.y = dy / distance;
}
};
game.up = function (x, y, obj) {
moveDirection.x = 0;
moveDirection.y = 0;
};
function spawnMonster() {
var monster = new Monster();
var side = Math.floor(Math.random() * 4);
if (side === 0) {
monster.x = Math.random() * 2048;
monster.y = -50;
} else if (side === 1) {
monster.x = 2098;
monster.y = Math.random() * 2732;
} else if (side === 2) {
monster.x = Math.random() * 2048;
monster.y = 2782;
} else {
monster.x = -50;
monster.y = Math.random() * 2732;
}
game.addChild(monster);
monsters.push(monster);
}
game.update = function () {
spawnTimer++;
if (spawnTimer >= 120) {
spawnMonster();
spawnTimer = 0;
}
// Player movement logic using acceleration and friction
// Horizontal movement
if (moveDirection.x !== 0) {
player.vx += moveDirection.x * playerAcceleration;
// Clamp velocity to maxSpeed
if (player.vx > playerMaxSpeed) player.vx = playerMaxSpeed;
if (player.vx < -playerMaxSpeed) player.vx = -playerMaxSpeed;
} else {
player.vx *= playerFriction;
// If velocity is very small, set to 0 to stop movement completely
if (Math.abs(player.vx) < 0.1) player.vx = 0;
}
// Vertical movement
if (moveDirection.y !== 0) {
player.vy += moveDirection.y * playerAcceleration;
// Clamp velocity to maxSpeed
if (player.vy > playerMaxSpeed) player.vy = playerMaxSpeed;
if (player.vy < -playerMaxSpeed) player.vy = -playerMaxSpeed;
} else {
player.vy *= playerFriction;
// If velocity is very small, set to 0 to stop movement completely
if (Math.abs(player.vy) < 0.1) player.vy = 0;
}
// Calculate new potential position
var newX = player.x + player.vx;
var newY = player.y + player.vy;
// Boundary checks and position update for X
// The boundaries (40, 2008, etc.) are assumed to be for the player's center (x,y)
if (newX >= 40 && newX <= 2008) {
player.x = newX;
} else {
player.vx = 0; // Stop horizontal movement if hitting a boundary
// Snap player to the boundary edge
if (newX < 40) player.x = 40;else if (newX > 2008) player.x = 2008;
}
// Boundary checks and position update for Y
if (newY >= 40 && newY <= 2692) {
player.y = newY;
} else {
player.vy = 0; // Stop vertical movement if hitting a boundary
// Snap player to the boundary edge
if (newY < 40) player.y = 40;else if (newY > 2692) player.y = 2692;
}
for (var i = monsters.length - 1; i >= 0; i--) {
var monster = monsters[i];
if (monster.x < -100 || monster.x > 2148 || monster.y < -100 || monster.y > 2832) {
monster.destroy();
monsters.splice(i, 1);
}
}
for (var j = xpOrbs.length - 1; j >= 0; j--) {
var orb = xpOrbs[j];
if (orb.x < -50 || orb.x > 2098 || orb.y < -50 || orb.y > 2782) {
orb.destroy();
xpOrbs.splice(j, 1);
}
}
levelText.setText('Level: ' + player.level);
xpText.setText('XP: ' + player.xp + '/' + player.xpToNext);
hpText.setText('HP: ' + Math.max(0, Math.floor(player.hp)) + '/' + player.maxHp);
statusText.setText('Statü: ' + player.damage);
};
ironSword. In-Game asset. High contrast. No shadows
Aynısını istiyorum farklı renklerle
Ayakları olsun istiyorum ve düz dursun istiyorum Arka plan yok
Arka plan yok olmalı Beyaz olsun
Bomba. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
Coin. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat