User prompt
Ekranda ki yazıyı kaldır
User prompt
Kalp emojisi birazcık küçük yap
User prompt
Kalp emojisi ekle
User prompt
3 tane can olsun istiyorum yapar mısın ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Point kalsın satın alma shoplar istiyorum can falan ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Siz yapar mısınız
User prompt
Shop ekleyin dedi
User prompt
Please fix the bug: 'storage.get is not a function' in or related to this line: 'var lastScore = storage.get("lastScore");' Line Number: 187 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Hata var düzeltirirmisin
User prompt
Shop ekleyin öldükten sonra point kalsın satın almak için lazım
User prompt
Can silah dilci
User prompt
Peki bir shop ekler misiniz
Code edit (1 edits merged)
Please save this source code
User prompt
Face Dash: Smile Runner
User prompt
Please continue polishing my design document.
Initial prompt
In a dark, mysterious world, elite fighters from different lands battle in an ancient arena. Each fighter has their own backstory, unique abilities, and combat style.
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var facekit = LK.import("@upit/facekit.v1"); /**** * Classes ****/ // Player character controlled by face var FaceChar = Container.expand(function () { var self = Container.call(this); var _char = self.attachAsset('faceChar', { anchorX: 0.5, anchorY: 0.5 }); // For possible future effects self.flash = function () { LK.effects.flashObject(self, 0xffffff, 300); }; return self; }); // Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obs = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); // Speed is set on creation self.speed = 0; self.update = function () { self.y += self.speed; }; return self; }); // Point collectible class var PointCollectible = Container.expand(function () { var self = Container.call(this); var pt = self.attachAsset('point', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 0; self.update = function () { self.y += self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x181c2c }); /**** * Game Code ****/ // Point collectible: yellow circle // Obstacle: red rectangle // Character: main player controlled by face // Game area dimensions var GAME_W = 2048; var GAME_H = 2732; // Player character var faceChar = new FaceChar(); game.addChild(faceChar); // Initial position: bottom center, 400px from bottom faceChar.x = GAME_W / 2; faceChar.y = GAME_H - 400; // Arrays for obstacles and points var obstacles = []; var points = []; // Score display var scoreTxt = new Text2('0', { size: 120, fill: 0xFFF700 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // For keeping track of score var score = 0; // For obstacle/point spawn timing var lastObstacleTick = 0; var lastPointTick = 0; // For difficulty scaling var minObstacleInterval = 45; // ticks var minPointInterval = 60; // ticks var obstacleSpeed = 12; // px per frame, increases over time // For collision state var lastCollided = false; // For point collection state var lastPointCollided = {}; // Facekit smoothing var lastFaceX = faceChar.x; var lastFaceY = faceChar.y; // Main update loop game.update = function () { // --- Facekit control --- // Use mouthCenter for X/Y, clamp to game area var fx = facekit.mouthCenter && typeof facekit.mouthCenter.x === "number" ? facekit.mouthCenter.x : GAME_W / 2; var fy = facekit.mouthCenter && typeof facekit.mouthCenter.y === "number" ? facekit.mouthCenter.y : GAME_H - 400; // Optionally, if mouth is open, move faster (boost) var boost = facekit.mouthOpen ? 1.7 : 1.0; // Smooth movement (lerp) lastFaceX += (fx - lastFaceX) * 0.25 * boost; lastFaceY += (fy - lastFaceY) * 0.25 * boost; // Clamp to bounds (keep inside screen) var charW = faceChar.width; var charH = faceChar.height; var minX = charW / 2 + 40; var maxX = GAME_W - charW / 2 - 40; var minY = charH / 2 + 120; var maxY = GAME_H - charH / 2 - 40; faceChar.x = Math.max(minX, Math.min(maxX, lastFaceX)); faceChar.y = Math.max(minY, Math.min(maxY, lastFaceY)); // --- Spawn obstacles --- if (LK.ticks - lastObstacleTick > minObstacleInterval + Math.floor(Math.random() * 40)) { var obs = new Obstacle(); // Random X, avoid leftmost 100px (menu) var obsW = obs.width; var obsX = 100 + obsW / 2 + Math.random() * (GAME_W - obsW - 200); obs.x = obsX; obs.y = -obs.height / 2; obs.speed = obstacleSpeed + Math.random() * 3; obstacles.push(obs); game.addChild(obs); lastObstacleTick = LK.ticks; } // --- Spawn points --- if (LK.ticks - lastPointTick > minPointInterval + Math.floor(Math.random() * 60)) { var pt = new PointCollectible(); var ptW = pt.width; var ptX = 100 + ptW / 2 + Math.random() * (GAME_W - ptW - 200); pt.x = ptX; pt.y = -pt.height / 2; pt.speed = obstacleSpeed * 0.8 + Math.random() * 2; points.push(pt); game.addChild(pt); lastPointTick = LK.ticks; } // --- Move obstacles, check collision --- var collided = false; for (var i = obstacles.length - 1; i >= 0; i--) { var o = obstacles[i]; o.update(); // Off screen if (o.y - o.height / 2 > GAME_H + 100) { o.destroy(); obstacles.splice(i, 1); continue; } // Collision with player if (faceChar.intersects(o)) { collided = true; } } // --- Move points, check collection --- for (var j = points.length - 1; j >= 0; j--) { var p = points[j]; p.update(); // Off screen if (p.y - p.height / 2 > GAME_H + 100) { p.destroy(); points.splice(j, 1); continue; } // Collision with player var pointId = p._lkid || p._id || j; if (!lastPointCollided[pointId]) { if (faceChar.intersects(p)) { // Collect point score += 1; LK.setScore(score); scoreTxt.setText(score); // Flash effect LK.effects.flashObject(p, 0xffffff, 200); p.destroy(); points.splice(j, 1); lastPointCollided[pointId] = true; continue; } } } // --- Collision state transitions --- if (!lastCollided && collided) { // Just collided: game over LK.effects.flashScreen(0xff0000, 800); faceChar.flash(); LK.showGameOver(); return; } lastCollided = collided; // --- Difficulty scaling --- if (LK.ticks % 300 === 0 && obstacleSpeed < 32) { obstacleSpeed += 1.2; if (minObstacleInterval > 20) minObstacleInterval -= 2; if (minPointInterval > 30) minPointInterval -= 2; } }; // --- Instructions text --- var instrTxt = new Text2("Move your head & mouth to dodge obstacles!\nOpen mouth for speed boost.\nCollect yellow points!", { size: 70, fill: 0xFFFFFF }); instrTxt.anchor.set(0.5, 0); LK.gui.top.addChild(instrTxt); instrTxt.y = 160; instrTxt.x = 0; // --- Center score text --- scoreTxt.x = 0; scoreTxt.y = 20; // --- Clean up on game over --- game.on('destroy', function () { obstacles = []; points = []; lastPointCollided = {}; lastCollided = false; lastFaceX = GAME_W / 2; lastFaceY = GAME_H - 400; score = 0; LK.setScore(0); scoreTxt.setText('0'); });
===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,226 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+var facekit = LK.import("@upit/facekit.v1");
+
+/****
+* Classes
+****/
+// Player character controlled by face
+var FaceChar = Container.expand(function () {
+ var self = Container.call(this);
+ var _char = self.attachAsset('faceChar', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // For possible future effects
+ self.flash = function () {
+ LK.effects.flashObject(self, 0xffffff, 300);
+ };
+ return self;
+});
+// Obstacle class
+var Obstacle = Container.expand(function () {
+ var self = Container.call(this);
+ var obs = self.attachAsset('obstacle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ // Speed is set on creation
+ self.speed = 0;
+ self.update = function () {
+ self.y += self.speed;
+ };
+ return self;
+});
+// Point collectible class
+var PointCollectible = Container.expand(function () {
+ var self = Container.call(this);
+ var pt = self.attachAsset('point', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 0;
+ self.update = function () {
+ self.y += self.speed;
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
+ backgroundColor: 0x181c2c
+});
+
+/****
+* Game Code
+****/
+// Point collectible: yellow circle
+// Obstacle: red rectangle
+// Character: main player controlled by face
+// Game area dimensions
+var GAME_W = 2048;
+var GAME_H = 2732;
+// Player character
+var faceChar = new FaceChar();
+game.addChild(faceChar);
+// Initial position: bottom center, 400px from bottom
+faceChar.x = GAME_W / 2;
+faceChar.y = GAME_H - 400;
+// Arrays for obstacles and points
+var obstacles = [];
+var points = [];
+// Score display
+var scoreTxt = new Text2('0', {
+ size: 120,
+ fill: 0xFFF700
+});
+scoreTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(scoreTxt);
+// For keeping track of score
+var score = 0;
+// For obstacle/point spawn timing
+var lastObstacleTick = 0;
+var lastPointTick = 0;
+// For difficulty scaling
+var minObstacleInterval = 45; // ticks
+var minPointInterval = 60; // ticks
+var obstacleSpeed = 12; // px per frame, increases over time
+// For collision state
+var lastCollided = false;
+// For point collection state
+var lastPointCollided = {};
+// Facekit smoothing
+var lastFaceX = faceChar.x;
+var lastFaceY = faceChar.y;
+// Main update loop
+game.update = function () {
+ // --- Facekit control ---
+ // Use mouthCenter for X/Y, clamp to game area
+ var fx = facekit.mouthCenter && typeof facekit.mouthCenter.x === "number" ? facekit.mouthCenter.x : GAME_W / 2;
+ var fy = facekit.mouthCenter && typeof facekit.mouthCenter.y === "number" ? facekit.mouthCenter.y : GAME_H - 400;
+ // Optionally, if mouth is open, move faster (boost)
+ var boost = facekit.mouthOpen ? 1.7 : 1.0;
+ // Smooth movement (lerp)
+ lastFaceX += (fx - lastFaceX) * 0.25 * boost;
+ lastFaceY += (fy - lastFaceY) * 0.25 * boost;
+ // Clamp to bounds (keep inside screen)
+ var charW = faceChar.width;
+ var charH = faceChar.height;
+ var minX = charW / 2 + 40;
+ var maxX = GAME_W - charW / 2 - 40;
+ var minY = charH / 2 + 120;
+ var maxY = GAME_H - charH / 2 - 40;
+ faceChar.x = Math.max(minX, Math.min(maxX, lastFaceX));
+ faceChar.y = Math.max(minY, Math.min(maxY, lastFaceY));
+ // --- Spawn obstacles ---
+ if (LK.ticks - lastObstacleTick > minObstacleInterval + Math.floor(Math.random() * 40)) {
+ var obs = new Obstacle();
+ // Random X, avoid leftmost 100px (menu)
+ var obsW = obs.width;
+ var obsX = 100 + obsW / 2 + Math.random() * (GAME_W - obsW - 200);
+ obs.x = obsX;
+ obs.y = -obs.height / 2;
+ obs.speed = obstacleSpeed + Math.random() * 3;
+ obstacles.push(obs);
+ game.addChild(obs);
+ lastObstacleTick = LK.ticks;
+ }
+ // --- Spawn points ---
+ if (LK.ticks - lastPointTick > minPointInterval + Math.floor(Math.random() * 60)) {
+ var pt = new PointCollectible();
+ var ptW = pt.width;
+ var ptX = 100 + ptW / 2 + Math.random() * (GAME_W - ptW - 200);
+ pt.x = ptX;
+ pt.y = -pt.height / 2;
+ pt.speed = obstacleSpeed * 0.8 + Math.random() * 2;
+ points.push(pt);
+ game.addChild(pt);
+ lastPointTick = LK.ticks;
+ }
+ // --- Move obstacles, check collision ---
+ var collided = false;
+ for (var i = obstacles.length - 1; i >= 0; i--) {
+ var o = obstacles[i];
+ o.update();
+ // Off screen
+ if (o.y - o.height / 2 > GAME_H + 100) {
+ o.destroy();
+ obstacles.splice(i, 1);
+ continue;
+ }
+ // Collision with player
+ if (faceChar.intersects(o)) {
+ collided = true;
+ }
+ }
+ // --- Move points, check collection ---
+ for (var j = points.length - 1; j >= 0; j--) {
+ var p = points[j];
+ p.update();
+ // Off screen
+ if (p.y - p.height / 2 > GAME_H + 100) {
+ p.destroy();
+ points.splice(j, 1);
+ continue;
+ }
+ // Collision with player
+ var pointId = p._lkid || p._id || j;
+ if (!lastPointCollided[pointId]) {
+ if (faceChar.intersects(p)) {
+ // Collect point
+ score += 1;
+ LK.setScore(score);
+ scoreTxt.setText(score);
+ // Flash effect
+ LK.effects.flashObject(p, 0xffffff, 200);
+ p.destroy();
+ points.splice(j, 1);
+ lastPointCollided[pointId] = true;
+ continue;
+ }
+ }
+ }
+ // --- Collision state transitions ---
+ if (!lastCollided && collided) {
+ // Just collided: game over
+ LK.effects.flashScreen(0xff0000, 800);
+ faceChar.flash();
+ LK.showGameOver();
+ return;
+ }
+ lastCollided = collided;
+ // --- Difficulty scaling ---
+ if (LK.ticks % 300 === 0 && obstacleSpeed < 32) {
+ obstacleSpeed += 1.2;
+ if (minObstacleInterval > 20) minObstacleInterval -= 2;
+ if (minPointInterval > 30) minPointInterval -= 2;
+ }
+};
+// --- Instructions text ---
+var instrTxt = new Text2("Move your head & mouth to dodge obstacles!\nOpen mouth for speed boost.\nCollect yellow points!", {
+ size: 70,
+ fill: 0xFFFFFF
+});
+instrTxt.anchor.set(0.5, 0);
+LK.gui.top.addChild(instrTxt);
+instrTxt.y = 160;
+instrTxt.x = 0;
+// --- Center score text ---
+scoreTxt.x = 0;
+scoreTxt.y = 20;
+// --- Clean up on game over ---
+game.on('destroy', function () {
+ obstacles = [];
+ points = [];
+ lastPointCollided = {};
+ lastCollided = false;
+ lastFaceX = GAME_W / 2;
+ lastFaceY = GAME_H - 400;
+ score = 0;
+ LK.setScore(0);
+ scoreTxt.setText('0');
});
\ No newline at end of file
A tiny bomb. In-Game asset. 2d. High contrast. No shadows
Gold coin. In-Game asset. 2d. High contrast. No shadows
Mermi. In-Game asset. 2d. High contrast. No shadows
Kırmızı kalp. In-Game asset. 2d. High contrast. No shadows
Silah. In-Game asset. 2d. High contrast. No shadows
faceChar. In-Game asset. 2d. High contrast. No shadows