Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
Code edit (17 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: childInstance is undefined' in or related to this line: 'childInstance.x += x;' Line Number: 234
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self is undefined' in or related to this line: 'self.shift = function (x, y) {' Line Number: 348
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: self is undefined' in or related to this line: 'self.shift = function (x, y) {' Line Number: 342
User prompt
add a "shift" function to the camera which takes in an x and y value. When called, iterate through all the camera's children and increase their x-position by the x value. Additionally increase the Frog instance's y-position by the y value.
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Please implement this in the frog class for TODO 1,2 and 3 respectively
Code edit (16 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: r is not defined' in or related to this line: 'var vt = self.angularVelocity * r;' Line Number: 161
User prompt
Please implement this for the frog class. The TODO 1 is when the frog instance attaches to the hook, the TODO 2 is when the frog releases itself from the hook, and the TODO 3 is the angular momentum update while attached to the hook point
User prompt
Please fix the bug: 'ReferenceError: distance is not defined' in or related to this line: 'var angle = self.angularMomentum / distance;' Line Number: 148
User prompt
Please complete TODO 1, 2 and 3. TODO 1 should convert the current velocity into angular momentum, TODO 2 should convert the current angular momentum into velocity, and TODO 3 should update the position based on the angular momentum and also be influenced by player gravity.
Code edit (1 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
When releasing, convert the tangential velocity into the new vx and vy
User prompt
Similarly apply the tangential velocity solution while the frog is attached to the hook, and revert it once the release function is called
User prompt
Assuming the frog is the body in this example, please add a vx, vy to it, and allow it to be affected by gravity.
User prompt
make the pink tongue a slightly darker pink
Code edit (1 edits merged)
Please save this source code
===================================================================
--- original.js
+++ change.js
@@ -157,20 +157,43 @@
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
- });
+ config = config || {};
+ var tint = config.tint !== undefined ? config.tint : 0xFFFFFF;
+ var coverage = config.coverage !== undefined ? config.coverage : 0;
+ var covered = 0;
+ var segmentWidth = 0;
+ var flipX = -1;
+ var scaleX = self.scale.x;
+ do {
+ var foregroundLeft = self.attachAsset('foreground', {
+ x: covered / 2,
+ anchorX: Math.max(0, flipX),
+ anchorY: 1.0,
+ scaleX: flipX,
+ tint: tint
+ });
+ var foregroundRight = self.attachAsset('foreground', {
+ x: covered / 2,
+ anchorX: Math.max(0, flipX),
+ anchorY: 1.0,
+ scaleX: -flipX,
+ tint: tint
+ });
+ covered += segmentWidth || (segmentWidth = foregroundRight.width + foregroundLeft.width);
+ flipX *= -1;
+ } while (covered < coverage);
+ ;
+ self.update = function () {
+ if (self.x <= -segmentWidth * scaleX) {
+ self.x += segmentWidth * scaleX;
+ }
+ if (self.x >= segmentWidth * scaleX) {
+ self.x -= segmentWidth * scaleX;
+ }
+ };
+ ;
return self;
});
var Firewall = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
@@ -201,9 +224,9 @@
return self;
});
var Camera = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
- var zoom = 1.0;
+ self.zoom = 0.5;
self.shift = function (x, y) {
for (var i = 0; i < self.children.length; i++) {
var childContainer = self.children[i];
for (var j = 0; j < childContainer.children.length; j++) {
@@ -216,10 +239,12 @@
frog.x += x;
frog.y += y;
};
self.update = function () {
- self.scale.set(zoom);
- moon.scale.set(zoom);
+ self.scale.set(self.zoom);
+ moon.scale.set(self.zoom);
+ foreground.scale.set(self.zoom);
+ shadowground.scale.set(self.zoom * 0.8);
};
});
/****
@@ -261,9 +286,9 @@
var PLAYER_START_X = -400;
var PLAYER_START_Y = -1300;
var PLAYER_GRAVITY = 0.2;
var PLAYER_SPIN_MAGNITUDE = -2.0;
-var PLAYER_ANGULAR_DAMPENING = 0.9999;
+var PLAYER_ANGULAR_DAMPENING = 0.9995;
var PLAYER_TONGUE_RANGE = 650;
var PLAYER_ATTACH_MULTIPLIER = 1.1;
var PLAYER_RELEASE_MULTIPLIER = 1.1;
var PLAYER_RELEASE_VY_BONUS = 2;
@@ -285,16 +310,17 @@
x: GAME_WIDTH / 2,
y: GAME_HEIGHT / 2
}));
var shadowground = game.addChild(new Foreground({
- y: GAME_HEIGHT,
+ y: GAME_HEIGHT - 200,
tint: 0x111111,
- scale: 0.75,
- coverage: 4 * GAME_WIDTH
+ scale: 0.8,
+ coverage: 10 * GAME_WIDTH
}));
var foreground = game.addChild(new Foreground({
y: GAME_HEIGHT,
- coverage: 3 * GAME_WIDTH
+ tint: 0x808080,
+ coverage: 10 * GAME_WIDTH
}));
var camera = game.addChild(new Camera({
x: GAME_WIDTH / 2,
y: GAME_HEIGHT
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