User prompt
make backround city
User prompt
When game starts do not spawn aliens near the player
User prompt
Import of sound asset
User prompt
when player spawns don't let aliens follow player untill 3 seconds in game
User prompt
Make alien following player slower
User prompt
make alien following player slower
User prompt
If player not in wall closest alien chase it
User prompt
Once aliens are dystoyed end game
User prompt
once all bomb shards are collected blow aliens up
User prompt
add bomb shards around the map
User prompt
make it so if player is in a wall the aliens cannot kill them
User prompt
add to more aliens
User prompt
make the aliens faster
User prompt
make the enemys go strait in a different direction untill the hit a wall and then go a different direction
User prompt
make the alien move around the map
Initial prompt
Predator: The game
/**** * Classes ****/ // Define the Alien class var Alien = Container.expand(function () { var self = Container.call(this); var alienGraphics = self.attachAsset('alien', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 2; self.update = function () { // Alien moves randomly var direction = Math.floor(Math.random() * 4); switch (direction) { case 0: // Move up self.y -= self.speed; break; case 1: // Move down self.y += self.speed; break; case 2: // Move left self.x -= self.speed; break; case 3: // Move right self.x += self.speed; break; } }; }); // Define the Obstacle class var Obstacle = Container.expand(function () { var self = Container.call(this); var obstacleGraphics = self.attachAsset('obstacle', { anchorX: 0.5, anchorY: 0.5 }); }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Define the Player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 5; self.update = function () { // Player update logic }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 //Init game with black background }); /**** * Game Code ****/ // Initialize player, aliens, and obstacles var player = game.addChild(new Player()); player.x = 1024; player.y = 1366; var aliens = []; for (var i = 0; i < 5; i++) { var alien = new Alien(); alien.x = Math.random() * 2048; alien.y = Math.random() * 2732; aliens.push(alien); game.addChild(alien); } var obstacles = []; for (var j = 0; j < 10; j++) { var obstacle = new Obstacle(); obstacle.x = Math.random() * 2048; obstacle.y = Math.random() * 2732; obstacles.push(obstacle); game.addChild(obstacle); } // Handle player movement game.move = function (x, y, obj) { player.x = x; player.y = y; }; // Update game logic game.update = function () { // Update player player.update(); // Update aliens for (var i = 0; i < aliens.length; i++) { aliens[i].update(); // Check for collision with player if (player.intersects(aliens[i])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } // Check for player hiding behind obstacles for (var j = 0; j < obstacles.length; j++) { if (player.intersects(obstacles[j])) { // Player is hiding } } };
===================================================================
--- original.js
+++ change.js
@@ -1,93 +1,112 @@
-/****
+/****
* Classes
-****/
+****/
// Define the Alien class
var Alien = Container.expand(function () {
- var self = Container.call(this);
- var alienGraphics = self.attachAsset('alien', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 2;
- self.update = function () {
- // Alien update logic
- };
+ var self = Container.call(this);
+ var alienGraphics = self.attachAsset('alien', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 2;
+ self.update = function () {
+ // Alien moves randomly
+ var direction = Math.floor(Math.random() * 4);
+ switch (direction) {
+ case 0:
+ // Move up
+ self.y -= self.speed;
+ break;
+ case 1:
+ // Move down
+ self.y += self.speed;
+ break;
+ case 2:
+ // Move left
+ self.x -= self.speed;
+ break;
+ case 3:
+ // Move right
+ self.x += self.speed;
+ break;
+ }
+ };
});
// Define the Obstacle class
var Obstacle = Container.expand(function () {
- var self = Container.call(this);
- var obstacleGraphics = self.attachAsset('obstacle', {
- anchorX: 0.5,
- anchorY: 0.5
- });
+ var self = Container.call(this);
+ var obstacleGraphics = self.attachAsset('obstacle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
});
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Define the Player class
var Player = Container.expand(function () {
- var self = Container.call(this);
- var playerGraphics = self.attachAsset('player', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.speed = 5;
- self.update = function () {
- // Player update logic
- };
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 5;
+ self.update = function () {
+ // Player update logic
+ };
});
-/****
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000 //Init game with black background
+ backgroundColor: 0x000000 //Init game with black background
});
-/****
+/****
* Game Code
-****/
+****/
// Initialize player, aliens, and obstacles
var player = game.addChild(new Player());
player.x = 1024;
player.y = 1366;
var aliens = [];
for (var i = 0; i < 5; i++) {
- var alien = new Alien();
- alien.x = Math.random() * 2048;
- alien.y = Math.random() * 2732;
- aliens.push(alien);
- game.addChild(alien);
+ var alien = new Alien();
+ alien.x = Math.random() * 2048;
+ alien.y = Math.random() * 2732;
+ aliens.push(alien);
+ game.addChild(alien);
}
var obstacles = [];
for (var j = 0; j < 10; j++) {
- var obstacle = new Obstacle();
- obstacle.x = Math.random() * 2048;
- obstacle.y = Math.random() * 2732;
- obstacles.push(obstacle);
- game.addChild(obstacle);
+ var obstacle = new Obstacle();
+ obstacle.x = Math.random() * 2048;
+ obstacle.y = Math.random() * 2732;
+ obstacles.push(obstacle);
+ game.addChild(obstacle);
}
// Handle player movement
game.move = function (x, y, obj) {
- player.x = x;
- player.y = y;
+ player.x = x;
+ player.y = y;
};
// Update game logic
game.update = function () {
- // Update player
- player.update();
- // Update aliens
- for (var i = 0; i < aliens.length; i++) {
- aliens[i].update();
- // Check for collision with player
- if (player.intersects(aliens[i])) {
- LK.effects.flashScreen(0xff0000, 1000);
- LK.showGameOver();
- }
- }
- // Check for player hiding behind obstacles
- for (var j = 0; j < obstacles.length; j++) {
- if (player.intersects(obstacles[j])) {
- // Player is hiding
- }
- }
+ // Update player
+ player.update();
+ // Update aliens
+ for (var i = 0; i < aliens.length; i++) {
+ aliens[i].update();
+ // Check for collision with player
+ if (player.intersects(aliens[i])) {
+ LK.effects.flashScreen(0xff0000, 1000);
+ LK.showGameOver();
+ }
+ }
+ // Check for player hiding behind obstacles
+ for (var j = 0; j < obstacles.length; j++) {
+ if (player.intersects(obstacles[j])) {
+ // Player is hiding
+ }
+ }
};
\ No newline at end of file
An alien with high tec weaponry and armory. Single Game Texture. In-Game asset. 2d. Blank background. High contrast
A barier wall with vines on it. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
A man in the army suited with weapons. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
peice of a hi tech bomb. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows