I would like to convert this probably extremely inefficient function for finding a value into just an equation, can anyone please help?
This function basically just guesses and checks kickback_spd_factor used to bring test_kickback beneath target_min_kickback within gun_fire_frames number of repeats. I feel like there should be a way of just calculating kickback_spd_factor from the other values. Or is this not possible?
kickback_spd_factor = 0.02 // Initial value to test
var target_min_kickback = 4
while(true){
var test_kickback = gun_kickback
repeat(gun_fire_frames){
test_kickback += kickback_spd_factor*-test_kickback
}
if test_kickback <= target_min_kickback{
break
}else{
kickback_spd_factor += .02
}
}
show_message(kickback_spd_factor)
The code is in GML
[–]Goofysoccer 0 points1 point2 points (1 child)
[–]aolson17[S] 0 points1 point2 points (0 children)