User prompt
make a text that shows me how many raindrops i got
User prompt
make the player move faster side to side
User prompt
add automatic side to side movement to the player
User prompt
make the player move automatically side to side
User prompt
make so you can move the umbrella to the sides and up and down
User prompt
make the umbrella moving up, down and side to side
User prompt
make the umbrella movable
User prompt
move the umbrella a little higher
Initial prompt
raining wet
/**** * Classes ****/ var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Player update logic will be handled in the game tick }; }); var Umbrella = Container.expand(function () { var self = Container.call(this); var umbrellaGraphics = self.attachAsset('umbrella', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Umbrella update logic will be handled in the game tick }; }); var Raindrop = Container.expand(function () { var self = Container.call(this); var raindropGraphics = self.attachAsset('raindrop', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.move = function () { self.y += self.speed; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Light blue background to represent the sky }); /**** * Game Code ****/ game.on('up', function (obj) { dragNode = null; }); game.on('move', function (obj) { if (dragNode) { var currentPos = obj.event.getLocalPosition(game); dragNode.x = currentPos.x; dragNode.y = currentPos.y; } }); var player = game.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - 150; var umbrella = game.addChild(new Umbrella()); umbrella.x = player.x; umbrella.y = player.y - 100; var raindrops = []; var dragNode = null; game.on('down', function (obj) { dragNode = umbrella; var touchPos = obj.event.getLocalPosition(game); dragNode.initialTouch = { x: touchPos.x, y: touchPos.y }; dragNode.initialPos = { x: dragNode.x, y: dragNode.y }; }); LK.on('tick', function () { // Create raindrops if (LK.ticks % 10 === 0) { var raindrop = new Raindrop(); raindrop.x = Math.random() * 2048; raindrop.y = -10; raindrops.push(raindrop); game.addChild(raindrop); } // Update raindrops for (var i = raindrops.length - 1; i >= 0; i--) { raindrops[i].move(); if (raindrops[i].y > 2732) { raindrops[i].destroy(); raindrops.splice(i, 1); } else if (raindrops[i].intersects(umbrella)) { raindrops[i].destroy(); raindrops.splice(i, 1); } else if (raindrops[i].intersects(player)) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); break; } } });
===================================================================
--- original.js
+++ change.js
@@ -48,10 +48,10 @@
});
game.on('move', function (obj) {
if (dragNode) {
var currentPos = obj.event.getLocalPosition(game);
- dragNode.x = dragNode.initialPos.x + (currentPos.x - dragNode.initialTouch.x);
- dragNode.y = dragNode.initialPos.y + (currentPos.y - dragNode.initialTouch.y);
+ dragNode.x = currentPos.x;
+ dragNode.y = currentPos.y;
}
});
var player = game.addChild(new Player());
player.x = 2048 / 2;
rainbow colored umbrella. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
raindrop. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cartoon full body person. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.