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
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
===================================================================
--- original.js
+++ change.js
@@ -32,8 +32,9 @@
rotation: Math.random() * Math.PI * 2
});
self.update = function () {
if (collectable.intersects(frog)) {
+ LK.getSound('pickupCaught').play();
self.destroy();
gameInterface.increaseMultiplier();
}
};
@@ -41,10 +42,12 @@
});
var Lilypad = ConfigContainer.expand(function (config) {
var self = ConfigContainer.call(this, config);
config = config || {};
- var destroying = false;
+ ;
+ var inert = config.inert !== undefined ? config.inert : false;
var active = config.active !== undefined ? config.active : true;
+ var destroying = false;
var stalk = self.attachAsset('stalk', {
anchorX: 0.5,
y: LILYPAD_STALK_OFFSET,
width: 15,
@@ -55,8 +58,14 @@
var lilypad = self.attachAsset('lilypad', {
anchorX: 0.5,
anchorY: 0.5
});
+ if (!inert && Math.random() < LILYPAD_PICKUP_CHANCE) {
+ pickupContainer.addChild(new Pickup({
+ x: self.x,
+ y: self.y - LILYPAD_PICKUP_OFFSET_MIN - LILYPAD_PICKUP_OFFSET_VAR * Math.random()
+ }));
+ }
;
self.launch = function () {
active = false;
destroying = true;
@@ -455,8 +464,11 @@
// Lilypad Settings
var LILYPAD_ANGLE = 10 * Math.PI / 180;
var LILYPAD_HEIGHT_FACTOR = 1.025;
var LILYPAD_STALK_OFFSET = -5;
+var LILYPAD_PICKUP_CHANCE = 0.5;
+var LILYPAD_PICKUP_OFFSET_MIN = 50;
+var LILYPAD_PICKUP_OFFSET_VAR = 100;
;
// Player Settings
var PLAYER_START_X = -400;
var PLAYER_START_Y = -1300;
@@ -481,9 +493,9 @@
var SHADOWGROUND_SCALE = 0.65;
var SHADOWGROUND_MOVEMENT = 3;
;
// Scoring Settings
-var SCORE_PER_DISTANCE = 0.05;
+var SCORE_PER_DISTANCE = 0.01;
var SCORE_PICKUP_MULTIPLER = 0.1;
;
//==============================================================================
// Game Instances & Variables
@@ -562,12 +574,8 @@
x: PLAYER_START_X + 100,
y: -300,
inert: true
}));
-pickupContainer.addChild(new Pickup({
- x: Math.random() * GAME_WIDTH,
- y: Math.random() * GAME_HEIGHT
-}));
;
//==============================================================================
// Global events
//==============================================================================
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