User prompt
TAP KERTE HI TURANT SE JUMP HO JANA CHAHIYE
User prompt
JUMP TO VERY FAST FASTTTTT NO JUMP LEVEL
User prompt
JUMP LEVEL INSAN INCREGE
User prompt
NUMBER COUNT THIS BLOCK WHYS BLOCK
User prompt
JUMP HAI JO BLOCK KE THORA SA UPER JUMP KERNA CHAHIYE
User prompt
JUMP WITH IN MIDIUM
User prompt
LEVEL LOW,HARD,MIDIAM,IMPPOSIBLE LEVEL LOW TO IMPPOSIBLE
User prompt
JUMP LOW-HIGH
Code edit (1 edits merged)
Please save this source code
User prompt
Tap Cursor Jump
Initial prompt
TAP CURSER BLOCK GAME TAP TO JUMP AND TAP RETUN TO TAP TAP CURSER GAME FOR PC WORLDS N/A
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Block = Container.expand(function () {
var self = Container.call(this);
var blockGraphics = self.attachAsset('block', {
anchorX: 0.5,
anchorY: 1.0
});
self.speed = -8;
self.update = function () {
self.x += self.speed;
};
return self;
});
var Cursor = Container.expand(function () {
var self = Container.call(this);
var cursorGraphics = self.attachAsset('cursor', {
anchorX: 0.5,
anchorY: 1.0
});
self.velocityY = 0;
self.gravity = 0.8;
self.jumpPower = -18;
self.highJumpPower = -28; // Higher jump for longer press
self.isOnGround = true;
self.groundY = 2632; // Ground level - cursor height
self.jump = function (isHighJump) {
if (self.isOnGround) {
if (isHighJump) {
self.velocityY = self.highJumpPower;
} else {
self.velocityY = self.jumpPower;
}
self.isOnGround = false;
LK.getSound('jump').play();
}
};
self.update = function () {
// Apply gravity
self.velocityY += self.gravity;
self.y += self.velocityY;
// Check ground collision
if (self.y >= self.groundY) {
self.y = self.groundY;
self.velocityY = 0;
self.isOnGround = true;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var gameSpeed = 8;
var spawnTimer = 0;
var spawnInterval = 90; // Frames between spawns
var minSpawnInterval = 30;
var speedIncreaseTimer = 0;
// Create ground
var ground = game.addChild(LK.getAsset('ground', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 2632
}));
// Create cursor
var cursor = game.addChild(new Cursor());
cursor.x = 300;
cursor.y = cursor.groundY;
// Arrays to track game objects
var blocks = [];
// Create score display
var scoreTxt = new Text2('0', {
size: 100,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Game variables
var distance = 0;
var tapStartTime = 0;
var isTapping = false;
var highJumpThreshold = 200; // ms for high jump
function spawnBlock() {
var block = new Block();
block.x = 2200; // Spawn off-screen right
block.y = 2632; // On ground level
blocks.push(block);
game.addChild(block);
}
function updateDifficulty() {
speedIncreaseTimer++;
if (speedIncreaseTimer >= 300) {
// Every 5 seconds at 60fps
gameSpeed += 0.5;
if (spawnInterval > minSpawnInterval) {
spawnInterval -= 2;
}
speedIncreaseTimer = 0;
}
}
// Touch controls
game.down = function (x, y, obj) {
tapStartTime = Date.now();
isTapping = true;
};
game.up = function (x, y, obj) {
if (isTapping) {
var tapDuration = Date.now() - tapStartTime;
var isHighJump = tapDuration >= highJumpThreshold;
cursor.jump(isHighJump);
isTapping = false;
}
};
game.update = function () {
// Update distance and score
distance += gameSpeed;
LK.setScore(Math.floor(distance / 10));
scoreTxt.setText(LK.getScore());
// Update difficulty
updateDifficulty();
// Spawn blocks
spawnTimer++;
if (spawnTimer >= spawnInterval) {
spawnBlock();
spawnTimer = 0;
}
// Update blocks and check collisions
for (var i = blocks.length - 1; i >= 0; i--) {
var block = blocks[i];
block.speed = -gameSpeed;
// Remove blocks that are off-screen
if (block.x < -200) {
block.destroy();
blocks.splice(i, 1);
continue;
}
// Check collision with cursor
if (cursor.intersects(block)) {
LK.getSound('hit').play();
LK.effects.flashScreen(0xff0000, 500);
LK.showGameOver();
return;
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -26,13 +26,18 @@
});
self.velocityY = 0;
self.gravity = 0.8;
self.jumpPower = -18;
+ self.highJumpPower = -28; // Higher jump for longer press
self.isOnGround = true;
self.groundY = 2632; // Ground level - cursor height
- self.jump = function () {
+ self.jump = function (isHighJump) {
if (self.isOnGround) {
- self.velocityY = self.jumpPower;
+ if (isHighJump) {
+ self.velocityY = self.highJumpPower;
+ } else {
+ self.velocityY = self.jumpPower;
+ }
self.isOnGround = false;
LK.getSound('jump').play();
}
};
@@ -86,8 +91,11 @@
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Game variables
var distance = 0;
+var tapStartTime = 0;
+var isTapping = false;
+var highJumpThreshold = 200; // ms for high jump
function spawnBlock() {
var block = new Block();
block.x = 2200; // Spawn off-screen right
block.y = 2632; // On ground level
@@ -106,10 +114,19 @@
}
}
// Touch controls
game.down = function (x, y, obj) {
- cursor.jump();
+ tapStartTime = Date.now();
+ isTapping = true;
};
+game.up = function (x, y, obj) {
+ if (isTapping) {
+ var tapDuration = Date.now() - tapStartTime;
+ var isHighJump = tapDuration >= highJumpThreshold;
+ cursor.jump(isHighJump);
+ isTapping = false;
+ }
+};
game.update = function () {
// Update distance and score
distance += gameSpeed;
LK.setScore(Math.floor(distance / 10));