User prompt
add levels to the game
User prompt
add a way to dodge obstacles with the mouse
User prompt
make the cube dodge the obstacles
User prompt
add obstacles that the cube has to move around
User prompt
a create a but that you hit to start the game to the start menu
User prompt
add a start button to the menu
User prompt
add a start menu
User prompt
create a simple text based rpg game where you get to customize ur characters appearance
Initial prompt
test
/**** * Classes ****/ //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> //<Write entity 'classes' with empty functions for important behavior here> var Character = Container.expand(function () { var self = Container.call(this); var characterGraphics = self.attachAsset('characterShape', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.x += Math.sin(LK.ticks / 60) * 5; self.y += Math.cos(LK.ticks / 60) * 5; }; }); var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacleShape', { anchorX: 0.5, anchorY: 0.5 }); self.update = function () { self.y += 2; if (self.y > 2732) { self.y = -100; self.x = Math.random() * 2048; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ //<Write game logic code here, including initializing arrays and variables> var obstacles = []; for (var i = 0; i < 5; i++) { var obstacle = new Obstacle(); obstacle.x = Math.random() * 2048; obstacle.y = Math.random() * 2732; obstacles.push(obstacle); game.addChild(obstacle); } // Initialize the character and add it to the game var character = new Character(); character.x = 2048 / 2; character.y = 2732 / 2; game.addChild(character); // Update the game logic game.update = function () { // Check for collisions between the character and the obstacles for (var i = 0; i < obstacles.length; i++) { if (character.intersects(obstacles[i])) { LK.showGameOver(); break; } } }; // Remove the interaction that changes the color of the test shape game.down = function (x, y, obj) { character.x = x; character.y = y; }; game.move = function (x, y, obj) { character.x = x; character.y = y; };
===================================================================
--- original.js
+++ change.js
@@ -64,7 +64,12 @@
}
}
};
// Remove the interaction that changes the color of the test shape
-game.down = function (x, y, obj) {};
-// Remove the interaction that changes the color of the test shape
-game.up = function (x, y, obj) {};
\ No newline at end of file
+game.down = function (x, y, obj) {
+ character.x = x;
+ character.y = y;
+};
+game.move = function (x, y, obj) {
+ character.x = x;
+ character.y = y;
+};
\ No newline at end of file