![]() |
|
#1
|
|||
|
|||
RE:" THE BOUNCING BALL in C++"Having looked at the code for the "bouncing ball" which was said to be "hello world" of Win 32.
I have been trying to do the following: 1. Make the this ball move in a predefined rectangle (one ALREADY drawn) even before the ball starts moving 2. I also would like to make this ball to change color temporarily as it hits either ends of the rectangle for a few seconds and then change back to the original color. As it hits the other end of the rectangle again the ball should change color temporarily and then back again to the original color and keep doing this. Please help the new programmer. Thank you! Below is what i have done so far CPP / C++ / C Code:
Last edited by LuciWiz : 21-Oct-2007 at 14:55.
Reason: Please insert your C/C++ code between [cpp] & [/cpp] tags
|
|
#2
|
||||
|
||||
Re: " THE BOUNCING BALL in C++"I haven't got around to changing the ball color [yet], but the 'y' axis of code is missing in the code. Where the ball is moved, make sure this is in there too:
CPP / C++ / C Code:
(someone must have updated along the way) __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
|||
|
|||
Re: " THE BOUNCING BALL in C++"I tried putting your code it made the ball move funny.
I need it to move along a recatangle and change colors temporally as it hits either ends and change back to original color. |
|
#4
|
||||
|
||||
Re: " THE BOUNCING BALL in C++"I don't know what you mean by "the ball moves funny", as I only added the missing code parts from my previous post and it bounces around within the window like it should. I did, however, make the ball just a bit smaller. I'll put the original size back and see if makes any difference.
I have NOT started on the ball-color change yet (like I said in the last post), that'll be next, but don't wait for me -- I may not get to it over the next couple of days. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#5
|
|||
|
|||
Re: " THE BOUNCING BALL in C++"The main aim is this:
Consider a circle which is moving within a rectangle as shown below: The circle maintains its yellow colour when moving horizontally within the rectangle. Once the circle hits the side of the rectangle at point B, it temporarily changes colour to red and reverses its direction towards A. As it is moving toward A, it retains its yellow colour. Once it hits the rectangle side at point A, it temporarily changes its colour to red again and starts moving towards B. Once it is moving towards B, it maintains its yellow colour again. The circle remains in perpetual motion until the user exits. That is What i need. Hence i need: 1. The RECTANGLE to be DRAWN ALREADY before the ball even starts moving. 2. The issue of the color changing also. THANKS!! PLEASE HELP i have been struggling with this for Days now! |
Recent GIDBlog
Toyota - 2008 November Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java bouncing blue ball | candykane69 | Java Forum | 4 | 01-Dec-2006 08:22 |
| cricket | hostbreak | Sports Forum | 21 | 10-Dec-2005 08:28 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The