Top-down racing game (Qt/Box2D)

Post your tutorials and samples here.
luke_c
Posts: 7
Joined: Mon Mar 05, 2012 2:33 pm

Top-down racing game (Qt/Box2D)

Postby luke_c » Wed Jun 27, 2012 1:47 pm

Description
An example of how to use QT and Box2D together to create a game with collision detection. Collision polygons are generated using the trangles library. All rocks, trees and barriers can be pushed and moved around. Water bodies are static. QT provides a graphical user interface and canvas. The game was designed for use as an interactive activity on a stand, and therefore supports the use of PS3 remotes to control the vehicles. The game is clearly biased in favour of player 1, to demonstrate the principles desired.

Gallery
Image Image

Download
Download (Archived source + graphics)
To unpack, run the following code in a linux terminal, or use any good archival / decompression program:

Code: Select all

tar -xvf DrivingGame.tar


PS3 Remote Troubleshooting
If the remote isn't working, ensure that any PS3 consoles are turned off, try to pair it with the computer, and follow this procedure:

1) Unplug the wire
2) Press "PS"
3) Plug the wire back in
4) Select restart
5) Unpause the game.


Controls

The cars use a fixed control scheme, as shown below:

Playstation Remote Controls
R2 / Cross - Accelerate
R1 / Square - Handbrake
L2 / Circle - Reverse
Analogue stick - Steer
Start - (Un)Pause
Select - Reset



If there are insufficient playstation controllers, or they cannot be connected to, the controls will fall back to keyboard for the cars which lack remote controls. The control scheme for each car is fixed, as shown below:

P1 Keyboard Controls
W - Accelerate
S - Handbrake
E - Reverse
A/D - Steer
Q - (Un)Pause
R - Reset


P2 Keyboard Controls
I - Accelerate
K - Handbrake
O - Reverse
J/L - Steer
U - (Un)Pause
P - Reset


(Note: You might have seen Racing game (Qt/Box2D), which was a previous incarnation of this. I decided to create a new topic, as this version is sufficiently different, and the preserve the much simpler version for people who aren't interested in the added features here.)

pTymN
Posts: 518
Joined: Tue Sep 25, 2007 2:22 pm

Re: Top-down racing game (Qt/Box2D)

Postby pTymN » Wed Jun 27, 2012 3:16 pm

Does this run on OSX?

luke_c
Posts: 7
Joined: Mon Mar 05, 2012 2:33 pm

Re: Top-down racing game (Qt/Box2D)

Postby luke_c » Wed Jun 27, 2012 4:18 pm

It might, though you'll probably have to fix a few bugs. The same goes for Windows. The libraries I've used are all portable but the remote control code is very platform specific, so I doubt that part will. However, it might correctly switch to keyboard controls. Let me know if it doesn't work, and I'll see what I can do.


Return to “Tutorials and Samples”



Who is online

Users browsing this forum: No registered users and 2 guests