User prompt
Turlari 1dk ya indir
User prompt
Elektirik buyucusunu wizard karakterinin ustune gecir
User prompt
Elektirik atan karakteri modelle
User prompt
Elektirik atan dusman diyerlerine gore daha cok cani olsun
User prompt
Yeni dusman turu karakterin uzerine yildirim atan bir buyucu ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Level bari kamera gibi karakteri takib etsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Karakter yurudukce oyun kamerasida ona gore haraket etsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Turlarin dakika sayaci oyunun ustunde gozuksun
User prompt
Oyunda tur mekaniyi olsun her tur 2dk olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
düşmanlardan çıkan eksip ona beraber olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ilk level icin 30xb gereksin
User prompt
Oyun alaninin altinda level bari duzelt ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Dusmanlar oldukden sonra mavi xb dusursun
User prompt
Mermi atma hizini azalt
User prompt
Can bari yap
User prompt
Ekranda nereye basak kerakter oraya girsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Karkakterin yurumesi icin analog yap ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Karaktere yurume mekaniyi ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Karakter yururken de atesetsin
User prompt
Karakteri yurume mekaniyini geri ekle
User prompt
Bu silahla ates etsin
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'tween(weaponGraphics).to({' Line Number: 139 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Karakterimize bir silah ver
User prompt
Karakter dusmanlara saldirsin
Code edit (1 edits merged)
Please save this source code
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var BasicEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('basicEnemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 25;
self.maxHealth = 25;
self.damage = 15;
self.speed = 1;
self.scoreValue = 10;
self.takeDamage = function (damage) {
self.health -= damage;
LK.effects.flashObject(self, 0xFFFFFF, 200);
if (self.health <= 0) {
self.destroy();
LK.setScore(LK.getScore() + self.scoreValue);
scoreTxt.setText(LK.getScore());
LK.getSound('enemyDestroy').play();
for (var i = enemies.length - 1; i >= 0; i--) {
if (enemies[i] === self) {
enemies.splice(i, 1);
break;
}
}
}
};
self.update = function () {
var dx = hero.x - self.x;
var dy = hero.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;
}
};
return self;
});
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.damage = 25;
self.targetX = 0;
self.targetY = 0;
self.directionX = 0;
self.directionY = 0;
self.setTarget = function (x, y) {
self.targetX = x;
self.targetY = y;
var dx = x - self.x;
var dy = y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 0) {
self.directionX = dx / distance;
self.directionY = dy / distance;
}
// Rotate bullet to face direction
bulletGraphics.rotation = Math.atan2(dy, dx) + Math.PI / 2;
};
self.update = function () {
self.x += self.directionX * self.speed;
self.y += self.directionY * self.speed;
// Remove bullet if it goes off screen
if (self.x < -50 || self.x > 2098 || self.y < -50 || self.y > 2782) {
self.destroy();
for (var i = bullets.length - 1; i >= 0; i--) {
if (bullets[i] === self) {
bullets.splice(i, 1);
break;
}
}
}
};
return self;
});
var FastEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('fastEnemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 15;
self.maxHealth = 15;
self.damage = 10;
self.speed = 2.5;
self.scoreValue = 15;
self.takeDamage = function (damage) {
self.health -= damage;
LK.effects.flashObject(self, 0xFFFFFF, 200);
if (self.health <= 0) {
self.destroy();
LK.setScore(LK.getScore() + self.scoreValue);
scoreTxt.setText(LK.getScore());
LK.getSound('enemyDestroy').play();
for (var i = enemies.length - 1; i >= 0; i--) {
if (enemies[i] === self) {
enemies.splice(i, 1);
break;
}
}
}
};
self.update = function () {
var dx = hero.x - self.x;
var dy = hero.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;
}
};
return self;
});
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.attachAsset('hero', {
anchorX: 0.5,
anchorY: 0.5
});
var weaponGraphics = self.attachAsset('weapon', {
anchorX: 0.5,
anchorY: 0.9
});
weaponGraphics.x = 25;
weaponGraphics.y = -10;
self.maxHealth = 100;
self.health = self.maxHealth;
self.attackDamage = 25;
self.isInvulnerable = false;
self.takeDamage = function (damage) {
if (self.isInvulnerable) return;
self.health -= damage;
if (self.health <= 0) {
self.health = 0;
LK.showGameOver();
return;
}
// Flash red when taking damage
LK.effects.flashObject(self, 0xFF0000, 300);
LK.getSound('playerHit').play();
// Brief invulnerability
self.isInvulnerable = true;
LK.setTimeout(function () {
self.isInvulnerable = false;
}, 500);
};
self.attack = function (enemy) {
enemy.takeDamage(self.attackDamage);
LK.getSound('enemyHit').play();
// Weapon swing animation
tween(weaponGraphics, {
rotation: weaponGraphics.rotation + Math.PI / 3
}, {
duration: 100
});
};
self.updateWeapon = function (targetX, targetY) {
// Calculate angle to target
var dx = targetX - self.x;
var dy = targetY - self.y;
var angle = Math.atan2(dy, dx);
weaponGraphics.rotation = angle + Math.PI / 2;
};
self.shoot = function (targetX, targetY) {
var bullet = new Bullet();
bullet.x = self.x + Math.cos(weaponGraphics.rotation - Math.PI / 2) * 40;
bullet.y = self.y + Math.sin(weaponGraphics.rotation - Math.PI / 2) * 40;
bullet.setTarget(targetX, targetY);
bullets.push(bullet);
game.addChild(bullet);
LK.getSound('weaponShoot').play();
// Weapon recoil animation
tween(weaponGraphics, {
y: weaponGraphics.y + 5
}, {
duration: 50,
onComplete: function onComplete() {
tween(weaponGraphics, {
y: weaponGraphics.y - 5
}, {
duration: 50
});
}
});
};
self.isWalking = false;
self.moveSpeed = 4;
self.analogMove = function (deltaX, deltaY) {
// Analog movement with bounds checking
var newX = self.x + deltaX * self.moveSpeed;
var newY = self.y + deltaY * self.moveSpeed;
// Keep within bounds
self.x = Math.max(40, Math.min(2008, newX));
self.y = Math.max(40, Math.min(2692, newY));
};
self.walkTo = function (targetX, targetY) {
// Don't start new walk if already walking
if (self.isWalking) {
tween.stop(self, {
x: true,
y: true
});
}
self.isWalking = true;
// Keep within bounds
targetX = Math.max(40, Math.min(2008, targetX));
targetY = Math.max(40, Math.min(2692, targetY));
// Calculate distance for duration
var dx = targetX - self.x;
var dy = targetY - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
var duration = distance * 2; // Adjust speed by changing multiplier
// Walking animation with slight bounce
tween(heroGraphics, {
scaleY: 0.9
}, {
duration: duration / 4,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(heroGraphics, {
scaleY: 1.1
}, {
duration: duration / 4,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(heroGraphics, {
scaleY: 1.0
}, {
duration: duration / 2,
easing: tween.easeOut
});
}
});
}
});
// Move to target position
tween(self, {
x: targetX,
y: targetY
}, {
duration: duration,
easing: tween.easeOut,
onFinish: function onFinish() {
self.isWalking = false;
}
});
};
return self;
});
var StrongEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('strongEnemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 50;
self.maxHealth = 50;
self.damage = 25;
self.speed = 0.8;
self.scoreValue = 25;
self.takeDamage = function (damage) {
self.health -= damage;
LK.effects.flashObject(self, 0xFFFFFF, 200);
if (self.health <= 0) {
self.destroy();
LK.setScore(LK.getScore() + self.scoreValue);
scoreTxt.setText(LK.getScore());
LK.getSound('enemyDestroy').play();
for (var i = enemies.length - 1; i >= 0; i--) {
if (enemies[i] === self) {
enemies.splice(i, 1);
break;
}
}
}
};
self.update = function () {
var dx = hero.x - self.x;
var dy = hero.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;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x2E2E2E
});
/****
* Game Code
****/
var hero;
var enemies = [];
var bullets = [];
var spawnTimer = 0;
var difficultyLevel = 1;
var scoreTxt;
var healthBar;
var healthBarBg;
var attackIndicator;
var lastShootTime = 0;
var joystickBase;
var joystickKnob;
var isJoystickActive = false;
var joystickStartX = 0;
var joystickStartY = 0;
var joystickRadius = 80;
var movementX = 0;
var movementY = 0;
// Create score display
scoreTxt = new Text2('0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create health bar background
healthBarBg = LK.getAsset('healthBarBg', {
anchorX: 0,
anchorY: 0
});
healthBarBg.x = 100;
healthBarBg.y = 100;
LK.gui.topLeft.addChild(healthBarBg);
// Create health bar
healthBar = LK.getAsset('healthBar', {
anchorX: 0,
anchorY: 0
});
healthBar.x = 100;
healthBar.y = 100;
LK.gui.topLeft.addChild(healthBar);
// Create hero
hero = game.addChild(new Hero());
hero.x = 2048 / 2;
hero.y = 2732 / 2;
// Create attack range indicator (initially hidden)
attackIndicator = LK.getAsset('attackRange', {
anchorX: 0.5,
anchorY: 0.5
});
attackIndicator.alpha = 0.3;
attackIndicator.visible = false;
game.addChild(attackIndicator);
// Create analog joystick base
joystickBase = LK.getAsset('attackRange', {
anchorX: 0.5,
anchorY: 0.5
});
joystickBase.alpha = 0.2;
joystickBase.visible = false;
joystickBase.scaleX = 1.5;
joystickBase.scaleY = 1.5;
game.addChild(joystickBase);
// Create analog joystick knob
joystickKnob = LK.getAsset('hero', {
anchorX: 0.5,
anchorY: 0.5
});
joystickKnob.alpha = 0.7;
joystickKnob.visible = false;
joystickKnob.scaleX = 0.6;
joystickKnob.scaleY = 0.6;
game.addChild(joystickKnob);
function spawnEnemy() {
var enemyType = Math.random();
var enemy;
if (enemyType < 0.6) {
enemy = new BasicEnemy();
} else if (enemyType < 0.85) {
enemy = new FastEnemy();
} else {
enemy = new StrongEnemy();
}
// Spawn at random edge position
var side = Math.floor(Math.random() * 4);
switch (side) {
case 0:
// Top
enemy.x = Math.random() * 2048;
enemy.y = -50;
break;
case 1:
// Right
enemy.x = 2048 + 50;
enemy.y = Math.random() * 2732;
break;
case 2:
// Bottom
enemy.x = Math.random() * 2048;
enemy.y = 2732 + 50;
break;
case 3:
// Left
enemy.x = -50;
enemy.y = Math.random() * 2732;
break;
}
enemies.push(enemy);
game.addChild(enemy);
}
function updateHealthBar() {
var healthPercent = hero.health / hero.maxHealth;
healthBar.scaleX = healthPercent;
if (healthPercent > 0.5) {
healthBar.tint = 0x4CAF50; // Green
} else if (healthPercent > 0.25) {
healthBar.tint = 0xFFC107; // Yellow
} else {
healthBar.tint = 0xF44336; // Red
}
}
function handleMove(x, y, obj) {
// Handle analog joystick movement
if (isJoystickActive) {
var deltaX = x - joystickStartX;
var deltaY = y - joystickStartY;
var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
// Limit joystick range
if (distance > joystickRadius) {
deltaX = deltaX / distance * joystickRadius;
deltaY = deltaY / distance * joystickRadius;
}
// Update joystick knob position
joystickKnob.x = joystickStartX + deltaX;
joystickKnob.y = joystickStartY + deltaY;
// Calculate movement values (-1 to 1)
movementX = deltaX / joystickRadius;
movementY = deltaY / joystickRadius;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
// Make hero walk to touch position
hero.walkTo(x, y);
};
game.up = function (x, y, obj) {
// Deactivate analog joystick
if (isJoystickActive) {
isJoystickActive = false;
joystickBase.visible = false;
joystickKnob.visible = false;
movementX = 0;
movementY = 0;
}
attackIndicator.visible = false;
};
game.update = function () {
// Process analog movement
if (isJoystickActive && (Math.abs(movementX) > 0.1 || Math.abs(movementY) > 0.1)) {
hero.analogMove(movementX, movementY);
}
spawnTimer++;
// Increase difficulty over time
if (LK.getScore() > difficultyLevel * 100) {
difficultyLevel++;
}
// Spawn enemies based on difficulty
var spawnRate = Math.max(60 - difficultyLevel * 5, 20);
if (spawnTimer >= spawnRate) {
spawnEnemy();
spawnTimer = 0;
}
// Update weapon to point towards nearest enemy
var nearestEnemy = null;
var nearestDistance = Infinity;
for (var j = 0; j < enemies.length; j++) {
var tempEnemy = enemies[j];
var tempDx = hero.x - tempEnemy.x;
var tempDy = hero.y - tempEnemy.y;
var tempDistance = Math.sqrt(tempDx * tempDx + tempDy * tempDy);
if (tempDistance < nearestDistance) {
nearestEnemy = tempEnemy;
nearestDistance = tempDistance;
}
}
if (nearestEnemy) {
hero.updateWeapon(nearestEnemy.x, nearestEnemy.y);
// Auto-shoot while moving - shoot at nearest enemy every 20 ticks
var currentTime = LK.ticks;
if (currentTime - lastShootTime > 20 && nearestDistance < 800) {
hero.shoot(nearestEnemy.x, nearestEnemy.y);
lastShootTime = currentTime;
}
}
// Check bullet collisions with enemies
for (var b = bullets.length - 1; b >= 0; b--) {
var bullet = bullets[b];
var bulletHit = false;
for (var e = enemies.length - 1; e >= 0; e--) {
var enemy = enemies[e];
if (bullet.intersects(enemy)) {
// Bullet hits enemy
enemy.takeDamage(bullet.damage);
bullet.destroy();
bullets.splice(b, 1);
bulletHit = true;
break;
}
}
}
// Check collisions and close combat between hero and enemies
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
var dx = hero.x - enemy.x;
var dy = hero.y - enemy.y;
var distance = Math.sqrt(dx * dx + dy * dy);
// Auto-attack when very close (melee range)
if (distance < 60 && !enemy.justAttacked) {
hero.attack(enemy);
enemy.justAttacked = true;
// Reset attack flag after short delay
LK.setTimeout(function () {
if (enemy && !enemy.destroyed) {
enemy.justAttacked = false;
}
}, 300);
} else if (hero.intersects(enemy)) {
// Take damage from collision
hero.takeDamage(enemy.damage);
enemy.destroy();
enemies.splice(i, 1);
continue;
}
// Remove enemies that are too far off screen
if (enemy.x < -200 || enemy.x > 2248 || enemy.y < -200 || enemy.y > 2932) {
enemy.destroy();
enemies.splice(i, 1);
}
}
// Update health bar
updateHealthBar();
scoreTxt.setText(LK.getScore());
}; ===================================================================
--- original.js
+++ change.js
@@ -449,64 +449,10 @@
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
- // Check if touch is in the lower left area for joystick
- if (x < 400 && y > 2332) {
- // Activate analog joystick
- isJoystickActive = true;
- joystickStartX = x;
- joystickStartY = y;
- joystickBase.x = x;
- joystickBase.y = y;
- joystickBase.visible = true;
- joystickKnob.x = x;
- joystickKnob.y = y;
- joystickKnob.visible = true;
- return;
- }
- // Check if touching an enemy to attack
- var attacked = false;
- var closestEnemy = null;
- var closestDistance = Infinity;
- // Find the closest enemy within attack range
- for (var i = 0; i < enemies.length; i++) {
- var enemy = enemies[i];
- var dx = enemy.x - x;
- var dy = enemy.y - y;
- var distance = Math.sqrt(dx * dx + dy * dy);
- // Increase attack range for better touch responsiveness
- if (distance < 120 && distance < closestDistance) {
- closestEnemy = enemy;
- closestDistance = distance;
- }
- }
- // Attack the closest enemy if found
- if (closestEnemy) {
- hero.updateWeapon(closestEnemy.x, closestEnemy.y);
- hero.attack(closestEnemy);
- // Flash the hero to show attack animation
- LK.effects.flashObject(hero, 0xFFFF00, 150);
- attacked = true;
- } else {
- // Shoot bullet towards touch position with rate limiting
- var currentTime = LK.ticks;
- if (currentTime - lastShootTime > 15) {
- // Limit shooting rate
- hero.updateWeapon(x, y);
- hero.shoot(x, y);
- lastShootTime = currentTime;
- attacked = true;
- }
- }
- // Show attack range indicator
- attackIndicator.x = x;
- attackIndicator.y = y;
- attackIndicator.visible = true;
- // If not attacking, make hero walk to position
- if (!attacked) {
- hero.walkTo(x, y);
- }
+ // Make hero walk to touch position
+ hero.walkTo(x, y);
};
game.up = function (x, y, obj) {
// Deactivate analog joystick
if (isJoystickActive) {
Ucan bomba. In-Game asset. 2d. High contrast. No shadows
Qanli iskelet. In-Game asset. 2d. High contrast. No shadows
Beyaz zirhli sovalye. In-Game asset. 2d. High contrast. No shadows
Iskeleten Elektirik buycusu. In-Game asset. 2d. High contrast. No shadows
Wiking boss. In-Game asset. 2d. High contrast. No shadows
Mavi tatli kucuk slime gozleri parildasin. In-Game asset. 2d. High contrast. No shadows
Yesil top halinde tukuruk. In-Game asset. 2d. High contrast. No shadows
Simsek topu. In-Game asset. 2d. High contrast. No shadows
Sandik. In-Game asset. 2d. High contrast. No shadows
Ağac. In-Game asset. 2d. High contrast. No shadows
Cim yesilik. In-Game asset. 2d. High contrast. No shadows
Kamp atesi. In-Game asset. 2d. High contrast. No shadows
Madeni para. In-Game asset. 2d. High contrast. No shadows
Bullet. In-Game asset. 2d. High contrast. No shadows
Lasergun. In-Game asset. 2d. High contrast. No shadows