Nomatter what I have tried for some reason the pullet refuses to shoot to the right or to the left. It is starting to get really annoying. All it keeps doing is shoot upwards and nothing more…
public GUITexture AtkText;
public Transform projectile;
public int speed = 20;
public bool cooldown = false;
foreach (Touch touch in Input.touches)
{
if(AtkText.HitTest(touch.position) && touch.phase != TouchPhase.Ended && !cooldown)
{
Transform clone;
var rot = projectile.rotation;
projectile.rotation = rot * Quaternion.Euler(0, 0, 90);
clone = (Transform)Instantiate(projectile, transform.position, projectile.rotation);
cooldown = true;
projectile.rigidbody2D.AddForce(projectile.transform.right * speed);
clone.rigidbody2D.AddForce(clone.transform.right * speed);
}
else if(AtkText.HitTest(touch.position) && touch.phase == TouchPhase.Ended && cooldown)
{
cooldown = false;
}
}