User prompt
make a wall on the sides
User prompt
if you keep clicing you get out makewal to
User prompt
make th game more detailed
User prompt
make it wayyyy harder
User prompt
make the screen follow me
User prompt
make me keep move side ways
User prompt
make gravity and the player jumps when you click
User prompt
make a ground
User prompt
make the player go side ways continuasly and change the background to mach the playr
Initial prompt
geometry crash
/**** * Classes ****/ // Define a class for bullets var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5, tint: 0xFFFF00 }); self.speed = -30; self.update = function () { self.y += self.speed; if (self.y < 0) { self.destroy(); } }; }); // Define a class for enemies var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5, tint: 0xFF0000 }); self.speed = 10; self.update = function () { self.y += self.speed; if (self.y > 2732) { self.y = 0; self.x = Math.random() * 2048; } }; }); // Define a class for the ground var Ground = Container.expand(function () { var self = Container.call(this); var groundGraphics = self.attachAsset('ground', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5, tint: 0x008000 }); self.update = function () { // Ground update logic }; }); //<Assets used in the game will automatically appear here> //<Write imports for supported plugins here> // Define a class for the player character var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('player', { anchorX: 0.5, anchorY: 0.5, scaleX: 1.5, scaleY: 1.5, tint: 0x0000FF }); self.speed = 10; self.update = function () { // Player update logic self.x += self.speed; if (self.x > 2048) { self.x = 0; } }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x92eabd //Init game with green background }); /**** * Game Code ****/ // Initialize player var player = game.addChild(new Player()); player.x = 1024; player.y = 2500; // Initialize ground var ground = game.addChild(new Ground()); ground.x = 1024; ground.y = 2732 - ground.height / 2; // Initialize enemies var enemies = []; for (var i = 0; i < 20; i++) { var enemy = new Enemy(); enemy.x = Math.random() * 2048; enemy.y = Math.random() * 1000; enemies.push(enemy); game.addChild(enemy); } // Initialize bullets var bullets = []; // Handle player movement game.down = function (x, y, obj) { player.speed = -30; }; // Handle shooting game.up = function (x, y, obj) { player.speed = 10; }; // Game update loop game.update = function () { // Update player player.update(); // Make the screen follow the player game.x = -player.x + 1024; game.y = -player.y + 1366; // Update enemies for (var i = 0; i < enemies.length; i++) { enemies[i].update(); if (player.intersects(enemies[i])) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } } // Update bullets for (var j = bullets.length - 1; j >= 0; j--) { bullets[j].update(); for (var k = enemies.length - 1; k >= 0; k--) { if (bullets[j].intersects(enemies[k])) { bullets[j].destroy(); bullets.splice(j, 1); enemies[k].destroy(); enemies.splice(k, 1); break; } } } };
===================================================================
--- original.js
+++ change.js
@@ -5,9 +5,12 @@
var Bullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bullet', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 0.5,
+ scaleX: 1.5,
+ scaleY: 1.5,
+ tint: 0xFFFF00
});
self.speed = -30;
self.update = function () {
self.y += self.speed;
@@ -20,9 +23,12 @@
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 0.5,
+ scaleX: 1.5,
+ scaleY: 1.5,
+ tint: 0xFF0000
});
self.speed = 10;
self.update = function () {
self.y += self.speed;
@@ -36,9 +42,12 @@
var Ground = Container.expand(function () {
var self = Container.call(this);
var groundGraphics = self.attachAsset('ground', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 0.5,
+ scaleX: 1.5,
+ scaleY: 1.5,
+ tint: 0x008000
});
self.update = function () {
// Ground update logic
};
@@ -49,9 +58,12 @@
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 0.5,
+ scaleX: 1.5,
+ scaleY: 1.5,
+ tint: 0x0000FF
});
self.speed = 10;
self.update = function () {
// Player update logic