[Kde-games-devel] Old kasteroids bug with patch

Marco Krohn marco.krohn at gmx.de
Sat Apr 1 13:51:48 CEST 2006


On Friday 31 March 2006 20:22, Albert Astals Cid wrote:

Hiya,

> Hmmm do i read the patch wrong or the suggested solution is to move the
> missiles slower?

I should have pointed out the core of the problem, which is described
in the comment from Hans R. Battenfeld (the comment before the patch).

Quoting:

"If the asteroid is only a couple of pixels away the shots WILL go through."

"But you don't have to go through all this. If you fire while standing still, 
you will notice that shots appear a little distance (a little bit more than 
diameter of a small asteroid :-) ) from the tip of the ship. This is the 
problem."


Thus the problem is that shots appear to far away from the ship.
The patch is not about velocity as these lines of the patch show:

missile->setVelocity( shipDx + cosangle*MISSILE_SPEED,
                                     shipDy + sinangle*MISSILE_SPEED );

The relevant part of the patch changes the offset of the shot from the
ship (this is the sin / cosine function part)

-              missile->move( 21+ship->x()+cosangle*21,
-                             21+ship->y()+sinangle*21, 0 );
+              missile->move( 21+ship->x()+cosangle*10,
+                             21+ship->y()+sinangle*10, 0 );

The other value of 21 is some other offset, which probably has to do
with the dimension of the ship and thus does not need to be changed.

Thanks for looking into this and best regards, 
  Marco


More information about the kde-games-devel mailing list