Latest

Archive

Community news

C++

Communities and Content

Databases

Editorials

Emacs

General

HTML

Java

Notices

PHP

XML

Apache

C++

Database

General

HTML

Java

Javascript

Linux

Object oriented programming

Open source

Perl

PHP

Python

Ruby

SOAP

XML

Suggest a link

Advertise on zez

Contribute

Contact us

About zez


Creating games with QCanvas




Now what?


The following cool features are left for the reader to implement:
1. Add the sun and the rest of the planets, and make them bounce against each other as well as the walls. Make buttons to add/remove them.
2. Make it possible to hit the ball like you would hit a tennis ball, by moving the mouse towards the ball with the left button pressed. You'll need to make the timer continuously active, so you can record the mouse velocity when you hit the ball, enabling you to hit hard or softly. If you want to make the ball move correctly when you hit it at an angle, you'll also have to add some clever calculations for that.
3. Make the ball spin as well as bounce, depending on how you hit/throw it, and/or make it (the earth) spin around it's axis. You'll have to create the extra graphics needed yourself.
4. Add an option to zero the resistance, making the ball bounce into infinity. (and beyond..!)
5. Make the entire window shake when the ball hits the walls real hard.

Now grab the source:
Download the attached file bounce.tar.gz (27 Kb) at the bottom of this page.
Bounce is released under the GPL.
Requires: Qt and tmake, available from TrollTech.
(It was developed with Qt-2.2.1, but may work with any previous release, provided it has the QCanvas class.)

Build instructions:

tar -zxf bounce.tar.gz
cd bounce
tmake -o Makefile bounce.pro
make
./bounce


Have fun!

Attached files:


<< Previous page | 1 | 2 | 3 | 4 | 5 | < 6 > | Printer-friendly page |

Comment List


Topic: Author:
Time:
Very much Informative Riphat satti 29.08.2007 10:47

I think this is very useful exapme to learn about qcanvas..

each and every thing describe in full detail.
a layman can easily understand this example.


Bounce Canvas Demo Dr M 15.05.2005 05:57

Bounce is a very nicely written demo.
I wish QT would also distribute it
on their CD as an example on how to
write a QCanvas Application.

The example given in the QT book is
way too much for a newcomer.


Very usefull Arun Sivakumar 01.12.2001 17:18

The article featuring the QCanvas was really usefull and simple to understand. Hope you release more article covering various other features of Qt.

Please do inform if there are any other site with equally good articles on Qt.

Thank you
s_arunn@yahoo.com




Forgot your password?

Register a new user

Results

Polls