From: gregorio AT jet DOT es (Grzegorz Adam Hankiewicz) Newsgroups: comp.os.msdos.djgpp Subject: Re: Pinball-programming Date: Wed, 25 Feb 1998 14:07:42 GMT Organization: Gogosoftware Lines: 18 Message-ID: <34f424db.1643605@news.jet.es> References: <6d16pp$4q4s$1 AT www DOT univie DOT ac DOT at> NNTP-Posting-Host: infon997.jet.es To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk >I need help with my programm. I wanted to programm a breakout game, where >a ball moves around. I have tried to use " (sin x)² + (cos x)² = 1 " or >something like that to calculate the next coordinates, but it isn`t >working very well - in a nutshell it is bullshit -. Too difficult. The easy way is to give the ball two coordinates at startup. Then, you add some 'movement' values to it each frame. Say you want a perfect diagonal move, then x_add=1 and y_add=1 if the ball is moving right and down. If you want to move slightly down and up, you could say then x_add = 2 and y_add = -1. For each frame you add the values x_add and y_add to the coordinates of the ball, and display it in the new place. Of course, before moving you have to check if there's a brick at the place you want to move the ball so that you can make it bounce off. - Grzegorz Adam Hankiewicz - gregorio AT jet DOT es - http://web.jet.es/gregorio - Gogosoftware - http://web.jet.es/gregorio/gogosoftware