/****
* Classes
****/
var BackgroundColorTransition = Container.expand(function () {
var self = Container.call(this);
var dayDurationTicks = 1440; // 24 seconds * 60 FPS
self.update = function () {
var cycleProgress = LK.ticks % dayDurationTicks / dayDurationTicks;
var colorPhase = Math.sin(cycleProgress * Math.PI * 2) * 0.5 + 0.5;
var r = Math.floor(colorPhase * 135);
var g = Math.floor(colorPhase * 206);
var b = Math.floor(colorPhase * 235);
var hex = (r << 16) + (g << 8) + b;
game.setBackgroundColor(hex);
};
});
var BadWaterDroplet = Container.expand(function () {
var self = Container.call(this);
var badDropletGraphics = self.attachAsset('badWaterDroplet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2.25 * 4; // Increase base speed by 100%
self.move = function () {
self.y += self.speed;
// Calculate the scale based on the current y position
var scale = Math.min(1, self.y / 2732);
self.scale.x = scale;
self.scale.y = scale;
};
});
var BadWatermelon = Container.expand(function () {
var self = Container.call(this);
var badWatermelonGraphics = self.attachAsset('badWatermelon', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1 * 4; // Increase base speed by 100%
self.rotationSpeed = 0.025;
self.move = function () {
self.y += self.speed;
// Calculate the scale based on the current y position
var scale = Math.min(1, self.y / 2732);
self.scale.x = scale;
self.scale.y = scale;
self.rotation += self.rotationSpeed;
};
});
var Collector = Container.expand(function () {
var self = Container.call(this);
var collectorGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1948; // Position on the right side
self.y = 2400; // Near bottom
});
var DropCollector = Container.expand(function () {
var self = Container.call(this);
var collectorGraphics = self.attachAsset('collector', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1948; // Position on the right side
self.y = 2400; // Near bottom
});
var GoodDropletCollector = Container.expand(function () {
var self = Container.call(this);
var collectorGraphics = self.attachAsset('collector', {
anchorX: 0.5,
anchorY: 0.5,
zIndex: 10
});
self.x = 2048 - 500; // Ensure it's positioned on the right side of the screen, accounting for its width
self.y = 2400; // Near bottom
});
var Moon = Container.expand(function () {
var self = Container.call(this);
var moonGraphics = self.attachAsset('moon', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1;
self.move = function () {
if (sun.x < 0 || sun.x > 2048) {
self.x += self.speed;
self.scale.x -= 0.001;
self.scale.y -= 0.001;
if (self.x > 2048) {
self.x = -200;
self.scale.x = 1;
self.scale.y = 1;
}
}
self.rotation += 0.01;
};
});
var Player = Container.expand(function () {
var self = Container.call(this);
this.on('down', function () {
this.isDragging = true;
this.scale.x *= -1; // Flip the player asset direction
});
this.on('up', function () {
this.isDragging = false;
});
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Player update logic here
if (this.isDragging) {
this.rotation += 0.1; // Rotate the player when dragging
}
if (this.isNearGoodCollector() && this.goodDroplets > 0) {
this.dropOffGoodDroplets();
}
// Check if player is near the star collector to offload stars
if (this.x < 300 && stars > 0) {
LK.setScore(LK.getScore() + stars * 10); // Convert stars to score
stars = 0; // Reset stars to 0 after offloading
starsScoreTxt.setText('Stars: ' + stars); // Update the stars score display
}
// Check if player is near the drop collector to offload drops
if (this.x > 1748 && drops > 0) {
LK.setScore(LK.getScore() + drops * 15); // Convert drops to score
drops = 0; // Reset drops to 0 after offloading
dropsScoreTxt.setText('Drops: ' + drops); // Update the drops score display
}
};
});
var SpeedUpPowerup = Container.expand(function () {
var self = Container.call(this);
self.activate = function () {
// Speed up all falling objects for 2 seconds
// Define a base speed increase factor
// Define a base speed increase factor
var baseSpeedIncreaseFactor = 3; // Increased from 2 to 3 for a 50% increase
// Calculate exponential increase based on the number of watermelons caught
var speedIncreaseFactor = Math.pow(baseSpeedIncreaseFactor, watermelons.length);
// Store original speeds in a global scope to ensure they can be reset correctly
window.originalSpeeds = window.originalSpeeds || {
WaterDroplet: WaterDroplet.prototype.speed,
Watermelon: Watermelon.prototype.speed,
BadWaterDroplet: BadWaterDroplet.prototype.speed,
BadWatermelon: BadWatermelon.prototype.speed
};
WaterDroplet.prototype.speed *= speedIncreaseFactor;
Watermelon.prototype.speed *= speedIncreaseFactor;
BadWaterDroplet.prototype.speed *= speedIncreaseFactor;
BadWatermelon.prototype.speed *= speedIncreaseFactor;
// Calculate duration in ticks (2 seconds * 60 FPS)
var durationInTicks = 2 * 60;
var startTick = LK.ticks;
// Use LK.on('tick') to check if duration has passed and reset speeds
var checkAndResetSpeeds = function checkAndResetSpeeds() {
if (LK.ticks - startTick >= durationInTicks) {
WaterDroplet.prototype.speed = window.originalSpeeds.WaterDroplet;
Watermelon.prototype.speed = window.originalSpeeds.Watermelon;
BadWaterDroplet.prototype.speed = window.originalSpeeds.BadWaterDroplet;
BadWatermelon.prototype.speed = window.originalSpeeds.BadWatermelon;
// Remove this tick event listener to stop checking
LK.off('tick', checkAndResetSpeeds);
}
};
LK.on('tick', checkAndResetSpeeds);
};
});
var StormButton = Container.expand(function () {
var self = Container.call(this);
var buttonGraphics = self.attachAsset('stormButton', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 2048 - 150; // Position on the top right
self.y = 150;
self.visible = false; // Initially hidden
self.on('down', function () {
if (self.visible) {
initiateStormPowerup();
self.visible = false; // Hide after use
}
});
});
var Sun = Container.expand(function () {
var self = Container.call(this);
var sunGraphics = self.attachAsset('sun', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1;
self.move = function () {
if (moon.x < 0 || moon.x > 2048) {
self.x += self.speed;
self.scale.x -= 0.001;
self.scale.y -= 0.001;
if (self.x > 2048) {
self.x = -200;
self.scale.x = 1;
self.scale.y = 1;
}
}
self.rotation += 0.01;
};
});
var Tree = Container.expand(function () {
var self = Container.call(this);
var treeGraphics = self.attachAsset('tree' + Math.floor(Math.random() * 5 + 1), {
anchorX: 0.5,
anchorY: 1
});
});
var WaterDroplet = Container.expand(function () {
var self = Container.call(this);
var dropletGraphics = self.attachAsset('waterDroplet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3.45 * 4; // Increase base speed by 100%
self.move = function () {
self.y += self.speed;
// Calculate the scale based on the current y position
var scale = Math.min(1, self.y / 2732);
self.scale.x = scale;
self.scale.y = scale;
};
});
var Watermelon = Container.expand(function () {
var self = Container.call(this);
var watermelonGraphics = self.attachAsset('watermelon', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2.5 * 4; // Increase base speed by 100%
self.rotationSpeed = 0.025; // Rotation speed quartered
self.move = function () {
self.y += self.speed;
// Calculate the scale based on the current y position
var scale = Math.min(1, self.y / 2732);
self.scale.x = scale;
self.scale.y = scale;
self.rotation += self.rotationSpeed; // Apply rotation
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Light blue background to represent the sky
});
/****
* Game Code
****/
function initiateStormPowerup() {
// Define what happens when storm powerup is activated
console.log('Storm powerup activated!');
// Increase entire game speed by 400 percent for 10 seconds
var originalSpeeds = {
WaterDroplet: WaterDroplet.prototype.speed,
Watermelon: Watermelon.prototype.speed,
BadWaterDroplet: BadWaterDroplet.prototype.speed,
BadWatermelon: BadWatermelon.prototype.speed
};
// Define what happens when storm powerup is activated
console.log('Storm powerup activated!');
// Increase entire game speed by 400 percent for 10 seconds
var originalSpeeds = {
WaterDroplet: WaterDroplet.prototype.speed,
Watermelon: Watermelon.prototype.speed,
BadWaterDroplet: BadWaterDroplet.prototype.speed,
BadWatermelon: BadWatermelon.prototype.speed,
SpeedUpPowerup: SpeedUpPowerup.prototype.speed // Include SpeedUpPowerup in the speed increase
};
var increaseFactor = 5; // Corrected to 500% of original speed for 10 seconds
WaterDroplet.prototype.speed = originalSpeeds.WaterDroplet * increaseFactor;
Watermelon.prototype.speed = originalSpeeds.Watermelon * increaseFactor;
BadWaterDroplet.prototype.speed = originalSpeeds.BadWaterDroplet * increaseFactor;
BadWatermelon.prototype.speed = originalSpeeds.BadWatermelon * increaseFactor;
// Removed SpeedUpPowerup speed increase as it's not a descending item
LK.setTimeout(function () {
WaterDroplet.prototype.speed = originalSpeeds.WaterDroplet;
Watermelon.prototype.speed = originalSpeeds.Watermelon;
BadWaterDroplet.prototype.speed = originalSpeeds.BadWaterDroplet;
BadWatermelon.prototype.speed = originalSpeeds.BadWatermelon;
SpeedUpPowerup.prototype.speed = originalSpeeds.SpeedUpPowerup; // Reset SpeedUpPowerup speed after 10 seconds
// After 10 seconds, check conditions to make storm button reappear or stay hidden
if (drops >= 50 && stars >= 25) {
stormButton.visible = true;
} else {
stormButton.visible = false;
}
}, 10000); // 10 seconds in milliseconds
// Make the storm button blink for the duration of the powerup
var blinkInterval = LK.setInterval(function () {
stormButton.visible = !stormButton.visible;
}, 500);
// Set a timeout to reset speeds and stop blinking after 10 seconds
LK.setTimeout(function () {
clearInterval(blinkInterval);
// After 10 seconds, check conditions to make storm button reappear or stay hidden
LK.setTimeout(function () {
if (drops >= 50 && stars >= 25) {
stormButton.visible = true;
}
}, 10000);
WaterDroplet.prototype.speed = originalSpeeds.WaterDroplet;
Watermelon.prototype.speed = originalSpeeds.Watermelon;
BadWaterDroplet.prototype.speed = originalSpeeds.BadWaterDroplet;
BadWatermelon.prototype.speed = originalSpeeds.BadWatermelon;
}, 10000); // 10 seconds in milliseconds
// Decrease 25 star points from the stars score and 50 drops from the drops score
stars = Math.max(0, stars - 25);
drops = Math.max(0, drops - 50);
starsScoreTxt.setText('Stars: ' + stars);
dropsScoreTxt.setText('Drops: ' + drops);
// Hide the storm button until original conditions for its appearance apply
stormButton.visible = false;
}
var stormButton = game.addChild(new StormButton());
// Initialize stars score to track the number of bad water droplets collected
// Global variables to track the current day and time since the last day change
// Initialize player lives
var playerLives = 3;
// Function to display player lives
function displayLives() {
for (var i = 0; i < playerLives; i++) {
var life = LK.getAsset('circle', {
width: 50,
height: 50,
color: 0xFF0000,
// Red color
shape: 'ellipse',
x: 60 + i * 60,
// Position lives horizontally with some spacing
y: 60 // Position from the top
});
LK.gui.topLeft.addChild(life);
}
}
displayLives();
var currentDay = 1;
var timeSinceLastDay = 0;
var dayDurationTicks = 24 * 60; // 24 seconds, assuming 60FPS
// Function to update the day and adjust game difficulty
function updateDay() {
timeSinceLastDay += 1;
if (timeSinceLastDay >= dayDurationTicks) {
currentDay += 1;
timeSinceLastDay = 0;
// Increase the speed and frequency of assets for the new day
WaterDroplet.prototype.speed *= Math.pow(1.1, currentDay);
Watermelon.prototype.speed *= Math.pow(1.1, currentDay);
BadWaterDroplet.prototype.speed *= Math.pow(1.1, currentDay);
BadWatermelon.prototype.speed *= Math.pow(1.1, currentDay);
// Previously attempted to modify spawn frequency directly, which is not applicable as spawnWaterDroplet is not defined as an object with a frequency property.
}
}
// Call updateDay function every tick
LK.on('tick', function () {
updateDay();
updateHUD();
});
var hudCounters = {
stars: 0,
drops: 0,
day: 1,
score: 0
};
var stars = 0;
// Flag to indicate if the player is currently invincible
var isPlayerInvincible = false;
var isPlayerBlinking = false;
var drops = 0;
var stars = 0;
var starsScoreTxt = new Text2('Stars: 0', {
size: 30,
fill: "#ffffff",
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma",
x: 2048 - 10,
y: 10
});
var dropsScoreTxt = new Text2('Drops: 0', {
size: 30,
fill: "#ffffff",
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma",
x: 2048 - 10,
y: 50
});
var dayScoreTxt = new Text2('Day: 1', {
size: 30,
fill: "#ffffff",
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma",
x: 2048 - 10,
y: 90
});
var scoreTxt = new Text2('Score: 0', {
size: 30,
fill: "#ffffff",
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma",
x: 2048 - 10,
y: 130
});
LK.gui.top.addChild(starsScoreTxt);
LK.gui.top.addChild(dropsScoreTxt);
LK.gui.top.addChild(dayScoreTxt);
LK.gui.top.addChild(scoreTxt);
function updateHUD() {
starsScoreTxt.setText('Stars: ' + stars);
dropsScoreTxt.setText('Drops: ' + drops);
dayScoreTxt.setText('Day: ' + currentDay);
scoreTxt.setText('Score: ' + LK.getScore());
var maxY = Math.max(starsScoreTxt.height, dropsScoreTxt.height, dayScoreTxt.height, scoreTxt.height);
starsScoreTxt.y = 10;
dropsScoreTxt.y = starsScoreTxt.y + maxY + 5;
dayScoreTxt.y = dropsScoreTxt.y + maxY + 5;
scoreTxt.y = dayScoreTxt.y + maxY + 5;
}
// Ensure updateHUD is called whenever HUD needs to be updated.
updateHUD();
// GameState Manager
var ground = game.addChild(LK.getAsset('ground', {
x: 0,
y: 2532
}));
// Ensure one tree is always on the left side of the map
var leftTree = new Tree();
leftTree.x = 0; // Position at the extreme left
leftTree.y = ground.y - leftTree.height / 20;
game.addChild(leftTree);
// Ensure one tree is always on the right side of the map
var rightTree = new Tree();
rightTree.x = 2048 - rightTree.width; // Position at the extreme right
rightTree.y = ground.y - rightTree.height / 20;
game.addChild(rightTree);
// Add remaining trees randomly
for (var i = 0; i < 8; i++) {
var tree = new Tree();
tree.x = Math.random() * 2048;
tree.y = ground.y - tree.height / 20;
game.addChild(tree);
}
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) {
descriptor.writable = true;
}
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) {
_defineProperties(Constructor.prototype, protoProps);
}
if (staticProps) {
_defineProperties(Constructor, staticProps);
}
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _toPropertyKey(t) {
var i = _toPrimitive(t, "string");
return "symbol" == _typeof(i) ? i : String(i);
}
function _toPrimitive(t, r) {
if ("object" != _typeof(t) || !t) {
return t;
}
var e = t[Symbol.toPrimitive];
if (void 0 !== e) {
var i = e.call(t, r || "default");
if ("object" != _typeof(i)) {
return i;
}
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return ("string" === r ? String : Number)(t);
}
var GameStateManager = /*#__PURE__*/function () {
function GameStateManager() {
_classCallCheck(this, GameStateManager);
this.currentState = 'Start';
}
_createClass(GameStateManager, [{
key: "setState",
value: function setState(newState) {
this.currentState = newState;
switch (this.currentState) {
case 'Start':
// Initialize or reset game state
break;
case 'Playing':
// Game is in playing state
break;
case 'Paused':
// Game is paused
break;
case 'GameOver':
// Handle game over logic
LK.showGameOver();
break;
}
}
}, {
key: "getState",
value: function getState() {
return this.currentState;
}
}]);
return GameStateManager;
}();
var gameStateManager = new GameStateManager();
var currentLevel = 1;
var levelDurationTicks = 1800; // 30 seconds per level
var levelStartTick = 0; // The tick count when the current level started
function advanceLevel() {
currentLevel++;
levelStartTick = LK.ticks;
// Reset or increase difficulty here
// For example, increase the speed of falling objects
WaterDroplet.prototype.speed *= 1.1;
Watermelon.prototype.speed *= 1.1;
BadWaterDroplet.prototype.speed *= 1.1;
BadWatermelon.prototype.speed *= 1.1;
// Optionally, reset player position or state if needed
}
// Check for level advancement in the game's main tick function
LK.on('tick', function () {
if (LK.ticks - levelStartTick >= levelDurationTicks) {
advanceLevel();
}
// Existing tick code...
});
// Start Screen
var startScreen = new Container();
var startText = new Text2('Tap to Start', {
size: 100,
fill: "#ffffff",
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
startScreen.addChild(startText);
LK.gui.center.addChild(startScreen);
startScreen.on('down', function () {
gameStateManager.setState('Playing');
backgroundColorTransition = new BackgroundColorTransition();
LK.gui.center.removeChild(startScreen);
});
// This block has been removed as it's redundant with the existing startScreen 'down' event listener which handles both touch and mouse inputs.
gameStateManager.setState('Start');
// The large score counter initialization and addition to the GUI has been removed to keep only the small score counter.
game.on('up', function () {
player.isDragging = false;
});
game.on('move', function (obj) {
if (player.isDragging) {
var pos = obj.event.getLocalPosition(game);
player.x = Math.max(0, Math.min(2048 - player.width / 2, pos.x));
}
});
game.on('mousedown', function (obj) {
player.isDragging = true;
}); // Make player draggable with mouse
game.on('mouseup', function () {
player.isDragging = false;
}); // Stop dragging player with mouse
var player = game.addChild(new Player());
player.x = 1024; // Center horizontally
player.y = 2400; // Near bottom
var droplets = [];
var watermelons = [];
var score = 0;
// This code block has been removed to implement drag to move functionality.
// The new functionality will be implemented in the following changes.
var sun = game.addChild(new Sun());
sun.x = -200;
sun.y = 100;
var moon = game.addChild(new Moon());
moon.x = -200;
moon.y = 300;
LK.on('tick', function () {
if (gameStateManager.getState() === 'Playing' && backgroundColorTransition) {
backgroundColorTransition.update();
}
sun.move();
moon.move();
// Move droplets and watermelons
droplets.forEach(function (droplet, index) {
droplet.move();
if (droplet.y > 2732) {
// Off screen
score -= 1; // Decrease score by -1 if droplet is missed
scoreTxt.setText('Score: ' + score); // Update the score display
droplet.destroy();
droplets.splice(index, 1);
} else if (player.intersects(droplet)) {
if (!isPlayerBlinking) {
// Collect droplets without immediately affecting the score
if (droplet instanceof WaterDroplet) {
drops += 1; // Increment drops for each good droplet collected
dropsScoreTxt.setText('Drops: ' + drops); // Update the drops score display
} else if (droplet instanceof BadWaterDroplet) {
stars += 1; // Increment stars for each bad droplet collected
starsScoreTxt.setText('Stars: ' + stars); // Update the stars score display
}
droplet.destroy();
droplets.splice(index, 1);
}
}
});
watermelons.forEach(function (watermelon, index) {
watermelon.move();
if (watermelon.y > 2732) {
// Off screen
watermelon.destroy();
watermelons.splice(index, 1);
} else if (player.intersects(watermelon)) {
// Check if the watermelon is bad
var badWatermelonCount = 0;
// End the game if 5 bad watermelons are collected
if (badWatermelonCount >= 5) {
gameStateManager.setState('GameOver');
}
if (watermelon instanceof BadWatermelon) {
playerLives--;
LK.gui.topLeft.removeChild(LK.gui.topLeft.children[playerLives]);
if (playerLives <= 0) {
gameStateManager.setState('GameOver');
} else {
var blinkPlayer = function blinkPlayer() {
if (!isPlayerBlinking) {
isPlayerBlinking = true; // Set player as invincible at the start of blinking
var blinkCount = 0;
var totalBlinks = blinkDuration / blinkInterval;
var blink = function blink() {
if (blinkCount < totalBlinks) {
player.visible = !player.visible; // Toggle visibility
blinkCount++;
LK.setTimeout(blink, blinkInterval); // Schedule the next blink
} else {
player.visible = true; // Ensure player is visible after blinking ends
isPlayerBlinking = false; // Reset player's invincibility
}
};
blink();
}
};
// Custom blink effect for player when a bad watermelon is caught
var blinkDuration = 3000; // Duration of the blink effect in milliseconds
var blinkInterval = 500; // Interval between each blink
var endTime = LK.ticks + blinkDuration / (1000 / 60); // Calculate end time based on game ticks
blinkPlayer();
}
} else {
score += 5;
// Activate SpeedUpPowerup when a watermelon is collected
var speedUpPowerup = new SpeedUpPowerup();
speedUpPowerup.activate();
}
watermelon.destroy();
watermelons.splice(index, 1);
}
});
// Spawn droplets and watermelons
// Spawn water droplets function
function spawnWaterDroplet() {
var newDroplet = new WaterDroplet();
newDroplet.x = Math.random() * (2048 - newDroplet.width) + newDroplet.width / 2;
newDroplet.y = 0;
droplets.push(newDroplet);
game.addChild(newDroplet);
}
// Call spawnWaterDroplet every second
if (gameStateManager.getState() === 'Playing' && LK.ticks % 60 == 0) {
spawnWaterDroplet();
}
if (gameStateManager.getState() === 'Playing' && LK.ticks % 144 == 0) {
var newBadDroplet = new BadWaterDroplet();
newBadDroplet.x = Math.random() * 2048;
newBadDroplet.y = 0;
droplets.push(newBadDroplet);
game.addChild(newBadDroplet);
}
// Spawn watermelons function
function spawnWatermelon() {
var newWatermelon = new Watermelon();
newWatermelon.x = Math.random() * 2048;
newWatermelon.y = 0;
watermelons.push(newWatermelon);
game.addChild(newWatermelon);
}
// Call spawnWatermelon every 5 seconds
if (gameStateManager.getState() === 'Playing' && LK.ticks % 300 == 0) {
spawnWatermelon();
}
if (gameStateManager.getState() === 'Playing' && LK.ticks % 800 == 0) {
var newBadWatermelon = new BadWatermelon();
newBadWatermelon.x = Math.random() * 2048;
newBadWatermelon.y = 0;
watermelons.push(newBadWatermelon);
game.addChild(newBadWatermelon);
}
// Update score display
scoreTxt.setText('Score: ' + score);
// Check if conditions for storm powerup are met
if (drops >= 50 && stars >= 25) {
stormButton.visible = true; // Show storm button
}
// End the game if score reaches zero
if (score <= -1) {
gameStateManager.setState('GameOver');
}
// Increase the speed of all descending assets by 50 percent each time the score goes up by 10
if (score % 10 === 0 && score !== 0) {
// Ensure all items have a consistent speed increase factor
var speedIncreaseFactor = 1.5625; // Adjusted to match the base speed increase of 56.25%
WaterDroplet.prototype.speed *= speedIncreaseFactor;
Watermelon.prototype.speed *= speedIncreaseFactor;
BadWaterDroplet.prototype.speed *= speedIncreaseFactor;
BadWatermelon.prototype.speed *= speedIncreaseFactor;
}
});
8 bit watermelon slice no shadows. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Punk rock
8 bit moon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8 bit sun solar flare. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8 bit tree. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8 bit forrest. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Add a lake
8 bit meteor. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Define the b order and keep the center transperent
Retro art rain cloud with lighting bolt coming out the bottom 2d pixel art button logo. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.