Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

Why won't this variable change even when the if part is true?

$
0
0
This code is in the update function. I tested some stuff out and instead of -= or +=, i just did = and it worked. Is there something wrong with the code? if (Input.touches[0].position.x < 100) { xSpeed -= 0.3f; }else if (Input.touches[0].position.x >= 100) { xSpeed += 0.3f; }

Viewing all articles
Browse latest Browse all 1875

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>