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; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x385b50 }); /**** * Game Code ****/ var gameSpeed = 0; var score = 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()); 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); } 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 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; } } }); var dragStart = null; game.on('down', function (x, y, obj) { dragStart = game.toLocal(obj.global); });
===================================================================
--- original.js
+++ change.js
@@ -1,18 +1,30 @@
/****
* Classes
-****/
+****/
var Indicator = Container.expand(function () {
var self = Container.call(this);
var indicatorGraphics = self.attachAsset('indicator', {
anchorY: 0.5
});
self.alpha = 0;
- self.update = function (x, y) {
+ 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', {
@@ -34,9 +46,9 @@
this.jumpForceY = y / 12.5;
};
self.jumping = false;
self.onPlatform = false;
- self.update = function () {
+ self._update_migrated = function () {
this.x += this.velocityX;
this.y += this.velocityY;
this.velocityY += this.gravity;
this.velocityX *= 0.98;
@@ -54,38 +66,26 @@
this.onPlatform = false;
}
};
});
-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;
-});
/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
backgroundColor: 0x385b50
});
/****
* Game Code
-****/
+****/
var gameSpeed = 0;
var score = 0;
var background = game.attachAsset('background', {});
background.alpha = 0.5;
-game.on('up', function (obj) {
+game.on('up', function (x, y, obj) {
if (dragStart && player.onPlatform) {
- var pos = obj.event.getLocalPosition(game);
+ 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;
@@ -96,12 +96,12 @@
instructionTxt.destroy();
player.indicator.alpha = 0;
}
});
-game.on('move', function (obj) {
+game.on('move', function (x, y, obj) {
if (dragStart && !player.jumping) {
- var pos = obj.event.getLocalPosition(game);
- player.indicator.update(dragStart.x - pos.x, dragStart.y - pos.y);
+ var pos = game.toLocal(obj.global);
+ player.indicator._update_migrated(dragStart.x - pos.x, dragStart.y - pos.y);
player.indicator.alpha = 1;
}
});
var platforms = [];
@@ -122,9 +122,9 @@
dropShadowBlur: 4,
dropShadowAngle: Math.PI / 6,
dropShadowDistance: 6
});
-LK.gui.topCenter.addChild(scoreTxt);
+LK.gui.top.addChild(scoreTxt);
var instructionTxt = new Text2('Drag and release to jump', {
size: 100,
fill: '#ffffff',
font: 'Impact',
@@ -144,9 +144,9 @@
var firstJump = false;
platforms[0].x = player.x;
platforms[0].y = player.y + player.playerGraphics.height;
LK.on('tick', function () {
- player.update();
+ player._update_migrated();
if (player.y < 2732 / 2) {
platformSpeed = Math.min(platformSpeed + 0.1, 5);
} else {
platformSpeed = Math.max(platformSpeed - 0.1, 0);
@@ -167,7 +167,7 @@
}
}
});
var dragStart = null;
-game.on('down', function (obj) {
- dragStart = obj.event.getLocalPosition(game);
+game.on('down', function (x, y, obj) {
+ dragStart = game.toLocal(obj.global);
});
\ No newline at end of file
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