Re: [Super-tux-devel] Gameloop Rewrite Status
Brought to you by:
wkendrick
From: Ricardo C. <ri...@ae...> - 2004-01-03 13:16:50
|
Another way to go for 2d collisions is to make use of geometry shapes... For instace, those normal enemies in Mario (that had the teeth shown), cou= ld=20 be assumed as a circle. Tux is like a ellipse. There are some fast algorith= ms=20 to calculate circles/ellipses curve. For a game of mine, I was implementing a collision system where we had the= =20 information about the lines that limitate the surface and then we would jus= t=20 check them with each other... But maybe the best approach would be to use the current collision system a= nd,=20 for special tiles, like terrains with a triangular shape, we would consider= =20 them to be triangles. Hope to be helpfull, :) Ricardo Cruz Em S=C3=A1bado, 3 de Janeiro de 2004 19:00, o Tobias Gl=C3=A4=C3=9Fer escre= veu: > Am Sa, den 03.01.2004 schrieb Ingo Ruhnke um 07:50: > > Ricardo Cruz <ri...@ae...> writes: > > > You could also have a look at one of the Ingo's games, like > > > Windestille or Pingus (they are c++, but may be helpfull). > > > > Pingus uses just a single pixel (or sometimes two) for collision > > detection. Windstille, even so it has some bitmask code, doesn't use > > it at the moment and instead uses some quick collision-rectangle > > hacks. So both aren't really good examples. > > > > Using multiple bitmaskes (one for the top, another one for the sides) > > might work, calculating the entry-vector into the enemy might also > > provide some informations, but I havn't really found out myself on how > > to solve this problem cleanly. > > My aim is to calculate the angle in which object A got hit by object B, > like described in the tutorial Ricardo showed us. > And I don't want to use bitmap-collisions for all objects, but for Tux > in example. :) > The code handling already calculated collisions will look like this: > > void badguy_collision(bad_guy_type* pbad, int c_object, int angle) > { > /* Handle collision with Tux, but don't touch tux's internals, only > touch the badguy's internals */ > if(c_object =3D=3D CO_TUX) > { > > if(angle =3D=3D 0) > pbad->dying =3D FALLING; > ... > > } > } > > > > Greetz... > > Tobias Gl=C3=A4=C3=9Fer =2D-=20 I do not know whether I was then a man dreaming I was a butterfly, or whether I am now a butterfly dreaming I am a man. -- Chuang-tzu |