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 photoCounter = new Text2('0', { size: 150, fill: '#ffffff' }); LK.gui.topCenter.addChild(photoCounter); var bg = self.createAsset('abandoned_house', 'Abandoned House Background', 0, 0); bg.width = 2048; bg.height = 2732; var tapGraphic = LK.gui.addChild(LK.getAsset('tap', 'Tap Graphic', 1, .5)); tapGraphic.x = 2048 / 2; tapGraphic.y = 2000 / 2; var tapGraphicMovement = 0; var tapGraphicDirection = 1; var tapGraphicRotationInterval = LK.setInterval(function () { tapGraphic.rotation += 0.04 * tapGraphicDirection; tapGraphicMovement++; if (tapGraphicMovement % 20 == 0) { tapGraphicDirection *= -1; } if (tapGraphicMovement == 120) { LK.clearInterval(tapGraphicRotationInterval); tapGraphic.destroy(); } }, 16); 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; photoCounter.setText(self.photosTaken.toString()); 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 (ghosts.length == 0) { var ghost = self.addChild(new Ghost()); ghost.x = Math.random() * 2048; ghost.y = Math.random() * 2732; ghosts.push(ghost); } }); });
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 photoCounter = new Text2('0', {
size: 150,
fill: '#ffffff'
});
LK.gui.topCenter.addChild(photoCounter);
var bg = self.createAsset('abandoned_house', 'Abandoned House Background', 0, 0);
bg.width = 2048;
bg.height = 2732;
var tapGraphic = LK.gui.addChild(LK.getAsset('tap', 'Tap Graphic', 1, .5));
tapGraphic.x = 2048 / 2;
tapGraphic.y = 2000 / 2;
var tapGraphicMovement = 0;
var tapGraphicDirection = 1;
var tapGraphicRotationInterval = LK.setInterval(function () {
tapGraphic.rotation += 0.04 * tapGraphicDirection;
tapGraphicMovement++;
if (tapGraphicMovement % 20 == 0) {
tapGraphicDirection *= -1;
}
if (tapGraphicMovement == 120) {
LK.clearInterval(tapGraphicRotationInterval);
tapGraphic.destroy();
}
}, 16);
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;
photoCounter.setText(self.photosTaken.toString());
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 (ghosts.length == 0) {
var ghost = self.addChild(new Ghost());
ghost.x = Math.random() * 2048;
ghost.y = Math.random() * 2732;
ghosts.push(ghost);
}
});
});
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.