Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by sixfngers

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?

1 decade ago by fugufish

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

1 decade ago by sixfngers

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

1 decade ago by MikeL

Using a timer is quick, easy and effective. Check out the timer tutorial for just such an example.
Page 1 of 1
« first « previous next › last »