Monday 28 January 2013

More progress



My attempt at the attack function wasn't far wrong.



// Create a new class that extends Sprite
var attacker = pulse.Sprite.extend({
 init: function(params) {
 this.lastMoveElapsed = 0;

   // Override the params with a texture source.
   params = params || {};
   params.src = 'res/punch.png';
   this._super(params);
   this.size = { width: 65, height: 81 };
   this.visible = false;
   attack = false;
 }
,update : function(elapsed) {
if (attack == true) {
    this.visible = true;
    this.lastMoveElapsed += elapsed;
    this.position.y = player1Inst.position.y-5;
    this.position.x =  player1Inst.position.x+32;
    player1Inst.visible = false;
 if(this.lastMoveElapsed >= 500) {
this.visible = false;
attack = false;
ArrowButtonATTACK.visible = true;
punch.position = { x : player1Inst.position.x-10, y : player1Inst.position.y+20 };
player1Inst.visible = true;

   this.lastMoveElapsed = 0;
   }
 }
this._super(elapsed);
}
});



The game is now playable to an extend.





(WEBCAM)





(PHONE)


Apologies for the crap recording. I am going to try and get better quality video caps for the presentation  in March.

No comments:

Post a Comment