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

Download
Download (Archived source + graphics)
To unpack, run the following code in a linux terminal, or use any good archival / decompression program:
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:
Controls
The cars use a fixed control scheme, as shown below:
Playstation Remote Controls
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
P2 Keyboard Controls
(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.)
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

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.tarPS3 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.)