#Why does gamemaker crash
27 messages · Page 1 of 1 (latest)
There's a few things wrong with that code
Firstly, /5/5/5 is never going to be right, you're never ever gonna be putting multiple divisions in a row like that
And second, the do and until parts of your code are a loop
The code between those statements will repeat until the statement after until becomes true
but it can never become true, because the inside of the loop only changes x, and the until statement is checking for a change in axel
since axel doesn't change in the loop, it can never end, so it repeats forever, so the game freezes
I think you're gonna need to look at the rest of your movement code more closely and figure out how axel is actually used in it. Is that a weird way of spelling "accel" maybe? Like acceleration?
for the ending its a shortening of acceleration because I didn't want to type in all of accel so i shortened it more. also I don't know how I missed that after checking it for multiple minutes
wait so why does
if (keyboard_check_released(vk_right)) do {axel=axel/5} until (axel=(xspd/625))
not work
it only stops working on the second time you move right, too
well, this code has a very dangerous reliance on precision
you can only escape this loop if acel EXACTLY equals xspd / 625
say xspd / 625 is 1, and axel is 2
1 does not equal 2 so the loop continues
acel is divided by 5 and becomes 2/5
which is less than 1
2/5 is also not 1 so the loop continues
and you keep dividing, but you'll never get to 1
you're already at a smaller number than it after all
this code also still has the problem of not really making any sense with a loop
you said earlier you wanted this to act like deceleration
but because you have a loop, that isn't possible
this must instantly change your speed down to basically nothing