Good morning people,
Does anyone know why the same code from one project does not work on another project?
The part of my code that does not work is the onkeyUp part.
When I copy and paste this part into another project it does not work.
Does anyone know why?
Thank you very much
var controles=
{
esquerda: "left",
direita: "right",
};
var veljogador = 100;
if(wade.isKeyDown(controles.esquerda)&&!wade.isKeyDown(controles.direita))
{
this.setVelocity(-veljogador,0);
}else if(wade.isKeyDown(controles.direita) &&!wade.isKeyDown(controles.esquerda))
{
this.setVelocity(veljogador,0);
}else{
this.setVelocity(0,0);
}
//This part that does not work
this.onKeyUp = function(data){
if(data.keyName==="space"){
var tiro = wade.getSceneObject("Tiro").clone();
tiro.setPosition(this.getPosition().x,this.getPosition().y-50);
wade.addSceneObject(tiro);
tiro.moveTo(this.getPosition().x,this.getPosition().y,-300);
}
}