Computer Science Canada

FootBall game

Author:  lil_li [ Mon May 26, 2003 4:43 pm ]
Post subject:  FootBall game

I'm making a football game and i need collation detection, I made one my self, it works fine. But when i move the object it does not work anymore.

I was wondering if any of you guys can show me a short example of 2 box collation detection program.

Here is my collation detection... (boxes are 20 by 20)

Rx is the non-moving box, and controlx is the box that u can move with,
Axchange is the controlx moving changes


code:

 if controlx = Rx - 20 and controly = Ry then
            Axchange := 0
        elsif controlx = Rx - 20 and controly = Ry + 10 then
            Axchange := 0
        elsif controlx = Rx - 20 and controly = Ry - 10 then
            Axchange := 0
        end if

Author:  Solo [ Mon May 26, 2003 6:00 pm ]
Post subject:  Skips too many maybe?

code:
if controlx = Rx - 20 and controly = Ry then
            Axchange := 0
        elsif controlx = Rx - 20 and controly = Ry + 10 then
            Axchange := 0
        elsif controlx = Rx - 20 and controly = Ry - 10 then
            Axchange := 0
        end if


if Axchange is greater than 0 then it will end up skipping the Rx-20 and the ifs wont catch it.

Try making it <= and >= instead of just =.


: