User prompt
Adicione a opção de apagar algo que foi criado sem querer ou o jogador não quer mais. Adicione a opção de salva a casa com um nome ser o jogador quando sair e volta querer sua casa de volta para editar ela ou deletar algo.
User prompt
Adicione um botão para escolher o tipo de bloco para construir a casa e seu nome como: Parede(Colisivel),Porta(Não colisivel),Vidro(Colisivel). Crie outro botão também que cria um jogador e assim o jogador não constrói mais e explorar a cada com o jogador criado e depois ser quiser pode volta a construir mas terá que tirar o jogador.
Initial prompt
Crie Sua Casa
/**** * 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' or 'exploring' 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); } }; // 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 = '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(); } };
===================================================================
--- original.js
+++ change.js
@@ -1,107 +1,142 @@
-/****
+/****
* 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
- };
+ 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
- };
+ 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
- };
+ 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
+ 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' or 'exploring'
+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);
+ 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);
+ 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);
+ 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) {
- createRoom(x, y);
+ 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);
+ }
};
// Event handler for adding furniture
game.move = function (x, y, obj) {
- if (rooms.length > 0) {
- addFurniture(x, y);
- }
+ 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 (rooms.length > 0) {
- addDecoration(x, y);
- }
+ if (mode === 'building') {
+ if (rooms.length > 0) {
+ addDecoration(x, y);
+ }
+ mode = 'exploring';
+ } else if (mode === 'exploring') {
+ 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();
- }
+ // 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();
+ }
};
\ No newline at end of file
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.