User prompt
Make flies bigger and faster
User prompt
Make toxic fly fly only in start direction
User prompt
Make that toxic fly buzzing be slower and have more distance.
User prompt
Make toxic fly to fly not into frog, but near the frog.
User prompt
Toxic flies doesnt fly to frog. Fix that!
User prompt
Add toxic flies that spawn every few seconds and fastly fly to frog. If frog touches them - Game over.
User prompt
Make lower amount of lilypads
User prompt
Spread lilypads normally, they must not collide with eachother.
User prompt
Dont reset x velocity when frog bounces on lilypad.
User prompt
Frog stucks in lilypads. Fix that!
User prompt
Place lilypads at bottom half of the screen
User prompt
Make lilypads smaller, but widther
User prompt
Delete lilypad movement, make lilypads bigger and make frog collidable with lilypads
User prompt
Add lilypads
User prompt
Make frog bigger
User prompt
Add background
User prompt
Make frog jump even more higher
User prompt
Make frog jump higher
User prompt
Hint: add x and y velocity. Make frog affected by gravity, when mouse is clicked - frog should jump (add velocity) in direction of mouse.
User prompt
Frog should jump fast and frog must be affected by gravity during jump
User prompt
When mouse clicked, frog smoothly jumps to mouse position
User prompt
Frog should jump in direction of mouse pointer, not teleporting to it.
User prompt
Frog should jump smoothely.
User prompt
Make frog jump to mouse pointer on click.
User prompt
Gravity should be realistic.
var ToxicFly = Container.expand(function () { var self = Container.call(this); var toxicFlyGraphics = self.createAsset('toxicFly', 'Toxic Fly', .5, .5); toxicFlyGraphics.scale.set(1); self.move = function () { self.x += self.vx; self.y += self.vy; }; }); var Frog = Container.expand(function () { var self = Container.call(this); self.vx = 0; self.vy = 0; self.gravity = 0.5; var frogGraphics = self.createAsset('frog', 'Frog character', .5, .5); frogGraphics.scale.set(2); self.jump = function (targetX, targetY) { var dx = targetX - self.x; var dy = targetY - self.y; var angle = Math.atan2(dy, dx); self.vx = Math.cos(angle) * 20; self.vy = Math.sin(angle) * 20; }; self.dodge = function (targetX, targetY) { var dx = targetX - self.x; var dy = targetY - self.y; var angle = Math.atan2(dy, dx); self.vx = Math.cos(angle) * 10; self.vy = Math.sin(angle) * 10; }; }); var LilyPad = Container.expand(function () { var self = Container.call(this); var lilyPadGraphics = self.createAsset('lilyPad', 'Lily pad', .5, .5); lilyPadGraphics.scale.set(3, 1); self.move = function () {}; self.checkCollision = function (otherLilyPad) { var dx = self.x - otherLilyPad.x; var dy = self.y - otherLilyPad.y; var distance = Math.sqrt(dx * dx + dy * dy); return distance < self.width / 2 + otherLilyPad.width / 2; }; }); var Danger = Container.expand(function () { var self = Container.call(this); var dangerGraphics = self.createAsset('danger', 'Danger', .5, .5); self.move = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.createAsset('background', 'Game Background', 0, 0); background.width = 2048; background.height = 2732; var frog = self.addChild(new Frog()); var lilyPads = []; for (var i = 0; i < 5; i++) { var lilyPad = new LilyPad(); do { lilyPad.x = Math.random() * 2048; lilyPad.y = Math.random() * 2732 / 2 + 2732 / 2; } while (lilyPads.some(function (otherLilyPad) { return lilyPad.checkCollision(otherLilyPad); })); lilyPads.push(lilyPad); self.addChild(lilyPad); } var dangers = []; var toxicFlies = []; frog.x = 2048 / 2; frog.y = 2732 / 2; var spawnToxicFly = function () { var toxicFly = new ToxicFly(); toxicFly.x = Math.random() * 2048; toxicFly.y = Math.random() * 2732; var dx = frog.x - toxicFly.x; var dy = frog.y - toxicFly.y; var angle = Math.atan2(dy, dx); toxicFly.vx = Math.cos(angle) * 15; toxicFly.vy = Math.sin(angle) * 15; toxicFlies.push(toxicFly); self.addChild(toxicFly); }; LK.setInterval(spawnToxicFly, 3000); LK.on('tick', function () { frog.x += frog.vx; frog.y += frog.vy; frog.vy += frog.gravity; for (var i = 0; i < lilyPads.length; i++) { if (frog.intersects(lilyPads[i])) { frog.vy = -10; } } for (var i = 0; i < toxicFlies.length; i++) { if (frog.intersects(toxicFlies[i])) { LK.showGameOver(); } } for (var i = 0; i < lilyPads.length; i++) { lilyPads[i].move(); if (lilyPads[i].x < -50) { lilyPads[i].destroy(); lilyPads.splice(i, 1); } } for (var i = 0; i < toxicFlies.length; i++) { toxicFlies[i].move(frog.x, frog.y); if (toxicFlies[i].x < -50 || toxicFlies[i].x > 2048 || toxicFlies[i].y < -50 || toxicFlies[i].y > 2732) { toxicFlies[i].destroy(); toxicFlies.splice(i, 1); } } }); stage.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); frog.jump(pos.x, pos.y); }); });
===================================================================
--- original.js
+++ change.js
@@ -1,14 +1,9 @@
var ToxicFly = Container.expand(function () {
var self = Container.call(this);
var toxicFlyGraphics = self.createAsset('toxicFly', 'Toxic Fly', .5, .5);
toxicFlyGraphics.scale.set(1);
- self.move = function (targetX, targetY) {
- var dx = targetX - self.x;
- var dy = targetY - self.y;
- var angle = Math.atan2(dy, dx) + (Math.random() > 0.5 ? -1 : 1) * Math.PI / 6;
- self.vx = Math.cos(angle) * 15;
- self.vy = Math.sin(angle) * 15;
+ self.move = function () {
self.x += self.vx;
self.y += self.vy;
};
});
@@ -76,8 +71,13 @@
var spawnToxicFly = function () {
var toxicFly = new ToxicFly();
toxicFly.x = Math.random() * 2048;
toxicFly.y = Math.random() * 2732;
+ var dx = frog.x - toxicFly.x;
+ var dy = frog.y - toxicFly.y;
+ var angle = Math.atan2(dy, dx);
+ toxicFly.vx = Math.cos(angle) * 15;
+ toxicFly.vy = Math.sin(angle) * 15;
toxicFlies.push(toxicFly);
self.addChild(toxicFly);
};
LK.setInterval(spawnToxicFly, 3000);
Cartoon lilypad Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon tileable swamp background, dark Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon. Green nuclear toxic fly Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cartoon cute fat toad Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.