[gameprogrammer] Re: Since we are on the topic of optomized data structures (:

  • From: "Yasser Gonzalez Soto" <yassergs@xxxxxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Mon, 16 Jul 2007 08:34:42 +0200

talkin' about collisions between objects, what is easier Color detecting collision or position calculation collision.


I remember this collision test done in Visual BASIC 5.0:

(A)

 for i=0 to scalewidth
  ball.x=i
  for x=0 to 1000:next '<-- making a delay
if Point(ball.x,ball.y)=RGB(0,0,255) then '<--If ball position detect a blue color
    msgbox 'Blue box collision'
    exit
   end if
  end for


And this is in  PASCAL

for i:=0 to ClientWidth do
 begin
  ball.x:=i;
  sleep(1000); //A delay
if ball.X > box.X and ball.X < ball.RIGHT and ball.Y > box.Y and ball.Y < box.Bottom then
   begin
    showMessage('Blue box collision');
    close;
   end;
 end;




Which of both is better to use or the most used??



--


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: