Code edit (1 edits merged)
Please save this source code
User prompt
tint the stalk slightly light green
Code edit (7 edits merged)
Please save this source code
User prompt
use the lilypadStalk instead of the shapeBox, and no longer tint it
Code edit (3 edits merged)
Please save this source code
User prompt
Create a Lilypad class that has a shapeBox asset (as a stalk) and the lilypad asset. The shapeBox asset should have an anchor of (0.5, 0), be resized to a width of 25 and a height of 1.2 * its y position, have a random rotation between -10 degree and 10 degrees, and be tinted green
Code edit (2 edits merged)
Please save this source code
User prompt
Tint the foreground assets by 50% grey
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
tint the foreground by 50% grey
Code edit (7 edits merged)
Please save this source code
User prompt
create a new foreground class that contains 2 foreground assets side-by-side
Code edit (3 edits merged)
Please save this source code
User prompt
the background should have an opacity of 0.25
User prompt
Before creating the moon asset, create a background asset
User prompt
Create a Hook class that contains an empty highlightContainer Container and then a hook asset
Code edit (6 edits merged)
Please save this source code
User prompt
Give the Firewall class a speed var of FIREWALL_SPEED, which increases by FIREWALL_SPEED_INC in the update function. Additionally, increase its x value by speed in the update function
Code edit (1 edits merged)
Please save this source code
Code edit (7 edits merged)
Please save this source code
User prompt
after creating all the columns in the firewall, invert the array of children
Code edit (3 edits merged)
Please save this source code
User prompt
add an update function to the firewall which randomly selects 1 column from the columns array and inverts it's scaleX
Code edit (6 edits merged)
Please save this source code
/**** * Classes ****/ /** * config { * x : Number || 0, * y : Number || 0, * rotation : Number || 0, * } **/ var ConfigContainer = Container.expand(function (config) { var self = Container.call(this); config = config || {}; ; self.x = config.x || 0; self.y = config.y || 0; self.rotation = config.rotation || 0; if (config.scale !== undefined || config.scaleX !== undefined || config.scaleY !== undefined) { var scaleX = config.scaleX !== undefined ? config.scaleX : config.scale !== undefined ? config.scale : 1; var scaleY = config.scaleY !== undefined ? config.scaleY : config.scale !== undefined ? config.scale : 1; self.scale.set(scaleX, scaleY); } ; return self; }); var Lilypad = ConfigContainer.expand(function (config) { var self = ConfigContainer.call(this, config); var stalk = self.attachAsset('lilypadStalk', { anchorX: 0.5, anchorY: 1, width: 25, height: self.y * LILYPAD_HEIGHT, rotation: LILYPAD_ANGLE * (1 - 2 * Math.random()) }); var lilypad = self.attachAsset('lilypad', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Hook = ConfigContainer.expand(function (config) { var self = ConfigContainer.call(this, config); var highlightContainer = self.addChild(new Container()); var hook = self.attachAsset('hook', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Foreground = ConfigContainer.expand(function (config) { var self = ConfigContainer.call(this, config); var foreground1 = self.attachAsset('foreground', { anchorX: 0.0, anchorY: 1.0, tint: 0x808080 // 50% grey }); var foreground2 = self.attachAsset('foreground', { anchorX: 1.0, anchorY: 1.0, scaleX: -1, x: foreground1.width, tint: 0x808080 // 50% grey }); return self; }); var Firewall = ConfigContainer.expand(function (config) { var self = ConfigContainer.call(this, config); var speed = FIREWALL_SPEED; var columns = []; var columnCount = config.columns || 0; var firewallBase = self.attachAsset('firewallBase', { anchorX: 0.5, anchorY: 1.0 }); columns.push(firewallBase); for (var i = 0; i < columnCount; i++) { var firewallColumn = LK.getAsset('firewallColumn', {}); var column = self.attachAsset('firewallColumn', { anchorX: 0.5, anchorY: 1.0, y: -firewallBase.height * FIREWALL_OFFSET - i * firewallColumn.height * FIREWALL_OFFSET, scaleX: Math.random() > 0.5 ? 1 : -1 }); columns.push(column); } self.update = function () { var randomColumn = columns[Math.floor(Math.random() * columns.length)]; randomColumn.scale.x *= -1; speed += FIREWALL_SPEED_INC; self.x += speed; }; return self; }); var Camera = ConfigContainer.expand(function (config) { var self = ConfigContainer.call(this, config); var zoom = 1.0; self.update = function () { self.scale.set(zoom); moon.scale.set(zoom); }; }); /**** * Initialize Game ****/ //<Assets used in the game will automatically appear here> var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ ; //============================================================================== // Global Constants & Settings //============================================================================== ; // Game Constants var GAME_TICKS = 60; var GAME_WIDTH = 2048; var GAME_HEIGHT = 2732; ; // Firewall Settings var FIREWALL_OFFSET = 0.7; var FIREWALL_SPEED = 0; // 2 var FIREWALL_SPEED_INC = 0; // 0.1 / GAME_TICKS; var FIREWALL_START_X = -GAME_WIDTH / 2; ; // Lilypad Settings var LILYPAD_ANGLE = 10 * Math.PI / 180; var LILYPAD_HEIGHT = 1.2; ; //============================================================================== // Game Instances & Variables //============================================================================== ; var background = game.addChild(LK.getAsset('background', { anchorX: 0.5, anchorY: 1.0, x: GAME_WIDTH / 2, y: GAME_HEIGHT })); var moon = game.addChild(LK.getAsset('moon', { anchorX: 0.5, anchorY: 0.5, x: GAME_WIDTH / 2, y: GAME_HEIGHT / 2 })); var foreground = game.addChild(new Foreground({ y: GAME_HEIGHT })); var camera = game.addChild(new Camera({ x: GAME_WIDTH / 2, y: GAME_HEIGHT })); var firewall = camera.addChild(new Firewall({ x: FIREWALL_START_X, columns: 10 })); var lilypad = camera.addChild(new Lilypad({ x: -200, y: -500 }));
===================================================================
--- original.js
+++ change.js
@@ -24,15 +24,14 @@
return self;
});
var Lilypad = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
- var stalk = self.attachAsset('shapeBox', {
+ var stalk = self.attachAsset('lilypadStalk', {
anchorX: 0.5,
- anchorY: 0,
+ anchorY: 1,
width: 25,
height: self.y * LILYPAD_HEIGHT,
- rotation: Math.random() * LILYPAD_ANGLE * 2.0 - LILYPAD_ANGLE,
- tint: 0x008000 // green
+ rotation: LILYPAD_ANGLE * (1 - 2 * Math.random())
});
var lilypad = self.attachAsset('lilypad', {
anchorX: 0.5,
anchorY: 0.5
@@ -128,9 +127,9 @@
var FIREWALL_SPEED_INC = 0; // 0.1 / GAME_TICKS;
var FIREWALL_START_X = -GAME_WIDTH / 2;
;
// Lilypad Settings
-var LILYPAD_ANGLE = 10;
+var LILYPAD_ANGLE = 10 * Math.PI / 180;
var LILYPAD_HEIGHT = 1.2;
;
//==============================================================================
// Game Instances & Variables
@@ -157,5 +156,9 @@
}));
var firewall = camera.addChild(new Firewall({
x: FIREWALL_START_X,
columns: 10
+}));
+var lilypad = camera.addChild(new Lilypad({
+ x: -200,
+ y: -500
}));
\ No newline at end of file
fireCrackle
Sound effect
frogTongue
Sound effect
frogDeath
Sound effect
lilypadBounce
Sound effect
noTarget
Sound effect
backgroundAmbient
Sound effect
fireCrackling1
Sound effect
fireCrackling2
Sound effect
fireCrackling3
Sound effect
fireCrackling4
Sound effect
frogBounce
Sound effect
pickupCaught
Sound effect