Code edit (1 edits merged)
Please save this source code
User prompt
Move background 50 px to the left
Code edit (1 edits merged)
Please save this source code
User prompt
add a black drop shadow to wave text
User prompt
make wave text 3x as large
User prompt
make wave text 4x as large
User prompt
in tick subtract current sale from targetScale rather than the other way around both for x and y
Code edit (3 edits merged)
Please save this source code
User prompt
when game starts set background scale to targetScale
User prompt
in self.startNextLevel do not modify backgroundElement.scale
User prompt
in self.startNextLevel do not modify backgroundElement.scale
User prompt
in startNextLevel do not modify backgroundElement.scale x,y
User prompt
in startNextLevel do not modify backgroundElement.scale x,y
User prompt
in the startNextLevel method in game do not modify x,y on backgroundElement.scale
User prompt
in startNextLevel do not modify backgroundElement.scale x and y
Code edit (1 edits merged)
Please save this source code
User prompt
In the scaling code in tick, don't use n instead use the current x,y scale of background
User prompt
when calling tick in game add logic that sets background scale x and y to (n-targetScale)/20
User prompt
In tick, if set background scale x and y to (n-targetScale)/20
User prompt
set max of targetScale to 1
User prompt
when startNextLevel is called, decrease targetScale by 0.05
User prompt
when startNextLevel is called, decrease targetScale by 0.05
User prompt
in start next level decrease targetScale by 0.05
User prompt
On start next level, decrease targetScale by 0.05
User prompt
set background targetScale in game to 1.8
var ShotIndicator = Container.expand(function (maxShots) { var self = Container.call(this); self.maxShots = maxShots; self.currentShots = maxShots; self.indicators = []; for (var i = 0; i < self.maxShots; i++) { var indicator = self.createAsset('shotIndicator', 'Shot Indicator', 0, 0.5); indicator.x = i * indicator.width; self.indicators.push(indicator); self.addChild(indicator); } self.updateIndicators = function () { for (var i = 0; i < self.indicators.length; i++) { self.indicators[i].alpha = i < self.currentShots ? 1 : 0.3; } }; self.useShot = function () { if (self.currentShots > 0) { self.currentShots--; self.updateIndicators(); } }; self.resetShots = function () { self.currentShots = Math.min(self.currentShots + 2, self.maxShots); self.updateIndicators(); }; self.updateIndicators(); return self; }); var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('bullet', 'Bullet Graphics', .5, .5); self.speed = 15; self.tick = function () { if (!self.initialized) { self.rotationSpeed = -Math.PI / 60; self.rotationTicks = 30; self.initialized = true; } if (self.rotationTicks > 0) { bulletGraphics.rotation += self.rotationSpeed; self.rotationTicks--; } self.speed += 0.1; self.x += Math.cos(self.rotation) * self.speed; self.y += Math.sin(self.rotation) * self.speed; }; }); var HexagonElement = Container.expand(function (delay) { var self = Container.call(this); self.fadeOut = function () { var fadeOutInterval = LK.setInterval(function () { self.alpha -= 0.05; self.scale.x += 0.05; self.scale.y += 0.05; if (self.alpha <= 0) { LK.clearInterval(fadeOutInterval); self.destroy(); } }, 10); }; var backgroundElement = self.createAsset('hexBackground', 'Hexagon Background', .5, .5); backgroundElement.alpha = 0; backgroundElement.blendMode = 1; backgroundElement.scale.x = 1; backgroundElement.scale.y = 1; var elementGraphics = self.createAsset('element', 'Element Graphics', .5, .5); elementGraphics.alpha = 0; elementGraphics.scale.x = 0; elementGraphics.scale.y = 0; self.fadeInDelay = delay * 5; var directions = [{ x: 1, y: 0 }, { x: -1, y: 0 }, { x: 0.5, y: Math.sqrt(3) / 2 }, { x: -0.5, y: Math.sqrt(3) / 2 }, { x: 0.5, y: -Math.sqrt(3) / 2 }, { x: -0.5, y: -Math.sqrt(3) / 2 }]; var chosenDirection = directions[Math.floor(Math.random() * directions.length)]; self.speed = 2; self.tick = function () { if (self.fadeInDelay > 0) { self.fadeInDelay--; } else { if (elementGraphics.alpha < 1) { elementGraphics.alpha += 0.05; elementGraphics.scale.x += 0.05; elementGraphics.scale.y += 0.05; } else if (elementGraphics.alpha > 1) { elementGraphics.alpha = 1; } if (backgroundElement.alpha < 1) { backgroundElement.alpha += 0.1; } else if (backgroundElement.alpha > 1) { backgroundElement.alpha = 1; } } self.x = (self.x + chosenDirection.x * self.speed + 2048) % 2048; self.y = (self.y + chosenDirection.y * self.speed + 2732) % 2732; }; }); var Game = Container.expand(function () { var self = Container.call(this); var backgroundElement = self.createAsset('backgroundElement', 'Background Element', 0.5, 0.5); var targetScale = 1.8; backgroundElement.x = 2048 / 2; backgroundElement.y = 2732 / 2; self.addChild(backgroundElement); var score = 0; var wave = 0; var scoreTxt = new Text2(score.toString(), { size: 150, fill: "#ffffff", weight: 500, dropShadow: true, dropShadowColor: '#000000', dropShadowBlur: 4, dropShadowAngle: Math.PI / 6, dropShadowDistance: 6 }); scoreTxt.anchor.set(0.5, 0); LK.gui.topCenter.addChild(scoreTxt); self.updateScore = function (points) { score += points; scoreTxt.setText(score.toString()); }; self.updateScore(0); var bullets = []; var elements = []; var shotIndicator = new ShotIndicator(5); shotIndicator.x = 2048 - shotIndicator.width * shotIndicator.maxShots - 20 - 30 - 10; shotIndicator.y = 40 + 10 + 20; LK.gui.topRight.addChild(shotIndicator); self.shotIndicator = shotIndicator; self.shotIndicator.resetShots(); function startNextLevel() { bullets.forEach(function (bullet) { bullet.destroy(); }); bullets = []; elements.forEach(function (element) { element.destroy(); }); elements = []; self.shotIndicator.resetShots(); var hexagonsThisWave = Math.min(wave + 2, 8); for (var i = 0; i < hexagonsThisWave; i++) { var scaleModifier = Math.max(0.3, 1 - wave * 0.05); var hexagonElement = new HexagonElement(i); hexagonElement.x = Math.random() * 2048; hexagonElement.y = Math.random() * 2732; hexagonElement.scale.x = scaleModifier; hexagonElement.scale.y = scaleModifier; elements.push(hexagonElement); self.addChild(hexagonElement); } } self.startNextLevel = function () { wave++; targetScale = Math.max(1, targetScale - 0.05); backgroundElement.scale.x = targetScale; backgroundElement.scale.y = targetScale; var waveText = new Text2('Wave ' + wave, { size: 100, fill: '#ffffff', weight: 100, align: 'center' }); waveText.anchor.set(0.5, 0.5); LK.gui.center.addChild(waveText); LK.setTimeout(function () { waveText.destroy(); }, 2000); startNextLevel.call(this); }; self.startNextLevel(); self.fireBulletsHexagon = function (position) { var directions = [{ x: 1, y: 0 }, { x: -1, y: 0 }, { x: 0.5, y: Math.sqrt(3) / 2 }, { x: -0.5, y: Math.sqrt(3) / 2 }, { x: 0.5, y: -Math.sqrt(3) / 2 }, { x: -0.5, y: -Math.sqrt(3) / 2 }]; directions.forEach(function (direction, index) { var bullet = new Bullet(); bullet.x = position.x; bullet.y = position.y; bullet.rotation = Math.atan2(direction.y, direction.x); bullets.push(bullet); self.addChild(bullet); }); }; stage.on('down', function (obj) { if (self.shotIndicator.currentShots <= 0) return; self.shotIndicator.useShot(); var event = obj.event; var pos = event.getLocalPosition(self); self.fireBulletsHexagon(pos); }); LK.on('tick', function () { for (var i = bullets.length - 1; i >= 0; i--) { bullets[i].tick(); for (var j = elements.length - 1; j >= 0; j--) { var dx = bullets[i].x - elements[j].x; var dy = bullets[i].y - elements[j].y; var fixedIntersectionDistance = elements[j].width / 2; if (Math.abs(dx) < fixedIntersectionDistance && Math.abs(dy) < fixedIntersectionDistance) { var pos = { x: elements[j].x, y: elements[j].y }; elements[j].fadeOut(); self.updateScore(1); elements.splice(j, 1); self.fireBulletsHexagon(pos); break; } } if (bullets[i].x < 0 || bullets[i].x > 2048 || bullets[i].y < 0 || bullets[i].y > 2732) { bullets[i].destroy(); bullets.splice(i, 1); } } for (var j = 0; j < elements.length; j++) { elements[j].tick(); } backgroundElement.scale.x += (backgroundElement.scale.x - targetScale) / 20; backgroundElement.scale.y += (backgroundElement.scale.y - targetScale) / 20; if (elements.length === 0 && bullets.length === 0) { self.startNextLevel(); } else if (self.shotIndicator.currentShots <= 0 && bullets.length === 0) { LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -169,8 +169,10 @@
}
self.startNextLevel = function () {
wave++;
targetScale = Math.max(1, targetScale - 0.05);
+ backgroundElement.scale.x = targetScale;
+ backgroundElement.scale.y = targetScale;
var waveText = new Text2('Wave ' + wave, {
size: 100,
fill: '#ffffff',
weight: 100,
Hexagon target Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single White Hexagon, soft edges, simple, vector. Round corners. All white. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Amazing bright hexagon space background.
Triangle plasma bullet. Glowing. Pointing down. Dark outline. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
White triangle Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Single Bright light particle, white. Simple, vector. Triangle. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.