User prompt
when a shuriken hits a rat, both sprites vanish and the player gets a point
User prompt
shuriken move faster
User prompt
why are the shuriken not moving?
User prompt
shuriken move toward top of screen
User prompt
left mouse click shoots shuriken from bottom of screen toward top of screen
User prompt
when the player uses left mouse button, a shuriken spawns from the bottom center of the screen and moves to the cursor's location. If it hits a rat, the rat dies and both vanish and player gets a point
User prompt
when a rat reaches the bottom of the screen, the player loses
User prompt
rats move at slightly different speeds
User prompt
why are the rats not moving?
User prompt
rats move toward bottom of screen after spawning
User prompt
rats move down over time
User prompt
rats spawn at random times
User prompt
rats are the enemy. rats spawn at the top of the screen and move toward the bottom of the screen.
User prompt
background image is not a collision object
User prompt
make background image full screen
User prompt
rats move toward the bottom of screen
User prompt
rats move toward the bottom of the screen
User prompt
Fix Bug: 'Uncaught ReferenceError: init is not defined' in this line: 'init();' Line Number: 62
User prompt
rats spawn at random times from the top of the screen
User prompt
remove player hands
User prompt
shuriken do not collide with player hands
User prompt
change the way shuriken are thrown. Now, a player's mouse cursor position determines the direction a shuriken moves. How long the player holds left mouse button determines the speed of a shuriken. The default speed for a shuriken is 5.
User prompt
when left mouse is released, the shuriken sprite moves in the direction of the mouse's movement. after collision, the sprite despawns
User prompt
shuriken follow the mouse trajectory
User prompt
the longer the player holds the left mouse button before release, the faster the shuriken is thrown
var Shuriken = Container.expand(function () { var self = Container.call(this); var shurikenGraphics = self.createAsset('shuriken', 'Shuriken Graphics', .5, .5); self.speed = 5; self.move = function () { ; self.y += self.speed; }; self.destroy = function () {}; }); var Rat = Container.expand(function () { var self = Container.call(this); var ratGraphics = self.createAsset('rat', 'Rat Graphics', .5, .5); self.speed = 2; self.move = function () { self.y += self.speed; }; self.destroy = function () {}; }); var PowerUp = Container.expand(function () { var self = Container.call(this); var powerUpGraphics = self.createAsset('powerUp', 'PowerUp Graphics', .5, .5); self.activate = function () {}; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.createAsset('wooden_floor', 'Level Background', 0, 0); background.width = 2048; background.height = 2732; background.isCollisionObject = false; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var shurikens = []; var rats = []; var powerUps = []; var isGameOver = false; var tickOffset = 0; var score = 0; function init() { spawnRats(); } function spawnRats() { var spawnTime = Math.random() * 2000 + 1000; LK.setTimeout(function () { var rat = new Rat(); rat.x = Math.random() * 2048; rat.y = 0; rats.push(rat); self.addChild(rat); spawnRats(); }, spawnTime); } function update() {} function gameOver() {} function checkCollision() {} function updateScore() {} stage.on('down', function (obj) {}); stage.on('move', function (obj) {}); stage.on('up', function (obj) {}); LK.on('tick', function () { update(); for (var i = 0; i < rats.length; i++) { rats[i].move(); } checkCollision(); updateScore(); if (isGameOver) { gameOver(); } }); init(); });
===================================================================
--- original.js
+++ change.js
@@ -62,8 +62,11 @@
stage.on('move', function (obj) {});
stage.on('up', function (obj) {});
LK.on('tick', function () {
update();
+ for (var i = 0; i < rats.length; i++) {
+ rats[i].move();
+ }
checkCollision();
updateScore();
if (isGameOver) {
gameOver();