/**** * Classes ****/ // Class for Decoration var Decoration = Container.expand(function () { var self = Container.call(this); var decorationGraphics = self.attachAsset('decoration', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for decoration if needed }; }); // Class for Furniture var Furniture = Container.expand(function () { var self = Container.call(this); var furnitureGraphics = self.attachAsset('furniture', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for furniture if needed }; }); // Class for Player var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for player if needed }; }); //<Assets used in the game will automatically appear here> // Class for Room var Room = Container.expand(function () { var self = Container.call(this); var roomGraphics = self.attachAsset('room', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { // Update logic for room if needed }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB // Light blue background to simulate sky }); /**** * Game Code ****/ // Initialize arrays to hold game objects var rooms = []; var furnitures = []; var decorations = []; var mode = 'building'; // 'building', 'exploring' or 'erasing' var player; // Function to create a new room function createRoom(x, y) { var newRoom = new Room(); newRoom.x = x; newRoom.y = y; rooms.push(newRoom); game.addChild(newRoom); } // Function to add furniture to a room function addFurniture(x, y) { var newFurniture = new Furniture(); newFurniture.x = x; newFurniture.y = y; furnitures.push(newFurniture); game.addChild(newFurniture); } // Function to add decoration to a room function addDecoration(x, y) { var newDecoration = new Decoration(); newDecoration.x = x; newDecoration.y = y; decorations.push(newDecoration); game.addChild(newDecoration); } // Event handler for adding rooms game.down = function (x, y, obj) { if (mode === 'building') { createRoom(x, y); } else if (mode === 'exploring') { if (player) { player.destroy(); } player = new Player(); player.x = x; player.y = y; game.addChild(player); } else if (mode === 'erasing') { for (var i = 0; i < rooms.length; i++) { if (rooms[i].intersects(obj)) { rooms[i].destroy(); rooms.splice(i, 1); break; } } for (var j = 0; j < furnitures.length; j++) { if (furnitures[j].intersects(obj)) { furnitures[j].destroy(); furnitures.splice(j, 1); break; } } for (var k = 0; k < decorations.length; k++) { if (decorations[k].intersects(obj)) { decorations[k].destroy(); decorations.splice(k, 1); break; } } } }; // Event handler for adding furniture game.move = function (x, y, obj) { if (mode === 'building') { if (rooms.length > 0) { addFurniture(x, y); } } else if (mode === 'exploring') { if (player) { player.x = x; player.y = y; } } }; // Event handler for adding decorations game.up = function (x, y, obj) { if (mode === 'building') { if (rooms.length > 0) { addDecoration(x, y); } mode = 'exploring'; } else if (mode === 'exploring') { mode = 'erasing'; } else if (mode === 'erasing') { mode = 'building'; } }; // Update function for game logic game.update = function () { // Update all rooms for (var i = 0; i < rooms.length; i++) { rooms[i].update(); } // Update all furnitures for (var j = 0; j < furnitures.length; j++) { furnitures[j].update(); } // Update all decorations for (var k = 0; k < decorations.length; k++) { decorations[k].update(); } };
/****
* Classes
****/
// Class for Decoration
var Decoration = Container.expand(function () {
var self = Container.call(this);
var decorationGraphics = self.attachAsset('decoration', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for decoration if needed
};
});
// Class for Furniture
var Furniture = Container.expand(function () {
var self = Container.call(this);
var furnitureGraphics = self.attachAsset('furniture', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for furniture if needed
};
});
// Class for Player
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for player if needed
};
});
//<Assets used in the game will automatically appear here>
// Class for Room
var Room = Container.expand(function () {
var self = Container.call(this);
var roomGraphics = self.attachAsset('room', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Update logic for room if needed
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Light blue background to simulate sky
});
/****
* Game Code
****/
// Initialize arrays to hold game objects
var rooms = [];
var furnitures = [];
var decorations = [];
var mode = 'building'; // 'building', 'exploring' or 'erasing'
var player;
// Function to create a new room
function createRoom(x, y) {
var newRoom = new Room();
newRoom.x = x;
newRoom.y = y;
rooms.push(newRoom);
game.addChild(newRoom);
}
// Function to add furniture to a room
function addFurniture(x, y) {
var newFurniture = new Furniture();
newFurniture.x = x;
newFurniture.y = y;
furnitures.push(newFurniture);
game.addChild(newFurniture);
}
// Function to add decoration to a room
function addDecoration(x, y) {
var newDecoration = new Decoration();
newDecoration.x = x;
newDecoration.y = y;
decorations.push(newDecoration);
game.addChild(newDecoration);
}
// Event handler for adding rooms
game.down = function (x, y, obj) {
if (mode === 'building') {
createRoom(x, y);
} else if (mode === 'exploring') {
if (player) {
player.destroy();
}
player = new Player();
player.x = x;
player.y = y;
game.addChild(player);
} else if (mode === 'erasing') {
for (var i = 0; i < rooms.length; i++) {
if (rooms[i].intersects(obj)) {
rooms[i].destroy();
rooms.splice(i, 1);
break;
}
}
for (var j = 0; j < furnitures.length; j++) {
if (furnitures[j].intersects(obj)) {
furnitures[j].destroy();
furnitures.splice(j, 1);
break;
}
}
for (var k = 0; k < decorations.length; k++) {
if (decorations[k].intersects(obj)) {
decorations[k].destroy();
decorations.splice(k, 1);
break;
}
}
}
};
// Event handler for adding furniture
game.move = function (x, y, obj) {
if (mode === 'building') {
if (rooms.length > 0) {
addFurniture(x, y);
}
} else if (mode === 'exploring') {
if (player) {
player.x = x;
player.y = y;
}
}
};
// Event handler for adding decorations
game.up = function (x, y, obj) {
if (mode === 'building') {
if (rooms.length > 0) {
addDecoration(x, y);
}
mode = 'exploring';
} else if (mode === 'exploring') {
mode = 'erasing';
} else if (mode === 'erasing') {
mode = 'building';
}
};
// Update function for game logic
game.update = function () {
// Update all rooms
for (var i = 0; i < rooms.length; i++) {
rooms[i].update();
}
// Update all furnitures
for (var j = 0; j < furnitures.length; j++) {
furnitures[j].update();
}
// Update all decorations
for (var k = 0; k < decorations.length; k++) {
decorations[k].update();
}
};
Pessoa pequena de cabelo preto usando capuz azul e calça azul pequena que esconde sua face com o seu capuz. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Uma Porta de madeira para frente com machaneta marrrom.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Faça uma textura de pedra que cobre a tela inteira com um pouco de tom de velho.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Quadro bonito de um homem bonito. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.