Random Throws

Blitz3D Forums/Blitz3D Beginners Area/Random Throws

Happy Llama(Posted 2012) [#1]
How would I make it so there is a little margin of error when the enemy throws a snowball? I know it has something to do with Random but I can't figure out a way to put it in. Since my For Next loop to move the snowballs forward is in the main loop, when I put the Rand command there the snowball just zig zags all over the place!



Last edited 2012


Yasha(Posted 2012) [#2]
Well if you think about it, you don't want to randomise it's flight, only the trajectory. In other words, the part where you should apply the random modifier is when the ball is created.

Since you move snowballs by moving them in Z, the best place to do this looks to me to be the line where they're rotated to match the player's (or enemy's) current angle. Just make the Pitch and Yaw a little off when the throw starts.

Actually, if the snowballs are meant to follow an arcing path, you might also want to start them aiming upwards a bit from the person throwing, rather than straight ahead (or it will look like they're throwing them at the ground).