Results 1 to 2 of 2

Thread: question about car racing game

  1. #1
    Join Date
    Jul 2015
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default question about car racing game

    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.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,348
    Qt products
    Qt5
    Platforms
    Windows
    Thanks
    318
    Thanked 872 Times in 859 Posts

    Default Re: question about car racing game

    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.

Similar Threads

  1. 2D Game
    By Peppy in forum Qt Programming
    Replies: 1
    Last Post: 1st May 2011, 13:45
  2. game on qt
    By bibhukalyana in forum Qt Programming
    Replies: 6
    Last Post: 27th March 2011, 23:56
  3. Replies: 1
    Last Post: 22nd May 2010, 08:38
  4. IQ Game
    By qtgears in forum Qt-based Software
    Replies: 0
    Last Post: 6th October 2009, 09:24
  5. Just for fun game
    By vermarajeev in forum Qt-based Software
    Replies: 6
    Last Post: 13th December 2007, 22:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.