need help on this, can’t figure out how can I make my char do full attack anim on mouse click.
it cancels anim on releasing mouse click, need to hold click for it do full anim. please and thank you
below is my script:
var Player = pc.createScript('player');
// initialize code called once per entity
Player.prototype.initialize = function() {
};
// update code called every frame
Player.prototype.update = function(dt) {
if(this.app.keyboard.isPressed(pc.KEY_D)){
this.entity.translateLocal(0.04, 0, 0)
this.entity.sprite.flipX = false;
this.entity.sprite.play("run");
}
else if(this.app.keyboard.isPressed(pc.KEY_A)){
this.entity.translateLocal(-0.04, 0, 0)
this.entity.sprite.flipX = true;
this.entity.sprite.play("run");
}
else if(this.app.keyboard.isPressed(pc.KEY_W)){
this.entity.translateLocal(0, 0.04, 0)
this.entity.sprite.play("run");
}
else if(this.app.keyboard.isPressed(pc.KEY_S)){
this.entity.translateLocal(0, -0.04, 0)
this.entity.sprite.play("run");
}
else if(this.app.mouse.isPressed(pc.MOUSEBUTTON_LEFT)){
this.entity.sprite.play("slash");
}
else{
this.entity.sprite.play("idle");
}
};