/**** * Classes ****/ //<Assets used in the game will automatically appear here> // Class for the body of the girlfriend var Body = Container.expand(function () { var self = Container.call(this); var bodyGraphics = self.attachAsset('body', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for the body }; }); // Class for the face of the girlfriend var Face = Container.expand(function () { var self = Container.call(this); var faceGraphics = self.attachAsset('face', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for the face }; }); // Class for the voice of the girlfriend var Voice = Container.expand(function () { var self = Container.call(this); var voiceGraphics = self.attachAsset('voice', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for the voice }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize arrays and variables var bodies = []; var faces = []; var voices = []; // Create and position the body var body = new Body(); body.x = 1024; // Center horizontally body.y = 1366; // Center vertically bodies.push(body); game.addChild(body); // Create and position the face var face = new Face(); face.x = 1024; // Center horizontally face.y = 1000; // Position above the body faces.push(face); game.addChild(face); // Create and position the voice var voice = new Voice(); voice.x = 1024; // Center horizontally voice.y = 1600; // Position below the body voices.push(voice); game.addChild(voice); // Update function for the game game.update = function () { // Update all bodies for (var i = 0; i < bodies.length; i++) { bodies[i].update(); } // Update all faces for (var i = 0; i < faces.length; i++) { faces[i].update(); } // Update all voices for (var i = 0; i < voices.length; i++) { voices[i].update(); } }; // Event listener for touch/mouse down game.down = function (x, y, obj) { // Handle touch/mouse down event }; // Event listener for touch/mouse up game.up = function (x, y, obj) { // Handle touch/mouse up event }; // Event listener for touch/mouse move game.move = function (x, y, obj) { // Handle touch/mouse move event };
/****
* Classes
****/
//<Assets used in the game will automatically appear here>
// Class for the body of the girlfriend
var Body = Container.expand(function () {
var self = Container.call(this);
var bodyGraphics = self.attachAsset('body', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for the body
};
});
// Class for the face of the girlfriend
var Face = Container.expand(function () {
var self = Container.call(this);
var faceGraphics = self.attachAsset('face', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for the face
};
});
// Class for the voice of the girlfriend
var Voice = Container.expand(function () {
var self = Container.call(this);
var voiceGraphics = self.attachAsset('voice', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for the voice
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize arrays and variables
var bodies = [];
var faces = [];
var voices = [];
// Create and position the body
var body = new Body();
body.x = 1024; // Center horizontally
body.y = 1366; // Center vertically
bodies.push(body);
game.addChild(body);
// Create and position the face
var face = new Face();
face.x = 1024; // Center horizontally
face.y = 1000; // Position above the body
faces.push(face);
game.addChild(face);
// Create and position the voice
var voice = new Voice();
voice.x = 1024; // Center horizontally
voice.y = 1600; // Position below the body
voices.push(voice);
game.addChild(voice);
// Update function for the game
game.update = function () {
// Update all bodies
for (var i = 0; i < bodies.length; i++) {
bodies[i].update();
}
// Update all faces
for (var i = 0; i < faces.length; i++) {
faces[i].update();
}
// Update all voices
for (var i = 0; i < voices.length; i++) {
voices[i].update();
}
};
// Event listener for touch/mouse down
game.down = function (x, y, obj) {
// Handle touch/mouse down event
};
// Event listener for touch/mouse up
game.up = function (x, y, obj) {
// Handle touch/mouse up event
};
// Event listener for touch/mouse move
game.move = function (x, y, obj) {
// Handle touch/mouse move event
};