User prompt
self.speed = -12;
User prompt
self.jumpPower = -250; self.jump = function () { if (self.onGround) { self.velocityY = self.jumpPower; self.onGround = false; } };
User prompt
function jump() { if (orb.y >= 1090) { orb.setVelocity(0, -100); // En hafif zıplama } }
User prompt
function jump() { if (orb.y >= 1090) { orb.setVelocity(0, -250); // Çok düşük zıplama } }
User prompt
function jump() { if (orb.y >= 1090) { orb.setVelocity(0, -700); // Daha yüksek zıplama } }
User prompt
Please fix the bug: 'LK.init is not a function' in or related to this line: 'LK.init({' Line Number: 13
User prompt
LK.init({ size: [720, 1280], gravity: [0, 2500], // Yerden çekim kuvveti backgroundColor: 0x111111, }); let ground = LK.add.shape({ shape: "box", width: 720, height: 40, x: 360, y: 1260, physics: "static", color: 0x333333, }); let orb = LK.add.shape({ shape: "circle", radius: 50, x: 360, y: 1200, color: 0x00ffff, physics: "dynamic", restitution: 0, // Sekme kapalı friction: 0.5, }); function jump() { // Sadece yerdeyken zıplama if (orb.y > 1150) { orb.setVelocity(0, -700); } } LK.onKeyDown("space", jump); LK.onPointerDown(jump); function spawnObstacle() { let obs = LK.add.shape({ shape: "box", width: 100, height: 30, x: 800, y: 1210, // Yere çok yakın, ama topun üstünden atlaması için biraz yukarıda color: 0xff4444, physics: "kinematic", }); obs.setVelocity(-250, 0); LK.onCollide(orb, obs, () => LK.scene.restart()); LK.wait(6, () => obs.destroy()); } LK.every(1.5, spawnObstacle); let score = 0; let scoreText = LK.add.text({ text: "Skor: 0", size: 45, x: 30, y: 60, anchorX: "left", color: 0xffffff, }); LK.every(1, () => { score++; scoreText.text = "Skor: " + score; });
User prompt
function spawnObstacle() { let obs = LK.add.shape({ shape: "box", width: 100, height: 30, x: 800, y: 1170, // Yere yakın engel yüksekliği color: 0xff4444, physics: "kinematic", }); obs.setVelocity(-250, 0); LK.onCollide(orb, obs, () => { LK.scene.restart(); }); LK.wait(6, () => obs.destroy()); }
User prompt
function spawnObstacle() { let obs = LK.add.shape({ shape: "box", width: 100, height: 30, x: 800, y: LK.random(1140, 1220), // Rastgele yükseklik color: 0xff4444, physics: "kinematic", }); obs.setVelocity(-250, 0); LK.onCollide(orb, obs, () => { LK.scene.restart(); // Çarpınca oyun biter }); LK.wait(6, () => obs.destroy()); }
User prompt
let obs = LK.add.shape({ shape: "box", width: 100, height: 30, x: 800, y: 1180, // AŞAĞI ALINDI color: 0xff4444, physics: "kinematic", });
User prompt
let orb = LK.add.shape({ shape: "circle", radius: 50, x: 360, y: 1100, // daha aşağıdan başlar color: 0x00ffff, physics: "dynamic", restitution: 0, friction: 0.5, density: 1, });
Code edit (1 edits merged)
Please save this source code
User prompt
Jump Orb Runner
Initial prompt
// Başlat LK.init({ size: [720, 1280], gravity: [0, 2200], backgroundColor: 0x111122, }); // Zemin let ground = LK.add.shape({ shape: "box", width: 720, height: 40, x: 360, y: 1260, physics: "static", color: 0x333333, }); // Top let orb = LK.add.shape({ shape: "circle", radius: 50, x: 360, y: 1000, color: 0x00ffff, physics: "dynamic", restitution: 0, // Sekme kapalı friction: 0.5, density: 1, }); // Zıplama fonksiyonu function jump() { // Yerdeyse zıplasın (fazla zıplamasın) if (orb.y > 950) { orb.setVelocity(0, -700); // Az zıplama } } // Kontroller LK.onKeyDown("space", jump); LK.onPointerDown(jump); // Engel örneği function spawnObstacle() { let obs = LK.add.shape({ shape: "box", width: 100, height: 30, x: 800, y: 1150, color: 0xff4444, physics: "kinematic", }); obs.setVelocity(-250, 0); LK.onCollide(orb, obs, () => { LK.scene.restart(); // Çarpınca oyun biter }); LK.wait(6, () => obs.destroy()); } LK.every(1.5, spawnObstacle); // Skor let score = 0; let scoreText = LK.add.text({ text: "Skor: 0", size: 45, x: 30, y: 60, anchorX: "left", color: 0xffffff, }); LK.every(1, () => { score++; scoreText.text = "Skor: " + score; });
/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 });
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});