User prompt
when a coconut reaches y = 700 spawn generalshadow at y = 350
User prompt
create new asset names generalshadow. just an asset
Code edit (2 edits merged)
Please save this source code
User prompt
when a coconut is in y = 700 then spawn objectshado in the same x as the coconut and on y = 350
User prompt
show object shadow unnder every coconut on the y = 350 position when each coconut reaches the y =700 position.
User prompt
create a new asset called objectshadow
User prompt
coconut shadow should be created in the same x as the coconut, but y should be fixed to 350. shadow will not move.
User prompt
create coconutshadow asset. only an asset.
User prompt
create particles when coconuts are destoryed
User prompt
Add gravity effect to the particle tick function
User prompt
Tick particles in the tick function of the Game class
User prompt
Remove particles from the global particles array when they are destroyed
User prompt
Add particles to the global particles array when they are created
User prompt
Create a global array to track particles
User prompt
Implement createParticleEffect method in Game class to handle particle creation
User prompt
Add particle effects when destroying coconuts
User prompt
Create a Particle class for particle effects when coconuts are destroyed
User prompt
Add particle effects when destroying coconust
User prompt
make sure particles have an expsosion efect
Code edit (1 edits merged)
Please save this source code
User prompt
create particle effect when coconut is destroyed
User prompt
create shadow2 asset
User prompt
coconut shadow should not move with coconut. I just needs to appear in the 350 Y position below the coconut.
Code edit (1 edits merged)
Please save this source code
User prompt
coconut shadow should spawn in y = 350
var Background = Container.expand(function () { var self = Container.call(this); var backgroundGraphics = self.createAsset('background', 'Background Graphics', 0.5, 0.5); backgroundGraphics.x = 1024; backgroundGraphics.y = 1366; }); var ScoreBackground = Container.expand(function () { var self = Container.call(this); var scoreBgGraphics = self.createAsset('scoreBg', 'Score Background Graphics', 0.5, 0); scoreBgGraphics.x = 1024; scoreBgGraphics.y = 0; }); var Coconut = Container.expand(function () { var self = Container.call(this); var coconutGraphics = self.createAsset('coconut', 'Coconut Graphics', .5, .5); self.setSpeed = function (score) { self.speed = 5 + Math.floor(score / 10); }; self.move = function () { self.y += self.speed; if (self.y === 1000) { var shadow = self.createAsset('objectShadow', 'Object Shadow Graphics', .5, .5); shadow.x = self.x; shadow.y = 350; } }; }); var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.createAsset('player', 'Player Graphics', .5, .5); var objectShadow = self.createAsset('objectShadow', 'Object Shadow Graphics', .5, .5); self.addChildAt(objectShadow, 0); objectShadow.y = playerGraphics.height * 0.1 + 200; objectShadow.alpha = 0.5; var playerLeftGraphics = self.createAsset('playerLeft', 'Player Left Graphics', .5, .5); playerLeftGraphics.visible = false; self.targetX = self.x; self.targetY = self.y; self.moveSpeed = 20; self.move = function (x, y) { self.targetX = x; self.targetY = y; }; self.update = function () { var dx = self.targetX - self.x; var dy = self.targetY - self.y; var distanceX = Math.abs(dx); var distanceY = Math.abs(dy); playerGraphics.visible = dx >= 0; playerLeftGraphics.visible = dx < 0; if (distanceX > self.moveSpeed) { var newX = self.x + dx / distanceX * self.moveSpeed; self.x = Math.max(0, Math.min(2048 - playerGraphics.width, newX)); } else if (distanceX > 0) { self.x = self.targetX; } }; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.addChild(new Background()); var score = 0; var scoreBackground = self.addChild(new ScoreBackground()); var scoreTxt = new Text2(score.toString(), { size: 150, fill: "#ffffff", font: "'Press Start 2P', monospace", dropShadow: true, dropShadowColor: '#000000', dropShadowBlur: 4, dropShadowAngle: Math.PI / 6, dropShadowDistance: 6 }); scoreTxt.anchor.set(.5, 0); scoreTxt.y = 20; LK.gui.topCenter.addChild(scoreTxt); var player = self.addChild(new Player()); player.x = 2048 / 2; player.y = 2732 - 350; var coconuts = []; stage.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); player.move(pos.x, pos.y); }); LK.on('tick', function () { player.update(); for (var a = coconuts.length - 1; a >= 0; a--) { var coconut = coconuts[a]; coconut.move(); if (coconut.y > 2732 - 200) { coconut.destroy(); coconuts.splice(a, 1); } } if (LK.ticks % 60 == 0) { var newCoconut = new Coconut(); newCoconut.setSpeed(score); newCoconut.x = Math.random() * 2048; newCoconut.y = 0; coconuts.push(newCoconut); self.addChild(newCoconut); } for (var b = 0; b < coconuts.length; b++) { if (player.intersects(coconuts[b])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } }); });
===================================================================
--- original.js
+++ change.js
@@ -17,9 +17,9 @@
self.speed = 5 + Math.floor(score / 10);
};
self.move = function () {
self.y += self.speed;
- if (self.y === 700) {
+ if (self.y === 1000) {
var shadow = self.createAsset('objectShadow', 'Object Shadow Graphics', .5, .5);
shadow.x = self.x;
shadow.y = 350;
}
8-bit. Cartoon. Guy the beach. Full body. Looking up. Sunglasses. Worried. In game asset. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
delete inpain selection
pixelart cartoon beach schene. just the beach and a big palm tree. no background.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart cartoon beach background for a mobile screen.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.