Answer the question
In order to leave comments, you need to log in
How to implement a 2D machine?
Hello! How can I implement car control (top view) in C++ using SDL or SFML (because they are similar)?
I need to make the machine move in the direction with the UP key, and the LEFT and RIGHT keys change the direction, but how can I implement this programmatically?
Answer the question
In order to leave comments, you need to log in
Use movement direction vector:
UP - moves the "car" a certain distance along the vector.
LEFT/RIGHT - rotate the direction vector by a certain angle.
The specific implementation is at your own discretion (working with a vector in an elementary form is easily implemented even with standard C ++ tools, using SDL to implement control is easy to find on the Internet).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question