Loading...
Logo
Processing Forum
Write a program to check whether a car will crash. There is an obstacle at a certain distance (say 100 m) and the car is travelling at a certain speed (try it with some different speeds). The user hits the brakes after 0.5 seconds, applying a deceleration of 5 m/s^2. Draw the progress of the car and report whether it stopped safely or hit the obstacle.

Replies(1)




you could have a car, seen as a line
http://www.processing.org/learning/topics/linear.html

with speed maybe 100 m/s
then check against obstacle (fixed line at say width / 2) if carX>=obstacleX then println("Crash");
after 4000 millis reduce speed