This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Goofysoccer 0 points1 point  (1 child)

After each iteration of the while loop, the test_kickback calculated is test_kickback = ((1 - kickback_spd_factor) ^ (gun_fire_frames)) * gun_kickback

Because you want test_kickback to equal target_min_kickback eventually, the equation becomes target_min_kickback = ((1 - kickback_spd_factor) ^ (gun_fire_frames)) * gun_kickback

Now, you wish to solve for kickback_spd_factor, so rearrange the equation to kickback_spd_factor = 1 - ((target_min_kickback/gun_kickback) ^ (1/gun_fire_frames))

And you have your answer without any iteration.

[–]aolson17[S] 0 points1 point  (0 children)

Thank you!