User prompt
Remove win state graphic code
User prompt
Add tap graphic to game display
User prompt
Center win state graphic
User prompt
Fix Bug: 'ReferenceError: Can't find variable: photoCounter' in this line: 'photoCounter.setText(self.photosTaken.toString());' Line Number: 95
User prompt
Modify photocounter : create the photo counter text object once outside of the loop or condition that checks for successful photo captures and then simply update its text content with the new number of photos taken, rather than creating a new text object each time.
User prompt
PhotoCounter.Y = 3050 / 2
User prompt
PhotoCounter.Y = 2999 / 2
User prompt
PhotoCounter.Y = 2900 / 2
User prompt
PhotoCounter.Y = 2875 / 2
User prompt
PhotoCounter.Y = 2799 / 2
User prompt
PhotoCounter.Y = 2600 / 2
User prompt
PhotoCounter.Y = 2600
User prompt
Change photocoinrer text to be be Number
User prompt
PhotoCointer.X = 100
User prompt
Move Photo counter to left side of screen below photos. Remove text Photos:
User prompt
Add photo counter to game display
User prompt
Display counter at left bottom corner of screen
User prompt
Make counter text white
User prompt
Add counter above photos
User prompt
Ensure enemy ghost is not rendered behind background
User prompt
Change EnemyGhost alpha to 1
User prompt
Modify EnemyGhost make fully visible. Remove fadein
User prompt
Add win state display graphic
User prompt
gradually change the alpha of an EnemyGhost from 0 to 1 over 1.5 seconds, you would create a function within the EnemyGhost class that increments the alpha property of the ghost's graphics by a small amount on each tick of the game loop. Since the game loop operates at 60 frames per second (FPS), you would have 90 frames to change the alpha from 0 to 1 (1.5 seconds * 60 FPS = 90 frames). This means you would increase the alpha by approximately 1/90 on each frame.
User prompt
When spawning EnemyGhost, gradually change alpha from 0 to 1 over 1.5 seconds. Slow speed of size increase
var Viewfinder = Container.expand(function () { var self = Container.call(this); var viewfinderGraphics = self.createAsset('viewfinder', 'Viewfinder Graphics', .5, .5); viewfinderGraphics.alpha = 0.5; }); var Ghost = Container.expand(function () { var self = Container.call(this); var ghostGraphics = self.createAsset('ghost', 'Ghost Graphics', .5, .5); ghostGraphics.alpha = 0.5; self.speedX = (Math.random() - 0.5) * 52.5; self.speedY = (Math.random() - 0.5) * 52.5; self.move = function () { self.x += self.speedX; self.y += self.speedY; if (self.x < 0) { self.x = 2048; } else if (self.x > 2048) { self.x = 0; } if (self.y < 0) { self.y = 2732; } else if (self.y > 2732) { self.y = 0; } }; self.destroy = function () {}; }); var Camera = Container.expand(function () { var self = Container.call(this); self.isReadyToSnap = false; var cameraGraphics = self.createAsset('camera', 'Camera Graphics', .5, .5); self.isHovering = function (ghost) { if (Math.sqrt(Math.pow(self.x - ghost.x, 2) + Math.pow(self.y - ghost.y, 2)) <= self.width / 2) { return true; } return false; }; self.snap = function (ghost, viewfinder) { if (viewfinder && Math.sqrt(Math.pow(viewfinder.x - ghost.x, 2) + Math.pow(viewfinder.y - ghost.y, 2)) <= viewfinder.width / 2) { return true; } return false; }; }); var Game = Container.expand(function () { var self = Container.call(this); self.photosTaken = 0; self.cumulativePhotoHeight = 0; var ghosts = []; var camera; var bg = self.createAsset('abandoned_house', 'Abandoned House Background', 0, 0); bg.width = 2048; bg.height = 2732; var ghost = self.addChild(new Ghost()); ghost.x = Math.random() * 2048; ghost.y = Math.random() * 2732; ghosts.push(ghost); camera = self.addChild(new Camera()); camera.x = 2048 / 2; camera.y = 2732 / 2; var viewfinder = self.addChild(new Viewfinder()); viewfinder.x = 2048 / 2; viewfinder.y = 2732 / 2; stage.on('move', function (obj) { var pos = obj.event.getLocalPosition(self); camera.x = pos.x; camera.y = pos.y; viewfinder.x = pos.x; viewfinder.y = pos.y; }); stage.on('down', function () { for (var i = 0; i < ghosts.length; i++) { if (camera.isHovering(ghosts[i])) { camera.isReadyToSnap = true; } } }); LK.on('tick', function () { for (var i = 0; i < ghosts.length; i++) { ghosts[i].move(); } for (var i = 0; i < ghosts.length; i++) { if (camera.isReadyToSnap && camera.snap(ghosts[i], viewfinder)) { LK.effects.flashScreen(0xffffff, 300); var photo = self.createAsset('photo', 'Photograph Graphic', 0.5, 0.5); photo.x = 2048 / 2; photo.y = 2732 / 2; LK.gui.addChild(photo); self.removeChild(ghosts[i]); ghosts[i].destroy(); ghosts.splice(i, 1); i--; camera.isReadyToSnap = false; var photoTargetX = 100; var photoCounter = new Text2('Photos: 0', { size: 100, fill: '#ffffff', align: 'center' }); photoCounter.anchor.set(0.5, 0.5); photoCounter.x = 100; photoCounter.y = 2799 / 2; LK.gui.addChild(photoCounter); var photoTargetY = 2600; var photoMoveInterval = LK.setInterval(function () { if (photo.x > photoTargetX) { photo.x -= 5; } else if (photo.x < photoTargetX) { photo.x = photoTargetX; } else if (photo.y > photoTargetY) { photo.y -= 5; } else if (photo.width > 150) { photo.width -= 1; photo.height -= 1; } else if (photo.x > 0) { photo.x -= 5; } else { LK.clearInterval(photoMoveInterval); self.cumulativePhotoHeight += photo.height + 10; } }, 16); self.photosTaken++; photoCounter.setText(self.photosTaken.toString()); if (self.photosTaken == 10) { var winStateGraphic = self.createAsset('win_state', 'Win State Graphic', .5, .5); winStateGraphic.x = 2048 / 2; winStateGraphic.y = 2732 / 2; LK.gui.addChild(winStateGraphic); LK.showGameOver(); } } } if (ghosts.length == 0) { var ghost = self.addChild(new Ghost()); ghost.x = Math.random() * 2048; ghost.y = Math.random() * 2732; ghosts.push(ghost); } }); });
===================================================================
--- original.js
+++ change.js
@@ -98,9 +98,9 @@
align: 'center'
});
photoCounter.anchor.set(0.5, 0.5);
photoCounter.x = 100;
- photoCounter.y = 2600 / 2;
+ photoCounter.y = 2799 / 2;
LK.gui.addChild(photoCounter);
var photoTargetY = 2600;
var photoMoveInterval = LK.setInterval(function () {
if (photo.x > photoTargetX) {
Frame of Camera viewfinder, inside viewfinder view, realistic camera, frame Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Creepy abandoned house, interior Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Subtle orb of green light, floating, realistic, glowing ghost orb Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Polaroid photo of ghost, Japanese ghost Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Floating ghost head Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Ghost camera game win screen. YOU WIN! Horror game asset Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Pointed finger, realistic hand, Tap!, game asset Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.