coachablekarma

Members
  • Content Count

    5
  • Joined

  • Last visited

About coachablekarma

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. coachablekarma

    Issue with Space Invaders tutorial

    I will take a look, and let you know
  2. coachablekarma

    Issue with Space Invaders tutorial

    I'm using the 4.1.0 boilerplate
  3. coachablekarma

    Issue with Space Invaders tutorial

    laser class: game.Laser = me.Entity.extend({ int : function (x,y) { this._super(me.Entity, "init", [x, y, {width: game.Laser.width, height: game.Laser.height}]); this.z = 5; this.body.setVelocity(0, 300); this.body.collisionType = me.collsion.types.PROJECTILE_OBJECT; this.renderable = new (me.Renderable.extend({ init : function() { this._super(me.Renderable, "init", [0,0, game.Laser.width, game.Laser.height]); }, destroy : function(){}, draw : function (renderer) { var color = renderer.getColor(); renderer.setColor('#5EFF7E'); renderer.fillRect(0, 0, this.width, this.height); renderer.setColor(color); } })); this.alwaysUpdate = true; }, update : function(time) { this.body.vel.y -= this.body.accel.y * time / 1000; if (this.pos.y + this.height <= 0) { me.game.world.removeChild(this); } this.body.update(); me.collsion.check(this); return true; } }); game.Laser.width = 5; game.Laser.height = 28;
  4. coachablekarma

    Issue with Space Invaders tutorial

    Hey, thanks for the response. I have those two values in the lasers class. When I try to debug the game it is showing those values for the width and height. Not sure why it is giving that error though. I can post the lasers class as well as soon as I get to my PC.
  5. coachablekarma

    Issue with Space Invaders tutorial

    Hey guys, just trying to get reacquainted with melonJs so I am going through the space invaders tutorial. I have hit a small roadblock at the adding lasers portion. I am getting this error when I attempt to shoot. Uncaught TypeError: Cannot read property 'width' of undefined melonJS.js:12328 at Class.init (melonJS.js:12328) at Class (melonJS.js:531) at Object.me.pool.api.pull (melonJS.js:4242) at Class.update (player.js:32) at Class.update (melonJS.js:12166) at Object.me.game.api.update [as _patched] (melonJS.js:2874) at Object.<anonymous> (debugPanel.js:291) at Object.defineProperty.value [as update] (melonJS.js:29274) at _renderFrame (melonJS.js:12856) here is the js file for the player game.Player = me.Sprite.extend({ init : function() { var image = me.loader.getImage("player"); this._super(me.Sprite, "init", [me.game.viewport.width / 2 - image.width / 2, me.game.viewport.height - image.height - 20, {image : image} ]); this.velx = 450; this.maxX = me.game.viewport.width - this.width; }, update : function(time) { this._super(me.Sprite, "update", [time]); if (me.input.isKeyPressed("left")) { this.pos.x -= this.velx * time / 1000; } if (me.input.isKeyPressed("right")) { this.pos.x += this.velx * time / 1000; } this.pos.x = this.pos.x.clamp(0, this.maxX); if (me.input.isKeyPressed("shoot")) { me.game.world.addChild(me.pool.pull("laser", this.pos.x - game.Laser.width, this.pos.y - game.Laser.height)); } return true; } }); any help would be appreicated