Crashes like, the car sprite bugs out, displays at its default angle until the next button press, which would modify the car's movement. The next button pressed makes the game destroy the car instance.
The max speed thingy is a workaround for a simple gears system. I'd like the car to go back, only when it's in reverse gear and the Up Arrow is pressed. So, to do that I have the following condition:
- Down arrow is down && Car speed <= 0 && gear (instance variable) <= 1 : Set Car max speed to 0
Once the down arrow is released, though, the car's speed is reset every tick. So, basically, while brakes are being pressed, max speed = 0. While not - max speed is reset every tick.
Would there be a better way to disallow the car to move back without being in reverse gear?
EDIT: I actually found a solution. Steering is now being simulated only if speed > 0. When the max speed = 0 and steering is active, the instance bugs out, so I implemented the speed check.
EDIT 2: The first edit still had flaws. But I made it happen! And it works flawlessly with a completely different approach. I don't mess with max speed, but with acceleration, deceleration and current speed. Link to the event sheet below (top three are in System Every Tick):
goo.gl/Xu1qmr