0 votes

I'm making a shotgun type thing for my FPS, and I need to fire several bullets in a single frame. The problem is that calling randomize() randomizes the seed based on the current frame, so the rand_range() that I'm using to determine the bullet direction just fires them all to the same place. Any help is appreciated, thank you guys!

in Engine by (12 points)

Why not first determine where all the buckshot is suppose to go, and then have the shotgun fire? Change all of the vectors of the buckshot's pellets, and then let them fly. Also, are you calling randomize() frequently in your script? Because the function is meant to be called once.

I think you're saying that i should have the vectors determined before the shotgun is fired. I think that this will work, as I only need eight different vectors, and the firing animation ensures that you won't be able to fire twice in the span of eight frames. So I should be able to generate them right after the shotgun is fired, and then use those vectors the next time the shotgun is fired.Thank you, I'm gonna go test that out.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.