/****
* Classes
****/
// Class representing a Case
var Case = Container.expand(function () {
var self = Container.call(this);
var caseGraphics = self.attachAsset('case', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1024; // Center horizontally
self.y = 1366; // Center vertically
// Method to present the case
self.present = function () {
// Logic for presenting the case
};
});
// Class representing a Decision
var Decision = Container.expand(function () {
var self = Container.call(this);
var decisionGraphics = self.attachAsset('decision', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1024; // Center horizontally
self.y = 500; // Near the top of the screen
// Method to execute the decision
self.execute = function () {
// Logic for executing the decision
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class representing a Lawyer character
var Lawyer = Container.expand(function () {
var self = Container.call(this);
var lawyerGraphics = self.attachAsset('lawyer', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1024; // Center horizontally
self.y = 2400; // Near the bottom of the screen
// Method to handle decision making
self.makeDecision = function (decision) {
// Logic for making a decision
// Move to the decision
self.x = decision.x;
self.y = decision.y;
};
// Method to argue a case
self.argueCase = function (currentCase) {
// Logic for arguing a case
// Move to the case
self.x = currentCase.x;
self.y = currentCase.y;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize game elements
var lawyer = game.addChild(new Lawyer());
var currentCase = game.addChild(new Case());
var decision = game.addChild(new Decision());
// Array to keep track of cases
var cases = [];
// Function to handle game updates
game.update = function () {
// Logic to update game state
// Check if lawyer intersects with a case
if (lawyer.intersects(currentCase)) {
// Logic for when lawyer interacts with a case
currentCase.present();
}
// Check if a decision is made
if (lawyer.intersects(decision)) {
// Logic for when a decision is made
decision.execute();
}
};
// Event listener for touch down
game.down = function (x, y, obj) {
// Logic for handling touch down events
lawyer.makeDecision(decision);
};
// Event listener for touch up
game.up = function (x, y, obj) {
// Logic for handling touch up events
lawyer.argueCase(currentCase);
};
// Add initial cases to the game
function addCase() {
var newCase = new Case();
newCase.x = Math.random() * 2048; // Random horizontal position
newCase.y = Math.random() * 1366; // Random vertical position
cases.push(newCase);
game.addChild(newCase);
}
// Add a new case every few seconds
var caseInterval = LK.setInterval(addCase, 5000); /****
* Classes
****/
// Class representing a Case
var Case = Container.expand(function () {
var self = Container.call(this);
var caseGraphics = self.attachAsset('case', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1024; // Center horizontally
self.y = 1366; // Center vertically
// Method to present the case
self.present = function () {
// Logic for presenting the case
};
});
// Class representing a Decision
var Decision = Container.expand(function () {
var self = Container.call(this);
var decisionGraphics = self.attachAsset('decision', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1024; // Center horizontally
self.y = 500; // Near the top of the screen
// Method to execute the decision
self.execute = function () {
// Logic for executing the decision
};
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class representing a Lawyer character
var Lawyer = Container.expand(function () {
var self = Container.call(this);
var lawyerGraphics = self.attachAsset('lawyer', {
anchorX: 0.5,
anchorY: 0.5
});
self.x = 1024; // Center horizontally
self.y = 2400; // Near the bottom of the screen
// Method to handle decision making
self.makeDecision = function (decision) {
// Logic for making a decision
// Move to the decision
self.x = decision.x;
self.y = decision.y;
};
// Method to argue a case
self.argueCase = function (currentCase) {
// Logic for arguing a case
// Move to the case
self.x = currentCase.x;
self.y = currentCase.y;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize game elements
var lawyer = game.addChild(new Lawyer());
var currentCase = game.addChild(new Case());
var decision = game.addChild(new Decision());
// Array to keep track of cases
var cases = [];
// Function to handle game updates
game.update = function () {
// Logic to update game state
// Check if lawyer intersects with a case
if (lawyer.intersects(currentCase)) {
// Logic for when lawyer interacts with a case
currentCase.present();
}
// Check if a decision is made
if (lawyer.intersects(decision)) {
// Logic for when a decision is made
decision.execute();
}
};
// Event listener for touch down
game.down = function (x, y, obj) {
// Logic for handling touch down events
lawyer.makeDecision(decision);
};
// Event listener for touch up
game.up = function (x, y, obj) {
// Logic for handling touch up events
lawyer.argueCase(currentCase);
};
// Add initial cases to the game
function addCase() {
var newCase = new Case();
newCase.x = Math.random() * 2048; // Random horizontal position
newCase.y = Math.random() * 1366; // Random vertical position
cases.push(newCase);
game.addChild(newCase);
}
// Add a new case every few seconds
var caseInterval = LK.setInterval(addCase, 5000);