User prompt
Göz bebekleri düşen nesneleri takip etsin
User prompt
Göz bebekleri etrafa bakınsın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Göz bebekleri düşöan takibini sil
User prompt
Kalkan süresi boyınca Göz bebekleri beyaz elipsin iiçinde dönmeli ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan süresi boyunca göz bebegi dönme animasyonu ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan aktifken düşmanı takip eden göz bebegi etkisini kaldır ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Olmamış ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan aktifken oyuncu siya gözbebekleri dönsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan aktifken oyuncu siyah göz bebekleri titresin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan aktif iken oyuncu siyah göz elipsleri daire şeklinde döner ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan aktifken oyuncu göz elipsleri döner ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan animasyonu aktifken oyuncu siyah elipsleri beyaz elipsin içinde döner ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Olmadı ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan elips şeklini çevir ve renksiz olsun ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Kalkan 4 saniye oluşan kalkan elip şeklinde saydam elips şeklinde ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyuncunun agız kısmına bir elips ekle
User prompt
Kalkan efecti olarak oyuncunun etrafında bir baloncuk oluşur ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyuncu ölüp geri geldikten sonra 3 saniye boyunca koruma kalkanına sahip olur ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Siyah elipsler herzaman oyuncunun üzerinde olmalı
User prompt
Oluşan elipsler kordineli şekilde beyaz elipsin içinde etrafa bakabilir ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oluşturulan elips gözler etrafa rastgele bakınsın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Game over yazısı oyuncu ölüp ekrandan fırlarken ortaya cıksın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Oyuncu için oluşturulan siyah elipsleri biraz büyült
User prompt
Oyuncu içün eklenen siyah elipsler bir göz gibi havuçları takip etsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Eger oyuncu 2. Mermiye degip fırlarken başka mermiye çarparsa canı gitmez ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Enemy = Container.expand(function () {
var self = Container.call(this);
// Create enemy visual using enemy image asset
var enemyBody = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 4.0,
scaleY: 4.0
});
// Create left leg
var leftLeg = self.attachAsset('enemyLeg', {
anchorX: 0.5,
anchorY: 0,
x: -80,
y: 200
});
// Create right leg
var rightLeg = self.attachAsset('enemyLeg', {
anchorX: 0.5,
anchorY: 0,
x: 160,
y: 200
});
self.speed = 3;
self.direction = 1;
self.shootTimer = 0;
self.shootInterval = 90; // Shoot every 1.5 seconds at 60fps
self.walkAnimationTimer = 0;
self.update = function () {
// Move horizontally
self.x += self.speed * self.direction;
// Bounce at screen edges
if (self.x <= 100 || self.x >= 1948) {
self.direction *= -1;
}
// Walking animation - alternate leg positions
self.walkAnimationTimer++;
if (self.walkAnimationTimer >= 15) {
// Change leg position every 15 frames
self.walkAnimationTimer = 0;
// Animate left leg with walking motion (horizontal and vertical)
tween(leftLeg, {
x: leftLeg.x === -80 ? -100 : -80,
y: leftLeg.y === 200 ? 180 : 200
}, {
duration: 200,
easing: tween.easeInOut
});
// Animate right leg with walking motion (opposite to left leg)
tween(rightLeg, {
x: rightLeg.x === 160 ? 180 : 160,
y: rightLeg.y === 200 ? 180 : 200
}, {
duration: 200,
easing: tween.easeInOut
});
}
// Shooting logic
self.shootTimer++;
if (self.shootTimer >= self.shootInterval) {
self.shootTimer = 0;
// Randomly choose projectile type
if (Math.random() > 0.5) {
// Create regular projectile
var projectile = new EnemyProjectile();
projectile.x = self.x;
projectile.y = self.y + 50;
enemyProjectiles.push(projectile);
game.addChild(projectile);
} else {
// Create new projectile type
var projectile2 = new EnemyProjectile2();
projectile2.x = self.x;
projectile2.y = self.y + 50;
enemyProjectiles2.push(projectile2);
game.addChild(projectile2);
}
// Play enemy shooting sound
LK.getSound('enemyShoot').play();
}
};
return self;
});
var EnemyProjectile = Container.expand(function () {
var self = Container.call(this);
var projectileBody = self.attachAsset('enemyProjectile', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2.0,
scaleY: 2.0
});
self.speed = 6;
self.update = function () {
self.y += self.speed;
};
return self;
});
var EnemyProjectile2 = Container.expand(function () {
var self = Container.call(this);
var projectileBody = self.attachAsset('enemyProjectile2', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 1.5,
scaleY: 1.5
});
self.speed = 4;
self.sideSpeed = 2;
self.direction = Math.random() > 0.5 ? 1 : -1;
self.update = function () {
self.y += self.speed;
self.x += self.sideSpeed * self.direction;
// Bounce off screen edges
if (self.x <= 0 || self.x >= 2048) {
self.direction *= -1;
}
};
return self;
});
var Particle = Container.expand(function () {
var self = Container.call(this);
var particleBody = self.attachAsset('smoke', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 0.2 + Math.random() * 0.3,
scaleY: 0.2 + Math.random() * 0.3
});
// Random particle properties
self.velocityX = (Math.random() - 0.5) * 8;
self.velocityY = -Math.random() * 6 - 2;
self.gravity = 0.2;
self.life = 60 + Math.random() * 40; // 1-1.5 seconds at 60fps
self.maxLife = self.life;
self.update = function () {
// Apply physics
self.x += self.velocityX;
self.y += self.velocityY;
self.velocityY += self.gravity;
// Fade out over time
self.life--;
self.alpha = self.life / self.maxLife;
// Remove when life is over
if (self.life <= 0) {
self.destroy();
// Remove from particles array
for (var p = particles.length - 1; p >= 0; p--) {
if (particles[p] === self) {
particles.splice(p, 1);
break;
}
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x8B4513
});
/****
* Game Code
****/
var backgroundImage = game.attachAsset('background', {
x: 0,
y: 0,
width: 2048,
height: 2732
});
// Add new background layer
var backgroundLayer = game.attachAsset('backgroundLayer', {
x: 0,
y: 0,
width: 2100,
height: 700
});
// Create ground terrain
var ground = game.attachAsset('ground', {
x: 0,
y: 2682,
// Position at bottom (2732 - 50 = 2682)
width: 2048,
height: 50
});
// Create and position player on the ground
var player = game.attachAsset('player', {
x: 2048 / 2,
// Center horizontally
y: 2682,
// Position touching the ground
scaleX: 1.0,
scaleY: 1.0,
anchorX: 0.5,
anchorY: 1.0
});
// Scale player to 3.0 using tween animation
tween(player, {
scaleX: 3.0,
scaleY: 3.0
}, {
duration: 500,
easing: tween.easeOut
});
// Create white eyes on the player
var leftEye = game.attachAsset('eyeWhite', {
x: player.x - 50,
y: player.y - 245,
anchorX: 0.5,
anchorY: 0.5
});
var rightEye = game.attachAsset('eyeWhite', {
x: player.x + 10,
y: player.y - 245,
anchorX: 0.5,
anchorY: 0.5
});
// Create black pupils inside the white eyes
var leftPupil = game.attachAsset('eye', {
x: player.x - 50,
y: player.y - 245,
anchorX: 0.5,
anchorY: 0.5
});
var rightPupil = game.attachAsset('eye', {
x: player.x + 10,
y: player.y - 245,
anchorX: 0.5,
anchorY: 0.5
});
// Variables for player movement
var playerSpeed = 8;
var targetX = player.x;
var isMoving = false;
var playerLives = 3;
var isShielded = false;
var shieldTimer = 0;
var shieldDuration = 120; // 2 seconds at 60fps
var isFlying = false; // Track if player is currently flying after being hit
// Enemy and projectile tracking
var enemy = null;
var enemyProjectiles = [];
var enemyProjectiles2 = [];
var particles = [];
// Create enemy at top of screen
enemy = game.addChild(new Enemy());
enemy.x = 1124; // Move slightly to the right
enemy.y = 450; // Moved up from previous position
// Touch/mouse controls for player movement
game.down = function (x, y, obj) {
// Set target position to touch/click location
targetX = x;
isMoving = true;
// Keep player within screen bounds
if (targetX < 0) targetX = 0;
if (targetX > 2048) targetX = 2048;
};
// Update player movement
game.update = function () {
if (isMoving) {
// Calculate distance to target
var distance = targetX - player.x;
// Move towards target
if (Math.abs(distance) > 5) {
if (distance > 0) {
player.x += playerSpeed;
} else {
player.x -= playerSpeed;
}
} else {
// Snap to target when close enough
player.x = targetX;
isMoving = false;
}
// Keep player within bounds
if (player.x < 0) player.x = 0;
if (player.x > 2048) player.x = 2048;
}
// Update shield system
if (isShielded) {
shieldTimer--;
// Flash player blue to indicate shield
if (shieldTimer % 20 < 10) {
player.tint = 0x00ffff;
} else {
player.tint = 0xffffff;
}
// Deactivate shield when timer expires
if (shieldTimer <= 0) {
isShielded = false;
player.tint = 0xffffff;
}
}
// Update eye positions to follow player
leftEye.x = player.x - 50;
leftEye.y = player.y - 245;
rightEye.x = player.x + 10;
rightEye.y = player.y - 245;
// Always update pupil base positions to follow player
var leftEyeCenterX = player.x - 50;
var leftEyeCenterY = player.y - 245;
var rightEyeCenterX = player.x + 10;
var rightEyeCenterY = player.y - 245;
// Make pupils track the enemy (carrot) position
if (enemy) {
// Calculate angles from eyes to enemy
var leftAngle = Math.atan2(enemy.y - leftEyeCenterY, enemy.x - leftEyeCenterX);
var rightAngle = Math.atan2(enemy.y - rightEyeCenterY, enemy.x - rightEyeCenterX);
// Calculate distance to enemy for smooth pupil movement
var leftDistanceToEnemy = Math.sqrt(Math.pow(enemy.x - leftEyeCenterX, 2) + Math.pow(enemy.y - leftEyeCenterY, 2));
var rightDistanceToEnemy = Math.sqrt(Math.pow(enemy.x - rightEyeCenterX, 2) + Math.pow(enemy.y - rightEyeCenterY, 2));
// Scale pupil movement based on distance (closer = more movement, further = less movement)
var maxPupilDistance = 15; // Maximum distance pupils can move from center
var leftPupilDistance = Math.min(maxPupilDistance, leftDistanceToEnemy / 30); // Scale factor
var rightPupilDistance = Math.min(maxPupilDistance, rightDistanceToEnemy / 30); // Scale factor
// Calculate target positions for smooth pupil movement
var leftTargetX = leftEyeCenterX + Math.cos(leftAngle) * leftPupilDistance;
var leftTargetY = leftEyeCenterY + Math.sin(leftAngle) * leftPupilDistance;
var rightTargetX = rightEyeCenterX + Math.cos(rightAngle) * rightPupilDistance;
var rightTargetY = rightEyeCenterY + Math.sin(rightAngle) * rightPupilDistance;
// Smoothly move pupils towards target positions using tween
tween(leftPupil, {
x: leftTargetX,
y: leftTargetY
}, {
duration: 150,
easing: tween.easeOut
});
tween(rightPupil, {
x: rightTargetX,
y: rightTargetY
}, {
duration: 150,
easing: tween.easeOut
});
} else {
// If no enemy, center the pupils on the player
leftPupil.x = leftEyeCenterX;
leftPupil.y = leftEyeCenterY;
rightPupil.x = rightEyeCenterX;
rightPupil.y = rightEyeCenterY;
}
// Update enemy projectiles
for (var i = enemyProjectiles.length - 1; i >= 0; i--) {
var projectile = enemyProjectiles[i];
// Remove projectiles that go off screen
if (projectile.y > 2732 + 50) {
projectile.destroy();
enemyProjectiles.splice(i, 1);
continue;
}
// Check collision with player
if (projectile.intersects(player)) {
// Award points when hit by enemy projectile
LK.setScore(LK.getScore() + 10);
// Play sound effect for first projectile hit
LK.getSound('enemyProjectileHit').play();
projectile.destroy();
enemyProjectiles.splice(i, 1);
}
}
// Update enemy projectiles type 2
for (var j = enemyProjectiles2.length - 1; j >= 0; j--) {
var projectile2 = enemyProjectiles2[j];
// Remove projectiles that go off screen
if (projectile2.y > 2732 + 50 || projectile2.x < -100 || projectile2.x > 2148) {
projectile2.destroy();
enemyProjectiles2.splice(j, 1);
continue;
}
// Check collision with player
if (projectile2.intersects(player) && !isShielded && !isFlying) {
// Play sound effect for second projectile hit
LK.getSound('enemyProjectile2Hit').play();
// Stop current player movement
isMoving = false;
// Set flying state to true
isFlying = true;
// Player flies off screen to the left while spinning
tween(player, {
x: -200,
y: player.y - 800,
rotation: Math.PI * 4
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
// Return player from right side after flying off
player.x = 2248;
player.y = 2682;
player.rotation = 0;
// Reset flying state
isFlying = false;
// Activate shield protection
isShielded = true;
shieldTimer = shieldDuration;
// Animate player returning to screen
tween(player, {
x: 2048 / 2
}, {
duration: 800,
easing: tween.easeOut
});
}
});
// Update eye positions during flight animation
tween(leftEye, {
x: -250,
y: player.y - 1045
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
leftEye.x = 2198;
leftEye.y = 2437;
tween(leftEye, {
x: 2048 / 2 - 50
}, {
duration: 800,
easing: tween.easeOut
});
}
});
tween(rightEye, {
x: -190,
y: player.y - 1045
}, {
duration: 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
rightEye.x = 2258;
rightEye.y = 2437;
tween(rightEye, {
x: 2048 / 2 + 10
}, {
duration: 800,
easing: tween.easeOut
});
}
});
// Pupils will be automatically positioned by the main update loop
// Create particle burst effect
for (var particleCount = 0; particleCount < 15; particleCount++) {
var particle = new Particle();
particle.x = player.x + (Math.random() - 0.5) * 50;
particle.y = player.y - 50 + (Math.random() - 0.5) * 50;
particles.push(particle);
game.addChild(particle);
}
// Create smoke and flame effects
for (var smokeCount = 0; smokeCount < 8; smokeCount++) {
var smoke = game.attachAsset('smoke', {
x: player.x + (Math.random() - 0.5) * 200,
y: player.y - 100 + (Math.random() - 0.5) * 100,
anchorX: 0.5,
anchorY: 0.5,
alpha: 0.8
});
// Animate smoke rising and fading
tween(smoke, {
y: smoke.y - 200 - Math.random() * 100,
alpha: 0,
scaleX: 2 + Math.random(),
scaleY: 2 + Math.random()
}, {
duration: 2000 + Math.random() * 1000,
easing: tween.easeOut,
onFinish: function onFinish() {
smoke.destroy();
}
});
}
for (var flameCount = 0; flameCount < 6; flameCount++) {
var flame = game.attachAsset('flame', {
x: player.x + (Math.random() - 0.5) * 150,
y: player.y - 50 + (Math.random() - 0.5) * 80,
anchorX: 0.5,
anchorY: 0.5,
alpha: 1
});
// Animate flames flickering and rising
tween(flame, {
y: flame.y - 150 - Math.random() * 50,
alpha: 0,
scaleX: 1.5 + Math.random() * 0.5,
scaleY: 1.5 + Math.random() * 0.5
}, {
duration: 1500 + Math.random() * 500,
easing: tween.easeOut,
onFinish: function onFinish() {
flame.destroy();
}
});
}
// Create fire animation effect on player
tween(player, {
tint: 0xff4500
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(player, {
tint: 0xff0000
}, {
duration: 200,
easing: tween.easeInOut,
onFinish: function onFinish() {
tween(player, {
tint: 0xffffff
}, {
duration: 300,
easing: tween.easeOut
});
}
});
}
});
// Reduce player lives
playerLives--;
if (playerLives <= 0) {
// Show game over when no lives left
LK.showGameOver();
}
projectile2.destroy();
enemyProjectiles2.splice(j, 1);
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -304,15 +304,15 @@
leftEye.x = player.x - 50;
leftEye.y = player.y - 245;
rightEye.x = player.x + 10;
rightEye.y = player.y - 245;
+ // Always update pupil base positions to follow player
+ var leftEyeCenterX = player.x - 50;
+ var leftEyeCenterY = player.y - 245;
+ var rightEyeCenterX = player.x + 10;
+ var rightEyeCenterY = player.y - 245;
// Make pupils track the enemy (carrot) position
if (enemy) {
- // Calculate direction from each eye to the enemy
- var leftEyeCenterX = player.x - 50;
- var leftEyeCenterY = player.y - 245;
- var rightEyeCenterX = player.x + 10;
- var rightEyeCenterY = player.y - 245;
// Calculate angles from eyes to enemy
var leftAngle = Math.atan2(enemy.y - leftEyeCenterY, enemy.x - leftEyeCenterX);
var rightAngle = Math.atan2(enemy.y - rightEyeCenterY, enemy.x - rightEyeCenterX);
// Calculate distance to enemy for smooth pupil movement
@@ -342,23 +342,13 @@
duration: 150,
easing: tween.easeOut
});
} else {
- // If no enemy, smoothly center the pupils
- tween(leftPupil, {
- x: player.x - 50,
- y: player.y - 245
- }, {
- duration: 300,
- easing: tween.easeOut
- });
- tween(rightPupil, {
- x: player.x + 10,
- y: player.y - 245
- }, {
- duration: 300,
- easing: tween.easeOut
- });
+ // If no enemy, center the pupils on the player
+ leftPupil.x = leftEyeCenterX;
+ leftPupil.y = leftEyeCenterY;
+ rightPupil.x = rightEyeCenterX;
+ rightPupil.y = rightEyeCenterY;
}
// Update enemy projectiles
for (var i = enemyProjectiles.length - 1; i >= 0; i--) {
var projectile = enemyProjectiles[i];
@@ -456,42 +446,9 @@
easing: tween.easeOut
});
}
});
- tween(leftPupil, {
- x: -250,
- y: player.y - 1045
- }, {
- duration: 1000,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- leftPupil.x = 2198;
- leftPupil.y = 2437;
- tween(leftPupil, {
- x: 2048 / 2 - 50
- }, {
- duration: 800,
- easing: tween.easeOut
- });
- }
- });
- tween(rightPupil, {
- x: -190,
- y: player.y - 1045
- }, {
- duration: 1000,
- easing: tween.easeOut,
- onFinish: function onFinish() {
- rightPupil.x = 2258;
- rightPupil.y = 2437;
- tween(rightPupil, {
- x: 2048 / 2 + 10
- }, {
- duration: 800,
- easing: tween.easeOut
- });
- }
- });
+ // Pupils will be automatically positioned by the main update loop
// Create particle burst effect
for (var particleCount = 0; particleCount < 15; particleCount++) {
var particle = new Particle();
particle.x = player.x + (Math.random() - 0.5) * 50;
3d köstebek. In-Game asset. 2d. High contrast. No shadows
Elinde havuç olan kızgın bir çiftçi. Karakter ayakkabısı siyah
Havuç. In-Game asset. 2d. High contrast. No shadows
Bomba. In-Game asset. 2d. High contrast. No shadows
Alev. In-Game asset. 2d. High contrast. No shadows
Agız. In-Game asset. 2d. High contrast. No shadows
Kalp 3d. In-Game asset. 2d. High contrast. No shadows