User prompt
düşman karakterler daha fazla katlanarak hızlanmalı ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
düşman karakterler gittikçe hızlanmalıdır ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
powerUp'ın özelliği karateri hızlandırmak olacaktır. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
düşmanların bize bakması gerekiyor
User prompt
punch efektinin karaktere göre yön değiştirmesi lazım
User prompt
arkasından düşman geliyor ama karakter arkasında dönemiyor
User prompt
karakter sağa sola gidebilmeli ve zıplayabilmeli
User prompt
karakter ve düşmanlar ekranın en altında dursun
Code edit (1 edits merged)
Please save this source code
User prompt
Street Fighter Hero
Initial prompt
I want dan the man style game
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 1.0 }); self.health = 50; self.maxHealth = 50; self.moveSpeed = 1; self.attackCooldown = 0; self.isAttacking = false; self.direction = 1; // 1 for right, -1 for left self.attackRange = 120; self.update = function () { // Move towards hero var distanceToHero = Math.abs(self.x - hero.x); if (distanceToHero > self.attackRange) { if (self.x < hero.x) { self.x += self.moveSpeed; self.direction = 1; } else { self.x -= self.moveSpeed; self.direction = -1; } } else { // Attack hero if (self.attackCooldown <= 0) { self.attack(); self.attackCooldown = 90; } } if (self.attackCooldown > 0) { self.attackCooldown--; } // Keep enemy in bounds if (self.x < 0) { self.x = 0; } if (self.x > 2048) { self.x = 2048; } }; self.attack = function () { self.isAttacking = true; // Flash enemy when attacking enemyGraphics.tint = 0xFF0000; LK.setTimeout(function () { enemyGraphics.tint = 0xFFFFFF; }, 200); // Check if hero is in range and deal damage var distanceToHero = Math.abs(self.x - hero.x); if (distanceToHero <= self.attackRange) { hero.takeDamage(10); } LK.setTimeout(function () { self.isAttacking = false; }, 300); }; self.takeDamage = function (damage) { self.health -= damage; LK.effects.flashObject(self, 0xFFFFFF, 200); if (self.health <= 0) { LK.setScore(LK.getScore() + 100); return true; // Enemy is dead } return false; }; return self; }); var HealthPack = Container.expand(function () { var self = Container.call(this); var healthGraphics = self.attachAsset('healthPack', { anchorX: 0.5, anchorY: 0.5 }); self.bobOffset = 0; self.update = function () { // Bobbing animation self.bobOffset += 0.1; self.y += Math.sin(self.bobOffset) * 0.5; // Check collision with hero if (self.intersects(hero)) { hero.heal(30); LK.getSound('powerUpSound').play(); LK.setScore(LK.getScore() + 50); return true; // Mark for removal } // Remove if off screen if (self.x < -100 || self.x > 2148) { return true; } return false; }; return self; }); var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.attachAsset('hero', { anchorX: 0.5, anchorY: 1.0 }); self.health = 100; self.maxHealth = 100; self.isAttacking = false; self.attackCooldown = 0; self.invulnerable = false; self.invulnerableTime = 0; self.moveSpeed = 2; self.punch = function () { if (self.attackCooldown <= 0 && !self.isAttacking) { self.isAttacking = true; self.attackCooldown = 30; // Create punch effect var punchEffect = new PunchEffect(); punchEffect.x = self.x + 80; punchEffect.y = self.y - 80; game.addChild(punchEffect); punchEffects.push(punchEffect); LK.getSound('punch').play(); // Flash hero white briefly heroGraphics.tint = 0xFFFFFF; LK.setTimeout(function () { heroGraphics.tint = 0xFFFFFF; }, 100); } }; self.uppercut = function () { if (self.attackCooldown <= 0 && !self.isAttacking) { self.isAttacking = true; self.attackCooldown = 45; // Create uppercut effect var punchEffect = new PunchEffect(); punchEffect.x = self.x + 80; punchEffect.y = self.y - 120; game.addChild(punchEffect); punchEffects.push(punchEffect); LK.getSound('punch').play(); // Jump effect tween(self, { y: self.y - 50 }, { duration: 200, easing: tween.easeOut }); tween(self, { y: self.y }, { duration: 200, easing: tween.easeIn }); } }; self.lowKick = function () { if (self.attackCooldown <= 0 && !self.isAttacking) { self.isAttacking = true; self.attackCooldown = 35; // Create kick effect var punchEffect = new PunchEffect(); punchEffect.x = self.x + 90; punchEffect.y = self.y - 40; game.addChild(punchEffect); punchEffects.push(punchEffect); LK.getSound('punch').play(); } }; self.takeDamage = function (damage) { if (!self.invulnerable) { self.health -= damage; self.invulnerable = true; self.invulnerableTime = 60; // Flash red when taking damage LK.effects.flashObject(self, 0xFF0000, 500); if (self.health <= 0) { self.health = 0; LK.showGameOver(); } } }; self.heal = function (amount) { self.health = Math.min(self.health + amount, self.maxHealth); }; self.update = function () { // Auto-scroll forward self.x += self.moveSpeed; // Update cooldowns if (self.attackCooldown > 0) { self.attackCooldown--; } else { self.isAttacking = false; } if (self.invulnerableTime > 0) { self.invulnerableTime--; if (self.invulnerableTime <= 0) { self.invulnerable = false; } } // Keep hero in bounds if (self.x > 2048 - 100) { self.x = 2048 - 100; } if (self.x < 100) { self.x = 100; } }; return self; }); var PowerUp = Container.expand(function () { var self = Container.call(this); var powerGraphics = self.attachAsset('powerUp', { anchorX: 0.5, anchorY: 0.5 }); self.bobOffset = 0; self.rotationSpeed = 0.05; self.update = function () { // Rotating and bobbing animation self.bobOffset += 0.1; self.y += Math.sin(self.bobOffset) * 0.5; powerGraphics.rotation += self.rotationSpeed; // Check collision with hero if (self.intersects(hero)) { hero.invulnerable = true; hero.invulnerableTime = 300; LK.getSound('powerUpSound').play(); LK.setScore(LK.getScore() + 200); return true; // Mark for removal } // Remove if off screen if (self.x < -100 || self.x > 2148) { return true; } return false; }; return self; }); var PunchEffect = Container.expand(function () { var self = Container.call(this); var punchGraphics = self.attachAsset('punch', { anchorX: 0.5, anchorY: 0.5 }); self.lifetime = 20; self.update = function () { self.lifetime--; punchGraphics.alpha = self.lifetime / 20; if (self.lifetime <= 0) { return true; // Mark for removal } return false; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x34495E }); /**** * Game Code ****/ var hero; var enemies = []; var punchEffects = []; var healthPacks = []; var powerUps = []; var enemySpawnTimer = 0; var powerUpSpawnTimer = 0; var scrollOffset = 0; var lastGestureTime = 0; var gestureThreshold = 10; // Create background var background = game.attachAsset('background', { anchorX: 0, anchorY: 0, x: 0, y: 0 }); // Create hero hero = game.addChild(new Hero()); hero.x = 200; hero.y = 2732; // Position at bottom of screen // Create UI elements var healthBar = new Text2('Health: 100', { size: 60, fill: 0x27AE60 }); healthBar.anchor.set(0, 0); LK.gui.topLeft.addChild(healthBar); var scoreText = new Text2('Score: 0', { size: 60, fill: 0xFFFFFF }); scoreText.anchor.set(0.5, 0); LK.gui.top.addChild(scoreText); var comboText = new Text2('', { size: 80, fill: 0xF39C12 }); comboText.anchor.set(0.5, 0); comboText.y = 100; LK.gui.top.addChild(comboText); // Game variables var comboCount = 0; var comboTimer = 0; var lastHitTime = 0; // Touch controls var touchStartX = 0; var touchStartY = 0; var touchStartTime = 0; var isHolding = false; var holdTimer = 0; game.down = function (x, y, obj) { touchStartX = x; touchStartY = y; touchStartTime = LK.ticks; isHolding = true; holdTimer = 0; }; game.up = function (x, y, obj) { if (!isHolding) return; var deltaX = x - touchStartX; var deltaY = y - touchStartY; var holdDuration = LK.ticks - touchStartTime; isHolding = false; // Check for hold gesture (power attack) if (holdDuration > 30) { hero.uppercut(); return; } // Check for swipe gestures if (Math.abs(deltaX) > gestureThreshold || Math.abs(deltaY) > gestureThreshold) { if (Math.abs(deltaY) > Math.abs(deltaX)) { if (deltaY < -gestureThreshold) { // Swipe up - uppercut hero.uppercut(); } else if (deltaY > gestureThreshold) { // Swipe down - low kick hero.lowKick(); } } } else { // Tap - punch hero.punch(); } }; // Spawn enemies function spawnEnemy() { var enemy = new Enemy(); // Random spawn position (left or right side) if (Math.random() > 0.5) { enemy.x = -100; } else { enemy.x = 2148; } enemy.y = 2732; // Position at bottom of screen enemies.push(enemy); game.addChild(enemy); } // Spawn health pack function spawnHealthPack() { var healthPack = new HealthPack(); healthPack.x = Math.random() * 1800 + 124; healthPack.y = 2650; // Position closer to bottom of screen healthPacks.push(healthPack); game.addChild(healthPack); } // Spawn power up function spawnPowerUp() { var powerUp = new PowerUp(); powerUp.x = Math.random() * 1800 + 124; powerUp.y = 2600; // Position closer to bottom of screen powerUps.push(powerUp); game.addChild(powerUp); } // Update combo system function updateCombo() { if (comboTimer > 0) { comboTimer--; if (comboTimer <= 0) { comboCount = 0; comboText.setText(''); } } } // Check punch collisions function checkPunchCollisions() { for (var i = punchEffects.length - 1; i >= 0; i--) { var punch = punchEffects[i]; for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (punch.intersects(enemy)) { if (enemy.takeDamage(25)) { // Enemy defeated enemy.destroy(); enemies.splice(j, 1); // Update combo comboCount++; comboTimer = 180; if (comboCount > 1) { comboText.setText('COMBO x' + comboCount); LK.setScore(LK.getScore() + comboCount * 50); } LK.getSound('enemyHit').play(); } break; } } } } // Start background music LK.playMusic('bgMusic'); // Main game loop game.update = function () { // Update combo system updateCombo(); // Spawn enemies enemySpawnTimer++; if (enemySpawnTimer >= 180) { spawnEnemy(); enemySpawnTimer = 0; } // Spawn power-ups occasionally powerUpSpawnTimer++; if (powerUpSpawnTimer >= 600) { if (Math.random() > 0.7) { spawnHealthPack(); } else { spawnPowerUp(); } powerUpSpawnTimer = 0; } // Update punch effects for (var i = punchEffects.length - 1; i >= 0; i--) { if (punchEffects[i].update()) { punchEffects[i].destroy(); punchEffects.splice(i, 1); } } // Update enemies for (var i = enemies.length - 1; i >= 0; i--) { // Remove enemies that are too far off screen if (enemies[i].x < -200 || enemies[i].x > 2248) { enemies[i].destroy(); enemies.splice(i, 1); } } // Update health packs for (var i = healthPacks.length - 1; i >= 0; i--) { if (healthPacks[i].update()) { healthPacks[i].destroy(); healthPacks.splice(i, 1); } } // Update power ups for (var i = powerUps.length - 1; i >= 0; i--) { if (powerUps[i].update()) { powerUps[i].destroy(); powerUps.splice(i, 1); } } // Check punch collisions checkPunchCollisions(); // Update UI healthBar.setText('Health: ' + hero.health); scoreText.setText('Score: ' + LK.getScore()); // Win condition if (LK.getScore() >= 5000) { LK.showYouWin(); } // Increase difficulty over time if (LK.ticks % 1800 === 0) { enemySpawnTimer = Math.max(60, enemySpawnTimer - 10); } };
===================================================================
--- original.js
+++ change.js
@@ -288,9 +288,9 @@
});
// Create hero
hero = game.addChild(new Hero());
hero.x = 200;
-hero.y = 2200;
+hero.y = 2732; // Position at bottom of screen
// Create UI elements
var healthBar = new Text2('Health: 100', {
size: 60,
fill: 0x27AE60
@@ -362,25 +362,25 @@
enemy.x = -100;
} else {
enemy.x = 2148;
}
- enemy.y = 2200;
+ enemy.y = 2732; // Position at bottom of screen
enemies.push(enemy);
game.addChild(enemy);
}
// Spawn health pack
function spawnHealthPack() {
var healthPack = new HealthPack();
healthPack.x = Math.random() * 1800 + 124;
- healthPack.y = 2100;
+ healthPack.y = 2650; // Position closer to bottom of screen
healthPacks.push(healthPack);
game.addChild(healthPack);
}
// Spawn power up
function spawnPowerUp() {
var powerUp = new PowerUp();
powerUp.x = Math.random() * 1800 + 124;
- powerUp.y = 2050;
+ powerUp.y = 2600; // Position closer to bottom of screen
powerUps.push(powerUp);
game.addChild(powerUp);
}
// Update combo system
dan the man oyunundakş karakterden esinlenerek çizildi . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
koca dişli kocaman kulaklarında ki kocaman altın küpelerle kaslı vücudundaki koca göğüslerindeki priceng'i ile yeşil çirkin ork. elinde de balta. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
bir meteor ve meteorun arkasından çıkan asit. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
sağlık çantası. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
arka planda sağ üst köşede güneş var. arka planda oyunun üst kısmında soldan sağa hareket eden bulutlar var. ve arka planda kocaman dağlar var ve üst kısımları karlarla kaplı. arka planda oyuncuya yakın ağaç ve çimler bulunmakta. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
mavi enerji içeceği. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat