User prompt
Rename the global `PLAYER_TONGUE_RANGE` to `PLAYER_TONGUE_RANGE_MAX` and update all its usages. Add a new global under `PLAYER_TONGUE_RANGE_MAX` called `PLAYER_TONGUE_RANGE_MIN`
Code edit (1 edits merged)
Please save this source code
User prompt
the hook should flip it's hook asset's scale.x every 5 to 10 frames
User prompt
Please fix the bug: 'ReferenceError: highlightContainer is not defined' in or related to this line: 'self.highlightContainer = highlightContainer;' Line Number: 183
User prompt
Remove the highlightContainer from the hook and instead attach directly to the highlight instance
User prompt
change the frog's "hookedObj" variable to be "self.hookedObj" instead, and update all references
Code edit (1 edits merged)
Please save this source code
User prompt
change the hook class's disableInterval to be a timeout instead
Code edit (1 edits merged)
Please save this source code
User prompt
Add a disable function to the hook class which sets it's "self.enabled" to false and tints it dark grey for HOOK_OFFLINE ticks, then reverts the changes
User prompt
Please fix the bug: 'TypeError: hookedObj.disable is not a function' in or related to this line: 'hookedObj.disable();' Line Number: 278
User prompt
In the frog release function, if hooked then call a new disable function on the hookedObj and then clear the variable
User prompt
hide the visibility of the frog's collision
Code edit (4 edits merged)
Please save this source code
User prompt
add a 50x50 shapeEllipse to the frog as the collision
Code edit (1 edits merged)
Please save this source code
Code edit (2 edits merged)
Please save this source code
User prompt
Create an empty Spawner class
Code edit (1 edits merged)
Please save this source code
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
===================================================================
--- original.js
+++ change.js
@@ -147,9 +147,9 @@
var hook = self.attachAsset('hook', {
anchorX: 0.5,
anchorY: 0.5
});
- var flipInterval = Math.floor(Math.random() * 6) + 5; // Random interval between 5 to 10 frames
+ var flipInterval = HOOK_FLIPTICKS_MIN + Math.floor(Math.random() * HOOK_FLIPTICKS_VAR);
var flipCounter = 0;
;
self.enabled = true;
self.disable = function () {
@@ -166,11 +166,14 @@
flipCounter++;
if (flipCounter >= flipInterval) {
hook.scale.x *= -1;
flipCounter = 0;
- flipInterval = Math.floor(Math.random() * 6) + 5; // Reset interval
+ flipInterval = HOOK_FLIPTICKS_MIN + Math.floor(Math.random() * HOOK_FLIPTICKS_VAR);
}
if (self.x < firewall.x) {
+ if (self === frog.hookedObj) {
+ frog.release();
+ }
self.destroy();
}
};
;
@@ -587,9 +590,9 @@
;
// Firewall Settings
var FIREWALL_OFFSET = 0.7;
var FIREWALL_SPEED = 2;
-var FIREWALL_SPEED_INC = 0.05 / GAME_TICKS;
+var FIREWALL_SPEED_INC = 0.1 / GAME_TICKS;
var FIREWALL_START_X = -GAME_WIDTH / 2 - 500;
var FIREWALL_SOUND_COUNT = 4;
var FIREWALL_SOUND_DIVDIST = 1000;
;
@@ -598,9 +601,9 @@
var LILYPAD_HEIGHT_FACTOR = 1.025;
var LILYPAD_STALK_OFFSET = -5;
var LILYPAD_SPAWN_MARGIN = 3000;
var LILYPAD_SPAWN_X_MIN = 50;
-var LILYPAD_SPAWN_X_VAR = 2450;
+var LILYPAD_SPAWN_X_VAR = 1450;
var LILYPAD_SPAWN_Y_MIN = -50;
var LILYPAD_SPAWN_Y_VAR = -300;
var LILYPAD_PICKUP_CHANCE = 0.25;
var LILYPAD_PICKUP_OFFSET_MIN = 50;
@@ -614,20 +617,23 @@
var HOOK_SPAWN_Y_MIN = -700;
var HOOK_SPAWN_Y_VAR = -900;
var HOOK_DOUBLE_CHANCE = 0.1;
var HOOK_DOUBLE_SPREAD = 0.25;
+var HOOK_FLIPTICKS_MIN = 20;
+var HOOK_FLIPTICKS_VAR = 40;
;
// Player Settings
var PLAYER_START_X = -400;
var PLAYER_START_Y = -1300;
var PLAYER_GRAVITY = 0.5;
var PLAYER_SPIN_MAGNITUDE = -2.0;
var PLAYER_ANGULAR_DAMPENING = 0.9995;
-var PLAYER_TONGUE_RANGE = 1000;
-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_TONGUE_RANGE_MAX = 1000;
+var PLAYER_TONGUE_RANGE_MIN = 500; // Example value, adjust as needed
+var PLAYER_ATTACH_MULTIPLIER = 1.12;
+var PLAYER_RELEASE_MULTIPLIER = 1.12;
+var PLAYER_RELEASE_VY_BONUS = 5;
+var PLAYER_BOUNCE_FACTOR = -1.12;
var PLAYER_SCREEN_MARGIN = 1.25;
;
// Background Settings
var MOON_SCALING = 0.25;
@@ -798,12 +804,12 @@
}
}
// Find the targetHook
var closestHook = undefined;
- var minDistanceSq = PLAYER_TONGUE_RANGE * PLAYER_TONGUE_RANGE;
+ var minDistanceSq = PLAYER_TONGUE_RANGE_MAX * PLAYER_TONGUE_RANGE_MAX;
for (var i = 0; i < hookContainer.children.length; i++) {
var hook = hookContainer.children[i];
- if (hook.enabled) {
+ if (hook !== frog.hookedObj && hook.enabled) {
var dx = hook.x - frog.x;
if (dx > PLAYER_START_X - hook.width) {
var dy = hook.y - frog.y;
var distanceSq = dx * dx + dy * dy;
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