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
User prompt
have a target scale for game background
User prompt
set backgroundElement scale to 2
Code edit (1 edits merged)
Please save this source code
User prompt
set bulletBackground blendmode to 1
User prompt
when rotating bulletGraphics, also rotate bulletBackground
User prompt
set bulletGraphics rotation to the same of bulletGraphics when rotating bulletGraphics
User prompt
make bulletGraphics rotate with bulletGraphics
User prompt
Don't set width and height and x,y of bulletBackground
User prompt
below bulletGraphics set a create a bullets background
User prompt
set blend mode of bullets to 1
User prompt
in hexagon tick, set elementGraphics and backgroundElement alpha to 1 if their alpha is bigger than 1
Code edit (1 edits merged)
Please save this source code
User prompt
in hexagon tick set max alpha of elementGraphics and backgroundElement to 1
Code edit (1 edits merged)
Please save this source code
User prompt
in hexagon element tick also fade in backgroundElement, but do it twice as fast
User prompt
In tick also fade in backgroundElement, but do it twice as fast
User prompt
set backgroundElement alpha to 0 when the HexagonElement is created
User prompt
HexagonElement fadeOut also set alpha on self rather than elementGraphics
User prompt
n HexagonElement fadeOut scale self rather than elementGraphics
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.scale.x = targetScale; backgroundElement.scale.y = targetScale; 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(); } if (elements.length === 0 && bullets.length === 0) { self.startNextLevel(); } else if (self.shotIndicator.currentShots <= 0 && bullets.length === 0) { LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -170,9 +170,9 @@
}
}
self.startNextLevel = function () {
wave++;
- targetScale -= 0.05;
+ targetScale = Math.max(1, targetScale - 0.05);
backgroundElement.scale.x = targetScale;
backgroundElement.scale.y = targetScale;
var waveText = new Text2('Wave ' + wave, {
size: 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.