danwinkler / tacticshooter

tacticshooter.com
1 stars 0 forks source link

Bullets can ricochet #94

Closed danwinkler closed 10 years ago

danwinkler commented 10 years ago

If angle of incidence is low enough, and Math.random() < n then rotate bullet vector around wall normal vec and lower speed by x percent

johnnycamine commented 10 years ago

So lower caliber bullets, (which are what is fired by light, heavy, and scout units) are more likely to ricochet than higher caliber bullets (what snipers fire). I would suggest including that type of variable into the game. Also the chance of ricochet goes up the lower the angle of incidence is. So instead of just a flat "if angle of incidence is low enough" you should have it be an exponential function which decreases as the angle increases, so that technically there's always a chance of ricochet, albeit small when the angle is 90. Going on to shotgun units, the way to do their ricochet is a bit more tricky as the density and hardness of a bullet factors into its chance to do so, and a shotgun pellet is fairly dense and hard. But do that one in whichever way you feel is best, it's probably easiest to just treat each shotgun pellet as a regular bullet. As for reducing the velocity, it shouldn't be halved as we said earlier. In fact, the bullet should probably maintain at least 90% of its velocity, and of course it's damage level should correspond to that.

danwinkler commented 10 years ago

Lol this is what happens when they never stop ricocheting: neverstopricocheting

johnnycamine commented 10 years ago

Haha, you should leave this in as an option for games, but also add like 1000 health to each unit