SFML community forums
Help => General => Topic started by: Canvas on September 23, 2012, 01:55:15 am
-
Hey guys
I have a new question for you all, I'm trying to make a car that faces a direction, when the user holds W it will increase the speed, if S is held it will slow down the car, if A or D is held the car will turn in the right direction, so for example
Car is facing North (0 degrees)
Car speed is 4.
player holds D
carDirection += 5
so if the player is holding W and holding D the car will increase and start turning right, but will keep going round in circles and circles.
How can I implement this with SFML and C++???
Cheers
-
So you're asking how to program a game? ???
We can help you with that, but explaining how everything works is not really our task. There are many open source games for which you can look at the code and learn how to do things, then there are many, many books about game programming. Google will also reveal quite a lot of information.
As for SFML you can look at the official tutorials, the wiki section and the documentation to understand what you can do and how.
-
This might be useful:
http://asgamer.com/2009/as3-character-movement-asteroids-style-360-degree-movement (http://asgamer.com/2009/as3-character-movement-asteroids-style-360-degree-movement)
The code is simple to understand so easy to change to C++.
-
eXpl0it3r
I know how to code some basic stuff, all I wanted to know how to get around an asteroid type movement, which Jove have posted, so cheers Jove :)
-
Movement is basic stuff and doesn't have that much to do directly with programming, but it's rather a logical part.
If you had Googled a bit on your own, I bet you would've found some sources in no time. ;)