Code edit (7 edits merged)
Please save this source code
User prompt
Add an update function to the hook class. If the hook's x position is less than the firewall's x position, destroy the hook
Code edit (1 edits merged)
Please save this source code
User prompt
after the `targetHook = closestHook;` line, check if the targethook is defined, if it is defined, add the highlight instance as a child to its highlightContainer, add the highlight as a child to the game instance, and hide it
Code edit (3 edits merged)
Please save this source code
User prompt
Inside the game.update function, iterate through the hookContainer's children and find the closest child to the frog within PLAYER_TONGUE_RANGE distance (use distance squared for comparison). The closest hook should be set as the targetHook, otherwise it should be set to undefined
Code edit (8 edits merged)
Please save this source code
User prompt
When a pickup is destroyed, play the pickupCaught sound
Code edit (1 edits merged)
Please save this source code
Code edit (3 edits merged)
Please save this source code
User prompt
In the interface's finalize function, round the score variable and save it using the LK engine
Code edit (1 edits merged)
Please save this source code
User prompt
Please fix the bug: 'TypeError: pickupContainer is undefined' in or related to this line: 'var pickup = pickupContainer.addChild(new Pickup({' Line Number: 439
User prompt
Add a pickup class, inheriting from ConfigContainer. It has the collectable asset with a random rotation, and an update function that checks for a collision with the frog instance, if so, it is destroyed and the interface score multiplier increased by 0.1
Code edit (6 edits merged)
Please save this source code
User prompt
Play the frogBounce sound in the lilypad's launch function
Code edit (6 edits merged)
Please save this source code
User prompt
Please fix the bug: 'ReferenceError: velocityY is not defined' in or related to this line: 'velocityY = -Math.abs(velocityY); // Example: reverse the Y velocity' Line Number: 53
User prompt
add an update statement to the lilypad class that checks for a collision with the frog instance and calls a new bounce function on the frog
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
change the interface text colours to black
Code edit (8 edits merged)
Please save this source code
User prompt
Instead of adding the gameInterface to the game, add it to the middle GUI element
User prompt
Add an Interface class that contains a score (displaying only the score value) and a multiplier below (displayed as the numerical rounded to 1 decimal place, and an "x", eg: "1.0x").
===================================================================
--- original.js
+++ change.js
@@ -20,18 +20,8 @@
var scaleY = config.scaleY !== undefined ? config.scaleY : config.scale !== undefined ? config.scale : 1;
self.scale.set(scaleX, scaleY);
}
;
- var velocityY = 0;
- self.bounce = function () {
- // Implement the bounce logic here
- velocityY = -Math.abs(velocityY); // Example: reverse the Y velocity
- };
- self.update = function () {
- if (self.intersects(frog)) {
- frog.bounce();
- }
- };
return self;
});
var Lilypad = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
@@ -48,8 +38,16 @@
var lilypad = self.attachAsset('lilypad', {
anchorX: 0.5,
anchorY: 0.5
});
+ ;
+ self.update = function () {
+ if (active && self.intersects(frog)) {
+ frog.bounce();
+ self.destroy();
+ }
+ };
+ ;
return self;
});
var Interface = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
@@ -167,8 +165,15 @@
velocityY = angularVelocity * hookLength * Math.sin(velocityAngle + MATH_HALF_PI) * PLAYER_RELEASE_MULTIPLIER - PLAYER_RELEASE_VY_BONUS;
hookLength = 0;
}
};
+ self.bounce = function () {
+ if (hooked) {
+ angularVelocity *= PLAYER_BOUNCE_FACTOR;
+ } else {
+ velocityY *= PLAYER_BOUNCE_FACTOR;
+ }
+ };
self.update = function () {
if (!sitting) {
if (hooked) {
var hookAngle = Math.atan2(self.y - hookedObj.y, self.x - hookedObj.x);
@@ -419,8 +424,9 @@
var PLAYER_TONGUE_RANGE = 650;
var PLAYER_ATTACH_MULTIPLIER = 1.1;
var PLAYER_RELEASE_MULTIPLIER = 1.1;
var PLAYER_RELEASE_VY_BONUS = 2;
+var PLAYER_BOUNCE_FACTOR = -1.1;
var PLAYER_SCREEN_MARGIN = 1.25;
;
// Background Settings
var MOON_SCALING = 0.25;
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