I am testing with the jumpnrun demo. I have made the bullet shoot straight and not bounce off walls. What if I wanted to limit the range of the bullet to a range. so after its range lets say 100px if it hasnt hit anything i would kill it. Any suggestions?
a few ideas:
1. track the distance btw the player and the bullet. Use Math.abs(player.pos.x - bullet.pos.x)
2. kill the bullet after X seconds using a timer
thanks I was trying to set the start position when the bullet was created but was getting an undefined value. The timer thing will def work. thanks
9 years ago
Using a timer is quick, easy and effective. Check out the timer tutorial
for just such an example.
Page 1 of 1