I’m trying to make a game and for the gun class, I need every bullet to be a constructor object, how do I edit every constructor at once? Like change each bullet’s x value?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Let’s me make a hard guess.
You want to change all the Bullet’s x value at once(As I understood). Then you have to keep all the Bullet instances in a data structure.
Then update the constructor of Bullet like below.
Then iterate through the bullets list and make the change you want to make.
Hope this helps.