bit101 / CodingMath

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Accelerate function in episode 18 breaks moving north or west

annahowell opened this issue · comments

Hi, the way in which the particle accelerate function is now implemented as of episode 18 breaks accelerating in some cases. If you try and accelerate the spaceship from episode 10 to the left or up on the screen the speed at which the spaceship moves drops to near zero. I am using:

if(thrusting) {
ship.accelerate(1, 1);
}

I assume this is because in some cases the function should actually be subtracting instead of adding but I am kind of new to all this. I've been following your guides and writing it in C++/SDL2 but have now dropped to JS to double check and sure enough it happens there too. Help! :)