View Full Version : question about car racing game

15th February 2016, 06:07
Hi All,
I'm new to QT, I am creating a car game in QT. Any one please suggest me that how can i create moving curved roads in car racing.

15th February 2016, 21:53
I would guess that the usual way is to create a set of images of the road using some drawing application. Probably you would make them larger than you want to display on screen so the driver can drive off the road and the car will still remain in part of the image. You set the viewport on the image to display only part of it, and you slowly move the viewport on the image to simulate travel. When the car is about to drive off of one image, you load the next one from a file and display it. If you time it correctly and create your images so they overlap, the transition from one image to the next should not be noticeable.

As for the game itself, I would use QGraphicsScene and QGraphicsView. You can use QGraphicsPixmapItem to hold the images of the road. You can create a custom QGraphicsItem to represent the car.

No, I can't give you example code. If you are new to Qt, it would be better for you to learn from some of the Qt tutorials and examples that get installed when you install Qt. The "Colliding Mice" example would be a good one to look at.