Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
attach a rangeIndicator asset to the frog class, tinted red and with 0.2 opacity
Code edit (12 edits merged)
Please save this source code
User prompt
rename `highlightRange` asset to `rangeIndicator`
Code edit (1 edits merged)
Please save this source code
User prompt
Create a new, empty class called ShiftContainer that inherits from the ConfigContainer. All `new Container()`s that were added to the camera should call `new ShiftContainer()` instead
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -38,8 +38,11 @@
return self;
});
var ShiftContainer = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
+ config = config || {};
+ self.shift = config.shift !== undefined ? config.shift : 1.0;
+ ;
return self;
});
var Pickup = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
@@ -420,19 +423,23 @@
var distance = 0;
var distanceMax = 0;
var hookSpawnDist = self.zoom = 1;
self.shift = function (x, y) {
+ // Shift all nested instances attached to the camera
for (var i = 0; i < self.children.length; i++) {
- var childContainer = self.children[i];
- for (var j = 0; j < childContainer.children.length; j++) {
- var childInstance = childContainer.children[j];
- childInstance.x -= x;
+ var shiftContainer = self.children[i];
+ var shiftX = shiftContainer.shift * x;
+ for (var j = 0; j < shiftContainer.children.length; j++) {
+ var childInstance = shiftContainer.children[j];
+ childInstance.x -= shiftX;
}
}
foreground.x -= x / FOREGROUND_MOVEMENT;
shadowground.x += x / SHADOWGROUND_MOVEMENT;
+ // Manually adjust the frog's position
frog.x += x;
frog.y += y;
+ // Keep track of the scoring
distance += x;
if (distance > distanceMax) {
gameInterface.increaseDistance(distance - distanceMax);
distanceMax = distance;
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