User prompt
undertale resmi "yapraklarımın hepsi öldürmez"desin (harfler titreşerek) ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
oyuna 12 canlı hp barı ekle her düşman 4 düşürsün
User prompt
oyuncu 35 saniyeyi geçtikten sonra undertale resminin yerine flow resmini koy
User prompt
oyun süresini sınırsız yap
User prompt
puan sistemi hayatta kalma süresi olsun
User prompt
undertale resminin kalitesini arttır,küçül yukarı taşı
User prompt
undertale resmini kullan
User prompt
attack box veya background kullanma
User prompt
attack box yerine background resmini arka planda kullan
User prompt
undertale resmi ingilizce konuşsun
User prompt
undertale resmi soru sorup konuşsun
User prompt
undertale resmini yukarı kaydır
User prompt
undertale resmini kullan
User prompt
attack box u kullanma
User prompt
attack box resmini arka planda kullan
User prompt
undertale resminden düşmanlar çıksın
User prompt
düşmanların herbirinin hızı ilerledikçe artsın
User prompt
düşmanların hızı artsın
User prompt
düşmanlar kalbi öldürsün
User prompt
düşmanlar sonsuza kadar kalbi takip etmesin fakat öldürsün
User prompt
düşmanla hızlansın
User prompt
düşmanlar kalbe yakınlaştıklarında ıskalayabilsin
User prompt
düşmanlar yavaşça kalbe doğru gelsin
User prompt
undertale müziği ekle
Code edit (1 edits merged)
Please save this source code
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Enemy class: Moves in a pattern, can be destroyed var Enemy = Container.expand(function () { var self = Container.call(this); // Attach enemy asset (green ellipse, 100x100) var enemyGfx = self.attachAsset('enemyEllipse', { anchorX: 0.5, anchorY: 0.5 }); // Set size for collision self.width = enemyGfx.width; self.height = enemyGfx.height; // Enemy type: 0 = straight, 1 = zigzag, 2 = fast self.type = 0; self.speed = 6; self.zigzagDir = 1; self.zigzagStep = 0; // For tracking last position for off-screen detection self.lastY = self.y; // For tracking intersection with hero self.lastIntersecting = false; // For zigzag self.baseX = 0; // Set movement pattern self.setType = function (type) { self.type = type; if (type === 0) { self.speed = 6 + Math.floor(LK.getScore() / 10); } else if (type === 1) { self.speed = 5 + Math.floor(LK.getScore() / 10); self.zigzagDir = Math.random() > 0.5 ? 1 : -1; self.zigzagStep = 0; self.baseX = self.x; } else if (type === 2) { self.speed = 10 + Math.floor(LK.getScore() / 10); } }; // Update movement self.update = function () { if (self.type === 0) { // Straight down self.y += self.speed; } else if (self.type === 1) { // Zigzag self.y += self.speed; self.zigzagStep += 1; self.x = self.baseX + Math.sin(self.zigzagStep / 10) * 120 * self.zigzagDir; } else if (self.type === 2) { // Fast straight self.y += self.speed; } }; return self; }); // Hero class: Player's character, draggable var Hero = Container.expand(function () { var self = Container.call(this); // Attach hero asset (red box, 120x120) var heroGfx = self.attachAsset('heroBox', { anchorX: 0.5, anchorY: 0.5 }); // Set size for collision self.width = heroGfx.width; self.height = heroGfx.height; // For possible future use self.update = function () {}; // Down event for possible feedback self.down = function (x, y, obj) {}; // Up event for possible feedback self.up = function (x, y, obj) {}; return self; }); // Player attack class: short range, destroys enemy on contact var HeroAttack = Container.expand(function () { var self = Container.call(this); // Attach attack asset (yellow box, 80x80) var atkGfx = self.attachAsset('attackBox', { anchorX: 0.5, anchorY: 0.5 }); self.width = atkGfx.width; self.height = atkGfx.height; // For tracking self.lastIntersecting = false; // Attack duration self.lifetime = 18; // ~0.3s at 60fps self.update = function () { self.lifetime--; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181c2c }); /**** * Game Code ****/ // --- Game Variables --- // Tween plugin for enemy/hero animations // --- Asset Initialization --- var hero = null; var enemies = []; var attacks = []; var dragNode = null; var lastHeroIntersecting = false; var spawnInterval = 60; // frames between spawns, will decrease var spawnTick = 0; var scoreTxt = null; var canAttack = true; var attackCooldown = 24; // frames var attackCooldownTick = 0; var winScore = 20; // --- Score Display --- scoreTxt = new Text2('0', { size: 120, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // --- Hero Initialization --- hero = new Hero(); hero.x = 2048 / 2; hero.y = 2732 - 350; game.addChild(hero); // --- Touch/Drag Controls --- function handleMove(x, y, obj) { if (dragNode) { // Clamp hero inside game area (with margin) var margin = 80; var nx = Math.max(margin, Math.min(2048 - margin, x)); var ny = Math.max(300, Math.min(2732 - margin, y)); dragNode.x = nx; dragNode.y = ny; } } game.move = handleMove; game.down = function (x, y, obj) { // Only allow drag if touch is on hero var dx = x - hero.x; var dy = y - hero.y; var dist = Math.sqrt(dx * dx + dy * dy); if (dist < hero.width / 1.2) { dragNode = hero; } }; game.up = function (x, y, obj) { dragNode = null; }; // --- Attack on Tap (anywhere except top 200px) --- game.tap = function (x, y, obj) { if (y > 200 && canAttack) { spawnAttack(); } }; // Since LK does not have tap, simulate with up event if not dragging game.up = function (x, y, obj) { if (!dragNode && y > 200 && canAttack) { spawnAttack(); } dragNode = null; }; // --- Attack Logic --- function spawnAttack() { // Only one attack at a time if (!canAttack) return; canAttack = false; attackCooldownTick = attackCooldown; var atk = new HeroAttack(); atk.x = hero.x; atk.y = hero.y - hero.height / 2 - atk.height / 2; attacks.push(atk); game.addChild(atk); // Animate attack (scale up then fade) atk.scaleX = 0.7; atk.scaleY = 0.7; tween(atk, { scaleX: 1.2, scaleY: 1.2 }, { duration: 120, easing: tween.easeOut }); tween(atk, { alpha: 0 }, { duration: 180, easing: tween.linear, onFinish: function onFinish() {} }); } // --- Enemy Spawning --- function spawnEnemy() { var enemy = new Enemy(); // Random x, avoid edges var margin = 120; enemy.x = margin + Math.random() * (2048 - 2 * margin); enemy.y = -100; // Random type, more types as score increases var type = 0; var s = LK.getScore(); if (s < 5) { type = 0; } else if (s < 12) { type = Math.random() < 0.7 ? 0 : 1; } else { var r = Math.random(); if (r < 0.5) type = 0;else if (r < 0.8) type = 1;else type = 2; } enemy.setType(type); enemies.push(enemy); game.addChild(enemy); } // --- Main Game Update --- game.update = function () { // --- Attack cooldown --- if (!canAttack) { attackCooldownTick--; if (attackCooldownTick <= 0) { canAttack = true; } } // --- Spawn enemies --- spawnTick++; var s = LK.getScore(); // Decrease interval as score increases var minInterval = 24; spawnInterval = Math.max(minInterval, 60 - Math.floor(s / 2) * 4); if (spawnTick >= spawnInterval) { spawnTick = 0; spawnEnemy(); } // --- Update enemies --- for (var i = enemies.length - 1; i >= 0; i--) { var enemy = enemies[i]; enemy.update(); // Off-screen detection if (enemy.lastY < 2732 + 100 && enemy.y >= 2732 + 100) { // Enemy left screen, destroy enemy.destroy(); enemies.splice(i, 1); continue; } enemy.lastY = enemy.y; // Collision with hero var currIntersect = enemy.intersects(hero); if (!enemy.lastIntersecting && currIntersect) { // Hit! Game over LK.effects.flashScreen(0xff0000, 800); LK.showGameOver(); return; } enemy.lastIntersecting = currIntersect; } // --- Update attacks --- for (var j = attacks.length - 1; j >= 0; j--) { var atk = attacks[j]; atk.update(); // Remove if expired if (atk.lifetime <= 0) { atk.destroy(); attacks.splice(j, 1); continue; } // Check collision with enemies for (var k = enemies.length - 1; k >= 0; k--) { var enemy = enemies[k]; var currAtkIntersect = atk.intersects(enemy); if (!atk.lastIntersecting && currAtkIntersect) { // Destroy enemy enemy.destroy(); enemies.splice(k, 1); // Score up LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); // Win check if (LK.getScore() >= winScore) { LK.effects.flashScreen(0x00ff00, 800); LK.showYouWin(); return; } // Flash effect on attack LK.effects.flashObject(atk, 0xffff00, 200); // Remove attack (one hit per attack) atk.destroy(); attacks.splice(j, 1); break; } atk.lastIntersecting = currAtkIntersect; } } }; // --- Prevent elements in top left 100x100 (menu area) --- // --- End of Game Code ---
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Enemy class: Moves in a pattern, can be destroyed
var Enemy = Container.expand(function () {
var self = Container.call(this);
// Attach enemy asset (green ellipse, 100x100)
var enemyGfx = self.attachAsset('enemyEllipse', {
anchorX: 0.5,
anchorY: 0.5
});
// Set size for collision
self.width = enemyGfx.width;
self.height = enemyGfx.height;
// Enemy type: 0 = straight, 1 = zigzag, 2 = fast
self.type = 0;
self.speed = 6;
self.zigzagDir = 1;
self.zigzagStep = 0;
// For tracking last position for off-screen detection
self.lastY = self.y;
// For tracking intersection with hero
self.lastIntersecting = false;
// For zigzag
self.baseX = 0;
// Set movement pattern
self.setType = function (type) {
self.type = type;
if (type === 0) {
self.speed = 6 + Math.floor(LK.getScore() / 10);
} else if (type === 1) {
self.speed = 5 + Math.floor(LK.getScore() / 10);
self.zigzagDir = Math.random() > 0.5 ? 1 : -1;
self.zigzagStep = 0;
self.baseX = self.x;
} else if (type === 2) {
self.speed = 10 + Math.floor(LK.getScore() / 10);
}
};
// Update movement
self.update = function () {
if (self.type === 0) {
// Straight down
self.y += self.speed;
} else if (self.type === 1) {
// Zigzag
self.y += self.speed;
self.zigzagStep += 1;
self.x = self.baseX + Math.sin(self.zigzagStep / 10) * 120 * self.zigzagDir;
} else if (self.type === 2) {
// Fast straight
self.y += self.speed;
}
};
return self;
});
// Hero class: Player's character, draggable
var Hero = Container.expand(function () {
var self = Container.call(this);
// Attach hero asset (red box, 120x120)
var heroGfx = self.attachAsset('heroBox', {
anchorX: 0.5,
anchorY: 0.5
});
// Set size for collision
self.width = heroGfx.width;
self.height = heroGfx.height;
// For possible future use
self.update = function () {};
// Down event for possible feedback
self.down = function (x, y, obj) {};
// Up event for possible feedback
self.up = function (x, y, obj) {};
return self;
});
// Player attack class: short range, destroys enemy on contact
var HeroAttack = Container.expand(function () {
var self = Container.call(this);
// Attach attack asset (yellow box, 80x80)
var atkGfx = self.attachAsset('attackBox', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = atkGfx.width;
self.height = atkGfx.height;
// For tracking
self.lastIntersecting = false;
// Attack duration
self.lifetime = 18; // ~0.3s at 60fps
self.update = function () {
self.lifetime--;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x181c2c
});
/****
* Game Code
****/
// --- Game Variables ---
// Tween plugin for enemy/hero animations
// --- Asset Initialization ---
var hero = null;
var enemies = [];
var attacks = [];
var dragNode = null;
var lastHeroIntersecting = false;
var spawnInterval = 60; // frames between spawns, will decrease
var spawnTick = 0;
var scoreTxt = null;
var canAttack = true;
var attackCooldown = 24; // frames
var attackCooldownTick = 0;
var winScore = 20;
// --- Score Display ---
scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// --- Hero Initialization ---
hero = new Hero();
hero.x = 2048 / 2;
hero.y = 2732 - 350;
game.addChild(hero);
// --- Touch/Drag Controls ---
function handleMove(x, y, obj) {
if (dragNode) {
// Clamp hero inside game area (with margin)
var margin = 80;
var nx = Math.max(margin, Math.min(2048 - margin, x));
var ny = Math.max(300, Math.min(2732 - margin, y));
dragNode.x = nx;
dragNode.y = ny;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
// Only allow drag if touch is on hero
var dx = x - hero.x;
var dy = y - hero.y;
var dist = Math.sqrt(dx * dx + dy * dy);
if (dist < hero.width / 1.2) {
dragNode = hero;
}
};
game.up = function (x, y, obj) {
dragNode = null;
};
// --- Attack on Tap (anywhere except top 200px) ---
game.tap = function (x, y, obj) {
if (y > 200 && canAttack) {
spawnAttack();
}
};
// Since LK does not have tap, simulate with up event if not dragging
game.up = function (x, y, obj) {
if (!dragNode && y > 200 && canAttack) {
spawnAttack();
}
dragNode = null;
};
// --- Attack Logic ---
function spawnAttack() {
// Only one attack at a time
if (!canAttack) return;
canAttack = false;
attackCooldownTick = attackCooldown;
var atk = new HeroAttack();
atk.x = hero.x;
atk.y = hero.y - hero.height / 2 - atk.height / 2;
attacks.push(atk);
game.addChild(atk);
// Animate attack (scale up then fade)
atk.scaleX = 0.7;
atk.scaleY = 0.7;
tween(atk, {
scaleX: 1.2,
scaleY: 1.2
}, {
duration: 120,
easing: tween.easeOut
});
tween(atk, {
alpha: 0
}, {
duration: 180,
easing: tween.linear,
onFinish: function onFinish() {}
});
}
// --- Enemy Spawning ---
function spawnEnemy() {
var enemy = new Enemy();
// Random x, avoid edges
var margin = 120;
enemy.x = margin + Math.random() * (2048 - 2 * margin);
enemy.y = -100;
// Random type, more types as score increases
var type = 0;
var s = LK.getScore();
if (s < 5) {
type = 0;
} else if (s < 12) {
type = Math.random() < 0.7 ? 0 : 1;
} else {
var r = Math.random();
if (r < 0.5) type = 0;else if (r < 0.8) type = 1;else type = 2;
}
enemy.setType(type);
enemies.push(enemy);
game.addChild(enemy);
}
// --- Main Game Update ---
game.update = function () {
// --- Attack cooldown ---
if (!canAttack) {
attackCooldownTick--;
if (attackCooldownTick <= 0) {
canAttack = true;
}
}
// --- Spawn enemies ---
spawnTick++;
var s = LK.getScore();
// Decrease interval as score increases
var minInterval = 24;
spawnInterval = Math.max(minInterval, 60 - Math.floor(s / 2) * 4);
if (spawnTick >= spawnInterval) {
spawnTick = 0;
spawnEnemy();
}
// --- Update enemies ---
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
enemy.update();
// Off-screen detection
if (enemy.lastY < 2732 + 100 && enemy.y >= 2732 + 100) {
// Enemy left screen, destroy
enemy.destroy();
enemies.splice(i, 1);
continue;
}
enemy.lastY = enemy.y;
// Collision with hero
var currIntersect = enemy.intersects(hero);
if (!enemy.lastIntersecting && currIntersect) {
// Hit! Game over
LK.effects.flashScreen(0xff0000, 800);
LK.showGameOver();
return;
}
enemy.lastIntersecting = currIntersect;
}
// --- Update attacks ---
for (var j = attacks.length - 1; j >= 0; j--) {
var atk = attacks[j];
atk.update();
// Remove if expired
if (atk.lifetime <= 0) {
atk.destroy();
attacks.splice(j, 1);
continue;
}
// Check collision with enemies
for (var k = enemies.length - 1; k >= 0; k--) {
var enemy = enemies[k];
var currAtkIntersect = atk.intersects(enemy);
if (!atk.lastIntersecting && currAtkIntersect) {
// Destroy enemy
enemy.destroy();
enemies.splice(k, 1);
// Score up
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
// Win check
if (LK.getScore() >= winScore) {
LK.effects.flashScreen(0x00ff00, 800);
LK.showYouWin();
return;
}
// Flash effect on attack
LK.effects.flashObject(atk, 0xffff00, 200);
// Remove attack (one hit per attack)
atk.destroy();
attacks.splice(j, 1);
break;
}
atk.lastIntersecting = currAtkIntersect;
}
}
};
// --- Prevent elements in top left 100x100 (menu area) ---
// --- End of Game Code ---
kalbi kırmızı yap. In-Game asset. 2d. High contrast. No shadows. bu kalbi kırmızı yap
undertale oyunundaki flowey karakterini yap. In-Game asset. 2d. High contrast. No shadows
bu resmi yaprağa çevir rengi beyaz olsun . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
undertale flowy character angry. In-Game asset. 2d. High contrast. No shadows. undertale game