User prompt
MARİO İSE SPAGETTİ ARASIN
User prompt
OYUNA Bİ CANAVAR OLARAK LUİGİYİ EKLE
User prompt
Please fix the bug: 'TypeError: tween.to is not a function' in or related to this line: 'tween.to(self, 0.5, {' Line Number: 75 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Please fix the bug: 'storage.getItem is not a function' in or related to this line: 'if (storage.getItem('achievement_' + achievement.id)) {' Line Number: 297 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
oyunda başarım olsun
User prompt
ejderha daha yavaş olsun
User prompt
ADD 1 MINUTE 20 SECONDS TO THE GAME
User prompt
ADD 1 MINUTE 20 SECONDS TO THE GAME
User prompt
ADD A 250 POINT HEALTH BAR
Code edit (1 edits merged)
Please save this source code
User prompt
Dragon's Treasure Escape
Initial prompt
MAKE ME A GAME ABOUT ESCAPE FROM THE DRAGON AND LET IT BE IN MARAD AND WE WILL BE A TREASURE HUNTER
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Dragon = Container.expand(function () {
var self = Container.call(this);
var dragonGraphics = self.attachAsset('dragon', {
anchorX: 0.5,
anchorY: 0.5
});
self.baseSpeed = 3;
self.currentSpeed = self.baseSpeed;
self.fireTimer = 0;
self.fireInterval = 120; // 2 seconds initially
self.update = function () {
// Follow player
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
self.x += dx / distance * self.currentSpeed;
self.y += dy / distance * self.currentSpeed;
}
// Fire breathing timer
self.fireTimer++;
if (self.fireTimer >= self.fireInterval) {
self.breatheFire();
self.fireTimer = 0;
}
// Adjust difficulty based on score
var difficulty = Math.floor(score / 10);
self.currentSpeed = self.baseSpeed + difficulty * 0.5;
self.fireInterval = Math.max(60, 120 - difficulty * 10);
};
self.breatheFire = function () {
var fireball = new Fireball();
fireball.x = self.x;
fireball.y = self.y;
// Aim towards player
var dx = player.x - self.x;
var dy = player.y - self.y;
var distance = Math.sqrt(dx * dx + dy * dy);
fireball.directionX = dx / distance;
fireball.directionY = dy / distance;
fireballs.push(fireball);
game.addChild(fireball);
LK.getSound('fire').play();
};
return self;
});
var Fireball = Container.expand(function () {
var self = Container.call(this);
var fireballGraphics = self.attachAsset('fireball', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.directionX = 0;
self.directionY = 0;
self.lifetime = 300; // 5 seconds
self.update = function () {
self.x += self.directionX * self.speed;
self.y += self.directionY * self.speed;
fireballGraphics.rotation += 0.2;
fireballGraphics.alpha = Math.sin(LK.ticks * 0.5) * 0.3 + 0.7;
self.lifetime--;
if (self.lifetime <= 0) {
self.shouldDestroy = true;
}
// Check bounds
if (self.x < -100 || self.x > 2148 || self.y < -100 || self.y > 2832) {
self.shouldDestroy = true;
}
};
return self;
});
var Gem = Container.expand(function () {
var self = Container.call(this);
var gemGraphics = self.attachAsset('gem', {
anchorX: 0.5,
anchorY: 0.5
});
self.points = 25;
self.floatOffset = Math.random() * Math.PI * 2;
self.update = function () {
gemGraphics.y = Math.sin(LK.ticks * 0.15 + self.floatOffset) * 3;
gemGraphics.rotation += 0.05;
gemGraphics.scaleX = Math.sin(LK.ticks * 0.1 + self.floatOffset) * 0.2 + 1;
gemGraphics.scaleY = Math.sin(LK.ticks * 0.1 + self.floatOffset) * 0.2 + 1;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 8;
self.invulnerable = false;
self.invulnerabilityTime = 0;
self.speedBoost = false;
self.speedBoostTime = 0;
self.update = function () {
if (self.invulnerabilityTime > 0) {
self.invulnerabilityTime--;
playerGraphics.alpha = Math.sin(LK.ticks * 0.3) * 0.5 + 0.5;
if (self.invulnerabilityTime <= 0) {
self.invulnerable = false;
playerGraphics.alpha = 1;
}
}
if (self.speedBoostTime > 0) {
self.speedBoostTime--;
if (self.speedBoostTime <= 0) {
self.speedBoost = false;
playerGraphics.tint = 0xFFFFFF;
}
}
};
self.activateInvulnerability = function () {
self.invulnerable = true;
self.invulnerabilityTime = 120; // 2 seconds at 60fps
};
self.activateSpeedBoost = function () {
self.speedBoost = true;
self.speedBoostTime = 300; // 5 seconds at 60fps
playerGraphics.tint = 0x00FFFF;
};
return self;
});
var PowerUp = Container.expand(function () {
var self = Container.call(this);
var powerupGraphics = self.attachAsset('powerup', {
anchorX: 0.5,
anchorY: 0.5
});
self.type = Math.random() < 0.5 ? 'speed' : 'invulnerable';
self.floatOffset = Math.random() * Math.PI * 2;
if (self.type === 'invulnerable') {
powerupGraphics.tint = 0xFFD700;
}
self.update = function () {
powerupGraphics.y = Math.sin(LK.ticks * 0.2 + self.floatOffset) * 8;
powerupGraphics.rotation += 0.1;
powerupGraphics.alpha = Math.sin(LK.ticks * 0.3) * 0.3 + 0.7;
};
return self;
});
var Treasure = Container.expand(function () {
var self = Container.call(this);
var treasureGraphics = self.attachAsset('treasure', {
anchorX: 0.5,
anchorY: 0.5
});
self.points = 10;
self.floatOffset = Math.random() * Math.PI * 2;
self.update = function () {
treasureGraphics.y = Math.sin(LK.ticks * 0.1 + self.floatOffset) * 5;
treasureGraphics.rotation += 0.02;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x8B4513
});
/****
* Game Code
****/
game.setBackgroundColor(0xDEB887);
// Game variables
var score = 0;
var health = 250;
var maxHealth = 250;
var treasures = [];
var gems = [];
var powerups = [];
var fireballs = [];
var treasureSpawnTimer = 0;
var gemSpawnTimer = 0;
var powerupSpawnTimer = 0;
// Create player
var player = game.addChild(new Player());
player.x = 1024;
player.y = 1366;
// Create dragon
var dragon = game.addChild(new Dragon());
dragon.x = 200;
dragon.y = 200;
// UI Elements
var scoreTxt = new Text2('Score: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var healthTxt = new Text2('Health: 250/250', {
size: 60,
fill: 0x00FF00
});
healthTxt.anchor.set(0, 0);
healthTxt.x = 120;
healthTxt.y = 20;
LK.gui.addChild(healthTxt);
var instructionTxt = new Text2('Tap to move! Collect treasures, avoid the dragon!', {
size: 50,
fill: 0xFFFFFF
});
instructionTxt.anchor.set(0.5, 1);
LK.gui.bottom.addChild(instructionTxt);
// Game logic functions
function spawnTreasure() {
var treasure = new Treasure();
treasure.x = Math.random() * 1800 + 124;
treasure.y = Math.random() * 2400 + 166;
treasures.push(treasure);
game.addChild(treasure);
}
function spawnGem() {
var gem = new Gem();
gem.x = Math.random() * 1800 + 124;
gem.y = Math.random() * 2400 + 166;
gems.push(gem);
game.addChild(gem);
}
function spawnPowerUp() {
var powerup = new PowerUp();
powerup.x = Math.random() * 1800 + 124;
powerup.y = Math.random() * 2400 + 166;
powerups.push(powerup);
game.addChild(powerup);
}
function updateScore(points) {
score += points;
scoreTxt.setText('Score: ' + score);
LK.setScore(score);
}
function updateHealth(damage) {
health = Math.max(0, health - damage);
healthTxt.setText('Health: ' + health + '/' + maxHealth);
// Change color based on health percentage
var healthPercent = health / maxHealth;
if (healthPercent > 0.6) {
healthTxt.fill = 0x00FF00; // Green
} else if (healthPercent > 0.3) {
healthTxt.fill = 0xFFFF00; // Yellow
} else {
healthTxt.fill = 0xFF0000; // Red
}
if (health <= 0) {
LK.effects.flashScreen(0xFF0000, 1000);
LK.showGameOver();
}
}
// Touch controls
var targetX = player.x;
var targetY = player.y;
game.down = function (x, y, obj) {
targetX = x;
targetY = y;
};
game.move = function (x, y, obj) {
targetX = x;
targetY = y;
};
// Game update loop
game.update = function () {
// Move player towards target
var dx = targetX - player.x;
var dy = targetY - player.y;
var distance = Math.sqrt(dx * dx + dy * dy);
if (distance > 5) {
var speed = player.speedBoost ? player.speed * 1.5 : player.speed;
player.x += dx / distance * speed;
player.y += dy / distance * speed;
}
// Keep player in bounds
player.x = Math.max(40, Math.min(2008, player.x));
player.y = Math.max(40, Math.min(2692, player.y));
// Spawn treasures
treasureSpawnTimer++;
if (treasureSpawnTimer >= 90) {
// Every 1.5 seconds
spawnTreasure();
treasureSpawnTimer = 0;
}
// Spawn gems
gemSpawnTimer++;
if (gemSpawnTimer >= 180) {
// Every 3 seconds
spawnGem();
gemSpawnTimer = 0;
}
// Spawn power-ups
powerupSpawnTimer++;
if (powerupSpawnTimer >= 600) {
// Every 10 seconds
spawnPowerUp();
powerupSpawnTimer = 0;
}
// Check treasure collection
for (var i = treasures.length - 1; i >= 0; i--) {
var treasure = treasures[i];
if (player.intersects(treasure)) {
updateScore(treasure.points);
LK.effects.flashObject(treasure, 0xFFFFFF, 300);
treasure.destroy();
treasures.splice(i, 1);
LK.getSound('collect').play();
}
}
// Check gem collection
for (var i = gems.length - 1; i >= 0; i--) {
var gem = gems[i];
if (player.intersects(gem)) {
updateScore(gem.points);
LK.effects.flashObject(gem, 0xFFFFFF, 300);
gem.destroy();
gems.splice(i, 1);
LK.getSound('collect').play();
}
}
// Check power-up collection
for (var i = powerups.length - 1; i >= 0; i--) {
var powerup = powerups[i];
if (player.intersects(powerup)) {
if (powerup.type === 'speed') {
player.activateSpeedBoost();
} else if (powerup.type === 'invulnerable') {
player.activateInvulnerability();
}
LK.effects.flashObject(powerup, 0xFFFFFF, 300);
powerup.destroy();
powerups.splice(i, 1);
LK.getSound('powerup').play();
}
}
// Check dragon collision
if (!player.invulnerable && player.intersects(dragon)) {
if (!player.lastDragonHit) {
updateHealth(50);
player.activateInvulnerability();
LK.effects.flashScreen(0xFF0000, 500);
player.lastDragonHit = true;
}
} else {
player.lastDragonHit = false;
}
// Check fireball collisions
for (var i = fireballs.length - 1; i >= 0; i--) {
var fireball = fireballs[i];
if (fireball.shouldDestroy) {
fireball.destroy();
fireballs.splice(i, 1);
continue;
}
if (!player.invulnerable && player.intersects(fireball)) {
if (!fireball.hasHit) {
updateHealth(25);
player.activateInvulnerability();
LK.effects.flashScreen(0xFF0000, 300);
fireball.hasHit = true;
fireball.shouldDestroy = true;
}
}
}
// Win condition
if (score >= 500) {
LK.showYouWin();
}
};
// Start background music
LK.playMusic('desert');
// Initial treasures
for (var i = 0; i < 3; i++) {
spawnTreasure();
} ===================================================================
--- original.js
+++ change.js
@@ -178,8 +178,10 @@
****/
game.setBackgroundColor(0xDEB887);
// Game variables
var score = 0;
+var health = 250;
+var maxHealth = 250;
var treasures = [];
var gems = [];
var powerups = [];
var fireballs = [];
@@ -200,8 +202,16 @@
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
+var healthTxt = new Text2('Health: 250/250', {
+ size: 60,
+ fill: 0x00FF00
+});
+healthTxt.anchor.set(0, 0);
+healthTxt.x = 120;
+healthTxt.y = 20;
+LK.gui.addChild(healthTxt);
var instructionTxt = new Text2('Tap to move! Collect treasures, avoid the dragon!', {
size: 50,
fill: 0xFFFFFF
});
@@ -233,8 +243,25 @@
score += points;
scoreTxt.setText('Score: ' + score);
LK.setScore(score);
}
+function updateHealth(damage) {
+ health = Math.max(0, health - damage);
+ healthTxt.setText('Health: ' + health + '/' + maxHealth);
+ // Change color based on health percentage
+ var healthPercent = health / maxHealth;
+ if (healthPercent > 0.6) {
+ healthTxt.fill = 0x00FF00; // Green
+ } else if (healthPercent > 0.3) {
+ healthTxt.fill = 0xFFFF00; // Yellow
+ } else {
+ healthTxt.fill = 0xFF0000; // Red
+ }
+ if (health <= 0) {
+ LK.effects.flashScreen(0xFF0000, 1000);
+ LK.showGameOver();
+ }
+}
// Touch controls
var targetX = player.x;
var targetY = player.y;
game.down = function (x, y, obj) {
@@ -318,10 +345,16 @@
}
}
// Check dragon collision
if (!player.invulnerable && player.intersects(dragon)) {
- LK.effects.flashScreen(0xFF0000, 1000);
- LK.showGameOver();
+ if (!player.lastDragonHit) {
+ updateHealth(50);
+ player.activateInvulnerability();
+ LK.effects.flashScreen(0xFF0000, 500);
+ player.lastDragonHit = true;
+ }
+ } else {
+ player.lastDragonHit = false;
}
// Check fireball collisions
for (var i = fireballs.length - 1; i >= 0; i--) {
var fireball = fireballs[i];
@@ -330,10 +363,15 @@
fireballs.splice(i, 1);
continue;
}
if (!player.invulnerable && player.intersects(fireball)) {
- LK.effects.flashScreen(0xFF0000, 1000);
- LK.showGameOver();
+ if (!fireball.hasHit) {
+ updateHealth(25);
+ player.activateInvulnerability();
+ LK.effects.flashScreen(0xFF0000, 300);
+ fireball.hasHit = true;
+ fireball.shouldDestroy = true;
+ }
}
}
// Win condition
if (score >= 500) {
CREATE THIS IMAGE. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
MAKE THIS PICTURE LIKE A FIREBALL. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
DESIGN THIS PICTURE AS AN ENERGY DRINK. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
LUİGİ KARAKTERİNİ OLUŞTUR. In-Game asset. 2d. High contrast. No shadows
KORKAK BİR ADAM. In-Game asset. 2d. High contrast. No shadows
BÜYÜK BİR EJDER. In-Game asset. 2d. High contrast. No shadows
MARİO. In-Game asset. 2d. High contrast. No shadows
SPAGHETTİ. In-Game asset. 2d. High contrast. No shadows
sonic. In-Game asset. 2d. High contrast. No shadows
silah. In-Game asset. 2d. High contrast. No shadows
sonic altını. In-Game asset. 2d. High contrast. No shadows