使用ImpactJS附带的示例代码,我想知道
{direction:this.lastPressed}
意思是。下面的代码指的是玩家实体,当按下“攻击”按钮时。
“方向”是某种方法吗?我从这个代码中猜测,它是根据实体的方向告诉抛射物的方向,但是我不知道怎么走。
//attack
if(ig.input.pressed('attack')) {
if (this.weapon == 'projectile'){
// create a projectile
ig.game.spawnEntity('EntityProjectile',this.pos.x,this.pos.y,{direction:this.lastPressed});
}else{
// we simulate a sword with a very fast moving projectile with a limited range
ig.game.spawnEntity('EntitySword',this.pos.x,this.pos.y,null);
}
ig.game.sortEntitiesDeferred();
} 发布于 2013-11-06 14:45:19
我决定回到这个基础上,并使用这个游戏的代码作为基础。这是一个更直截了当的发展,特别是第一次游戏开发商.
https://stackoverflow.com/questions/19683682
复制相似问题