User prompt
don't fly ulti
User prompt
Let there be 1 ultimate, let the ultimate be full after 5 minutes, let the ultimate be full of tran bolin
User prompt
no tran bolin
User prompt
changing the shape of the tran bolin
User prompt
Add a trampoline and make it jump 5 blocks and make it come out of 1 block 5 times.
User prompt
no menu
User prompt
add menu
User prompt
add money
User prompt
Migrate to the latest version of LK
Remix started
Copy Frog Jumper
/****
* Classes
****/
var Indicator = Container.expand(function () {
var self = Container.call(this);
var indicatorGraphics = self.attachAsset('indicator', {
anchorY: 0.5
});
self.alpha = 0;
self._update_migrated = function (x, y) {
this.rotation = Math.atan2(y, x);
this.scale.x = Math.sqrt(x * x + y * y) / 100;
};
});
var Platform = Container.expand(function () {
var self = Container.call(this);
var platformGraphics = self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
});
self.hitTestAsset = self.attachAsset('hitTest', {
anchorX: 0.5,
anchorY: 0.5
});
self.hitTestAsset.alpha = 0;
});
var Player = Container.expand(function () {
var self = Container.call(this);
self.indicator = self.addChild(new Indicator());
self.playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.gravity = 1;
self.jumpForce = 20;
self.velocityX = 0;
self.velocityY = 0;
self.setJumpForce = function (x, y) {
var vectorMagnitude = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
var maxMagnitude = 1100;
if (vectorMagnitude > maxMagnitude) {
x = x / vectorMagnitude * maxMagnitude;
y = y / vectorMagnitude * maxMagnitude;
}
this.jumpForceX = x / 12.5;
this.jumpForceY = y / 12.5;
};
self.jumping = false;
self.onPlatform = false;
self._update_migrated = function () {
this.x += this.velocityX;
this.y += this.velocityY;
this.velocityY += this.gravity;
this.velocityX *= 0.98;
this.velocityY *= 0.98;
if (this.y > 2732) {
LK.showGameOver();
}
if (this.x < 0 || this.x > 2048) {
this.velocityX *= -1;
}
if (this.velocityY >= 0) {
this.jumping = false;
} else if (this.velocityY < 0) {
this.jumping = true;
this.onPlatform = false;
}
};
});
var Trampoline = Container.expand(function () {
var self = Container.call(this);
self.trampolineGraphics = self.attachAsset('hitTest', {
anchorX: 0.5,
anchorY: 0.5
});
self.trampolineGraphics.width = 400;
self.trampolineGraphics.height = 120;
self.trampolineGraphics.shape = 'ellipse';
self.trampolineGraphics.color = 0x44c0ff;
self.bounceCount = 0;
self.maxBounces = 5;
self.active = true;
self.update = function () {
// No-op for now, trampoline is static
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x385b50
});
/****
* Game Code
****/
var gameSpeed = 0;
var score = 0;
var money = 0;
var background = game.attachAsset('background', {});
background.alpha = 0.5;
game.on('up', function (x, y, obj) {
if (dragStart && player.onPlatform) {
var pos = game.toLocal(obj.global);
player.setJumpForce(dragStart.x - pos.x, dragStart.y - pos.y);
player.velocityX = player.jumpForceX;
player.velocityY = player.jumpForceY;
dragStart = null;
gameSpeed += 0.5;
score += 1;
LK.setScore(score);
scoreTxt.setText(LK.getScore());
money += 1;
moneyTxt.setText('💰 ' + money);
instructionTxt.destroy();
player.indicator.alpha = 0;
}
});
game.on('move', function (x, y, obj) {
if (dragStart && !player.jumping) {
var pos = game.toLocal(obj.global);
player.indicator._update_migrated(dragStart.x - pos.x, dragStart.y - pos.y);
player.indicator.alpha = 1;
}
});
var platforms = [];
var platformSpeed = 0;
for (var i = 0; i < 5; i++) {
var platform = new Platform();
platform.x = Math.random() * 2048;
platform.y = i * (2732 / 5);
platforms.push(platform);
game.addChild(platform);
}
// Add trampoline
var trampoline = new Trampoline();
trampoline.x = 2048 / 2;
trampoline.y = 2732 - 600;
game.addChild(trampoline);
var trampolineBlocksJumped = 0;
var trampolineRespawns = 0;
var trampolineJumping = false;
var scoreTxt = new Text2('0', {
size: 150,
fill: '#ffffff',
font: 'Impact',
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 6
});
LK.gui.top.addChild(scoreTxt);
var moneyTxt = new Text2('💰 0', {
size: 100,
fill: '#ffe066',
font: 'Impact',
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 6
});
moneyTxt.anchor.set(0, 0);
moneyTxt.x = 120; // Avoid top left menu, place right of it
moneyTxt.y = 0;
LK.gui.top.addChild(moneyTxt);
var instructionTxt = new Text2('Drag and release to jump', {
size: 100,
fill: '#ffffff',
font: 'Impact',
dropShadow: true,
dropShadowColor: '#000000',
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 6
});
instructionTxt.anchor.set(.5, .5);
instructionTxt.x = 2048 / 2;
instructionTxt.y = 2732 / 2;
game.addChild(instructionTxt);
var player = game.addChild(new Player());
player.x = 2048 / 2;
player.y = 2732 - player.playerGraphics.height;
var firstJump = false;
platforms[0].x = player.x;
platforms[0].y = player.y + player.playerGraphics.height;
LK.on('tick', function () {
player._update_migrated();
if (player.y < 2732 / 2) {
platformSpeed = Math.min(platformSpeed + 0.1, 5);
} else {
platformSpeed = Math.max(platformSpeed - 0.1, 0);
}
for (var i = 0; i < platforms.length; i++) {
platforms[i].y += platformSpeed + gameSpeed;
}
player.y += platformSpeed + gameSpeed;
for (var i = 0; i < platforms.length; i++) {
if (player.intersects(platforms[i].hitTestAsset) && !player.jumping && player.y + player.playerGraphics.height / 2 < platforms[i].y) {
player.y = platforms[i].y - player.playerGraphics.height / 2 - platforms[i].hitTestAsset.height / 2;
player.velocityY = 0;
player.velocityX *= 0.8;
player.onPlatform = true;
} else if (platforms[i].y - platforms[i].height > 2732) {
platforms[i].y = -platforms[i].height;
platforms[i].x = Math.random() * 2048;
}
}
// Trampoline logic
if (trampoline.active && player.intersects(trampoline.trampolineGraphics) && !trampolineJumping && player.y + player.playerGraphics.height / 2 < trampoline.y) {
trampolineJumping = true;
trampolineBlocksJumped = 0;
trampoline.bounceCount += 1;
player.velocityY = -45; // Strong jump
player.velocityX = 0;
player.onPlatform = true;
}
if (trampolineJumping) {
// Move trampoline up with player for 5 blocks
if (trampolineBlocksJumped < 5) {
trampoline.y -= platformSpeed + gameSpeed + 30; // Move up fast
trampolineBlocksJumped += 1;
} else {
trampolineJumping = false;
trampolineRespawns += 1;
if (trampolineRespawns < 5) {
// Respawn trampoline at bottom in random x
trampoline.x = 200 + Math.random() * (2048 - 400);
trampoline.y = 2732 - 600;
trampoline.bounceCount = 0;
trampoline.active = true;
} else {
// Remove trampoline after 5 respawns
trampoline.active = false;
trampoline.visible = false;
}
}
}
});
var dragStart = null;
game.on('down', function (x, y, obj) {
dragStart = game.toLocal(obj.global);
}); ===================================================================
--- original.js
+++ change.js
@@ -68,12 +68,16 @@
};
});
var Trampoline = Container.expand(function () {
var self = Container.call(this);
- self.trampolineGraphics = self.attachAsset('platform', {
+ self.trampolineGraphics = self.attachAsset('hitTest', {
anchorX: 0.5,
anchorY: 0.5
});
+ self.trampolineGraphics.width = 400;
+ self.trampolineGraphics.height = 120;
+ self.trampolineGraphics.shape = 'ellipse';
+ self.trampolineGraphics.color = 0x44c0ff;
self.bounceCount = 0;
self.maxBounces = 5;
self.active = true;
self.update = function () {
Single cartoon frog sitting. Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single Cartoon lillypad edge on. No flower Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cozy cartoon swamp background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Gradient from black to green Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
frog language. In-Game asset. 2d. High contrast. No shadows