User prompt
arkaplan müziğini sürekli çaldır
User prompt
eğer kırmızı duvara deydikten sonra puanımız 0 olursa veya altı olursa oyunu kaybedeliöm
User prompt
zehirli duvara temas edersek oyunu kaybetmiyelim ve 20 puan kaybedelim ve oyunun başında karakter seçelim
User prompt
eğer kırmızı duvara temas edersek -20 puan alalım
User prompt
eğer puan alırsak ses2 çalsın
User prompt
eğer kırmızıyı atlarsak ses1
User prompt
100 puan olunca oyunu kazanalım
User prompt
oyunu kybedersek ses1 çalsın
User prompt
simge1 ve simge2 duvarların üstünde olsun
User prompt
normal duvarlarda da delik olsun ve normal duvarda simge2 zehirli duvarda simge1 gözüksün
User prompt
zehirsiz duvara değersek puanımız 5 artsın
User prompt
eğer bir zehirsiz bir duvara temas edersek temas etiğimiz duvar yok olsun
User prompt
zehirli duvarların yanları veya ortasında açık olsun açıklıklar en başta büyük olsun ama puan artıkça küçülsün ama karakterin boyunda daha fazla küçülmesin
Code edit (1 edits merged)
Please save this source code
User prompt
Wall Runner
Initial prompt
bir zemin olsun önden duvarlar gelsin ama duvarlar iki tür olsun biri zehirli biri normal normalin içinden geçersek puan kazanalım zehirliden geçersek kaybedelim ve puan yukarı solda olsun
/****
* Classes
****/
var Character = Container.expand(function () {
var self = Container.call(this);
var characterGraphics = self.attachAsset('character', {
anchorX: 0.5,
anchorY: 1
});
return self;
});
var Wall = Container.expand(function (wallType) {
var self = Container.call(this);
// Store wall type (normal or poison)
self.wallType = wallType || 'normal';
self.speed = 8;
self.passed = false;
if (self.wallType === 'poison') {
// For poison walls, create openings that get smaller with score
// Base gap width starts at 300, decreases by 10 for each point, minimum 100 (slightly larger than character)
var currentScore = LK.getScore();
self.gapWidth = Math.max(100, 300 - currentScore * 10);
// Randomly choose gap position: left side, center, or right side
var gapType = Math.floor(Math.random() * 3); // 0=left, 1=center, 2=right
if (gapType === 0) {
// Left side opening
self.gapPosition = 50;
} else if (gapType === 1) {
// Center opening
self.gapPosition = (2048 - self.gapWidth) / 2;
} else {
// Right side opening
self.gapPosition = 2048 - self.gapWidth - 50;
}
// Create wall graphics based on type
var wallAsset = 'poisonWall';
// Create left wall segment (if gap is not at the far left)
if (self.gapPosition > 0) {
var leftWall = self.attachAsset(wallAsset, {
anchorX: 0,
anchorY: 0,
width: self.gapPosition,
x: -1024
});
}
// Create right wall segment (if gap is not at the far right)
if (self.gapPosition + self.gapWidth < 2048) {
var rightWall = self.attachAsset(wallAsset, {
anchorX: 0,
anchorY: 0,
width: 2048 - (self.gapPosition + self.gapWidth),
x: self.gapPosition + self.gapWidth - 1024
});
}
// Add simge1 symbol to poison walls
var simge1 = self.attachAsset('simge1', {
anchorX: 0.5,
anchorY: 0.5,
x: self.gapPosition + self.gapWidth / 2 - 1024,
y: -50
});
} else {
// Normal walls - create openings similar to poison walls but smaller
var currentScore = LK.getScore();
self.gapWidth = Math.max(120, 200 - currentScore * 5); // Smaller gaps than poison walls
// Randomly choose gap position: left side, center, or right side
var gapType = Math.floor(Math.random() * 3); // 0=left, 1=center, 2=right
if (gapType === 0) {
// Left side opening
self.gapPosition = 50;
} else if (gapType === 1) {
// Center opening
self.gapPosition = (2048 - self.gapWidth) / 2;
} else {
// Right side opening
self.gapPosition = 2048 - self.gapWidth - 50;
}
// Create wall graphics based on type
var wallAsset = 'normalWall';
// Create left wall segment (if gap is not at the far left)
if (self.gapPosition > 0) {
var leftWall = self.attachAsset(wallAsset, {
anchorX: 0,
anchorY: 0,
width: self.gapPosition,
x: -1024
});
}
// Create right wall segment (if gap is not at the far right)
if (self.gapPosition + self.gapWidth < 2048) {
var rightWall = self.attachAsset(wallAsset, {
anchorX: 0,
anchorY: 0,
width: 2048 - (self.gapPosition + self.gapWidth),
x: self.gapPosition + self.gapWidth - 1024
});
}
// Add simge2 symbol to normal walls
var simge2 = self.attachAsset('simge2', {
anchorX: 0.5,
anchorY: 0.5,
x: self.gapPosition + self.gapWidth / 2 - 1024,
y: -50
});
}
self.update = function () {
self.y += self.speed;
};
// Check if character is in the gap
self.isCharacterInGap = function (characterX) {
return characterX >= self.gapPosition && characterX <= self.gapPosition + self.gapWidth;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game dimensions are 2048x2732
var groundLevel = 2732 - 100; // Ground at bottom of screen
var walls = [];
var wallSpawnTimer = 0;
var wallSpawnDelay = 80; // Spawn wall every 80 ticks (about 1.3 seconds at 60fps)
// Create ground
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 1,
x: 2048 / 2,
y: 2732
}));
// Create character
var character = game.addChild(new Character());
character.x = 2048 / 2;
character.y = groundLevel;
// Create score display
var scoreTxt = new Text2('Score: 0', {
size: 60,
fill: '#ffffff'
});
scoreTxt.anchor.set(0, 0);
scoreTxt.x = 150; // Offset from top-left to avoid menu icon
scoreTxt.y = 50;
LK.gui.topLeft.addChild(scoreTxt);
var dragNode = null;
// Handle touch/mouse input
game.down = function (x, y, obj) {
dragNode = character;
character.x = Math.max(80, Math.min(2048 - 80, x)); // Keep character within bounds
};
game.move = function (x, y, obj) {
if (dragNode) {
dragNode.x = Math.max(80, Math.min(2048 - 80, x)); // Keep character within bounds with margins
}
};
game.up = function (x, y, obj) {
dragNode = null;
};
// Main game update loop
game.update = function () {
wallSpawnTimer++;
// Spawn new walls
if (wallSpawnTimer >= wallSpawnDelay) {
wallSpawnTimer = 0;
// Randomly choose wall type (80% normal, 20% poison for balanced gameplay)
var wallType = Math.random() < 0.8 ? 'normal' : 'poison';
var newWall = new Wall(wallType);
newWall.x = 2048 / 2;
newWall.y = -100; // Start above screen
walls.push(newWall);
game.addChild(newWall);
}
// Update walls and check collisions
for (var i = walls.length - 1; i >= 0; i--) {
var wall = walls[i];
// Check if wall has passed character level and award score for normal walls
if (!wall.passed && wall.y > character.y - 40) {
wall.passed = true;
if (wall.wallType === 'normal') {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText('Score: ' + LK.getScore());
LK.getSound('ses2').play();
}
}
// Check collision with poison walls
if (wall.wallType === 'poison' && wall.y > character.y - 80 && wall.y < character.y + 40) {
// Check if character is NOT in the gap (collision with wall)
if (!wall.isCharacterInGap(character.x)) {
LK.getSound('ses1').play();
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
} else {
// Character is in the gap - successfully passed through poison wall
if (!wall.passedThroughGap) {
wall.passedThroughGap = true;
LK.getSound('ses1').play();
}
}
}
// Check collision with normal walls - destroy them when touched
if (wall.wallType === 'normal' && wall.y > character.y - 80 && wall.y < character.y + 40) {
// Character is touching the normal wall - check if NOT in gap (collision with wall)
if (!wall.isCharacterInGap(character.x)) {
LK.setScore(LK.getScore() + 5);
scoreTxt.setText('Score: ' + LK.getScore());
LK.getSound('ses2').play();
// Check win condition
if (LK.getScore() >= 100) {
LK.showYouWin();
return;
}
wall.destroy();
walls.splice(i, 1);
continue; // Skip to next wall since this one is destroyed
}
}
// Remove walls that are off screen
if (wall.y > 2732 + 100) {
wall.destroy();
walls.splice(i, 1);
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -184,8 +184,9 @@
wall.passed = true;
if (wall.wallType === 'normal') {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText('Score: ' + LK.getScore());
+ LK.getSound('ses2').play();
}
}
// Check collision with poison walls
if (wall.wallType === 'poison' && wall.y > character.y - 80 && wall.y < character.y + 40) {
@@ -208,8 +209,9 @@
// Character is touching the normal wall - check if NOT in gap (collision with wall)
if (!wall.isCharacterInGap(character.x)) {
LK.setScore(LK.getScore() + 5);
scoreTxt.setText('Score: ' + LK.getScore());
+ LK.getSound('ses2').play();
// Check win condition
if (LK.getScore() >= 100) {
LK.showYouWin();
return;