In my game, the character shoots an arrow. i used rigidbody2d.velocity.x = (variablehere) to make it move. Thinking it would shoot relatively to my character, the arrow can face the direction it’s shooting, but only goes to the right. Here is my code below:
var projectileSpeed : float = 10;
function Update () {
if(Transform.rotation.y = 180){
rigidbody2D.velocity.x = projectileSpeed*-1;
}else{
rigidbody2D.velocity.x = projectileSpeed;
}
}
I tried making it so if it faces left, it will go left, but I only got an error. Any help would be appreciated, thanks