Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 FootBall game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lil_li




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Solo




PostPosted: 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 =.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: