User prompt
Can u do the same for the waterdroplet class
User prompt
Modify the waterdroplet2 class to start really small and only reach full size at the bottom of the screen.
User prompt
Modify the WaterDroplet2 class to start really small and only reach full size at the bottom of the screen.
User prompt
Douplicate waterdroplets and call it waterdroplets2
User prompt
Can you you do the same for watermellons
User prompt
Can u do the same for badwatermellon
User prompt
Do the same for waterdroplets and watermellon classes at half the ammount as you just did with the others
User prompt
Make the badwaterdroplets and badwatermellons start really small and only reach full size at the bottom of the screen
User prompt
Make the falling elements start out smalll and reach full size only 1/3 of the way down the screen
User prompt
Make all good and bad elements only reach full size 1/3 from the bottom of the screen
User prompt
Can you make the elements only reach their full size at the bottom of the scream before reachign the charactor
User prompt
Its still adding 5 points when a bad watermellon is collected
User prompt
Double check that the scoring system for bad watermellon of -5 was implementer properly
User prompt
Good ideas, please implement this scoring system for watermellons and droplets
User prompt
Can u do the same for badwatermellon
User prompt
Please implement your positive and negitive scoring system
User prompt
Ok implement this please
User prompt
Creat an background element that occasionally moves from left to right and dissapears
User prompt
Lets make an elephant background element that moves across the lake and tree elements from left to right occasionally
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var leftLake = new Lake();' Line Number: 171
User prompt
Make sure one of the lake elements is always on the far left and right side of the screen
User prompt
Make sure one tree element is always on either side of the maps view
User prompt
Please fix the bug: 'Script error.' in or related to this line: 'var shakingTree = new ShakingTree();' Line Number: 177
User prompt
Make the 5 new elements shake slightly back and forth
User prompt
Raise the lake assets higher
/****
* Classes
****/
var BackgroundColorTransition = Container.expand(function () {
var self = Container.call(this);
self.speed = 0.01;
self.update = function () {
var color = Math.sin(LK.ticks * self.speed) * 0.5 + 0.5;
var r = Math.floor(color * 135);
var g = Math.floor(color * 206);
var b = Math.floor(color * 235);
var hex = (r << 16) + (g << 8) + b;
game.setBackgroundColor(hex);
};
});
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 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 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 BadWaterDroplet = Container.expand(function () {
var self = Container.call(this);
var badDropletGraphics = self.attachAsset('badWaterDroplet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3;
self.move = function () {
self.y += self.speed;
};
});
var BadWatermelon = Container.expand(function () {
var self = Container.call(this);
var badWatermelonGraphics = self.attachAsset('badWatermelon', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
self.rotationSpeed = 0.025;
self.move = function () {
self.y += self.speed;
self.rotation += self.rotationSpeed;
};
});
var Player = Container.expand(function () {
var self = Container.call(this);
this.on('down', function () {
this.isDragging = true;
});
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Player update logic here
};
});
var WaterDroplet = Container.expand(function () {
var self = Container.call(this);
var dropletGraphics = self.attachAsset('waterDroplet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 3;
self.move = function () {
self.y += self.speed;
};
});
var Watermelon = Container.expand(function () {
var self = Container.call(this);
var watermelonGraphics = self.attachAsset('watermelon', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 2;
self.rotationSpeed = 0.025; // Rotation speed quartered
self.move = function () {
self.y += self.speed;
self.rotation += self.rotationSpeed; // Apply rotation
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Light blue background to represent the sky
});
/****
* Game Code
****/
var backgroundColorTransition = game.addChild(new BackgroundColorTransition());
// GameState Manager
var ground = game.addChild(LK.getAsset('ground', {
x: 0,
y: 2500
}));
for (var i = 0; i < 10; i++) {
var tree = new Tree();
tree.x = Math.random() * 2048;
tree.y = ground.y - tree.height / 20;
game.addChild(tree);
}
var ground = game.addChild(LK.getAsset('ground', {
x: 0,
y: 2532
}));
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 scoreTxt = new Text2('Score: 0', {
size: 150,
fill: "#ffffff",
font: "'GillSans-Bold',Impact,'Arial Black',Tahoma"
});
// Initialize score display
LK.gui.top.addChild(scoreTxt);
game.on('up', function () {
player.isDragging = false;
});
game.on('move', function (obj) {
if (player.isDragging) {
var pos = obj.event.getLocalPosition(game);
player.x = pos.x;
}
});
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 () {
backgroundColorTransition.update();
sun.move();
moon.move();
// Move droplets and watermelons
droplets.forEach(function (droplet, index) {
droplet.move();
if (droplet.y > 2732) {
// Off screen
droplet.destroy();
droplets.splice(index, 1);
} else if (player.intersects(droplet)) {
score += 1;
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)) {
score += 5; // Watermelons give a bigger boost
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.y = 0;
droplets.push(newDroplet);
game.addChild(newDroplet);
}
// Call spawnWaterDroplet every second
if (LK.ticks % 60 == 0) {
spawnWaterDroplet();
}
if (LK.ticks % 120 == 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 (LK.ticks % 300 == 0) {
spawnWatermelon();
}
if (LK.ticks % 600 == 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);
});
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.