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

Username:   Password: 
 RegisterRegister   
 I need some help to crash cars...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CrazyTiger




PostPosted: Tue May 08, 2007 8:40 am   Post subject: I need some help to crash cars...

Can someone help me fix/edit my program so that the two cars can crash into each other at the center of the screen?
Pls help, i'm stuck!

code:
var y : int

for i : 0 .. maxx
    y := maxy - i

    drawfillbox (i - 30, 250, i + 80, 200, 5)
    drawfilloval (i, 200, 15, 15, 255)
    drawfilloval (i + 50, 200, 15, 15, 255)

    delay (15)

    drawfillbox (i - 30, 250, i + 80, 200, 0)
    drawfilloval (i, 200, 15, 15, 0)
    drawfilloval (i + 50, 200, 15, 15, 0)

    drawfillbox (y - 30, 250, y + 80, 200, 5)
    drawfilloval (y, 200, 15, 15, 255)
    drawfilloval (y + 50, 200, 15, 15, 255)

    delay (5)

    drawfillbox (y - 30, 250, y + 80, 200, 0)
    drawfilloval (y, 200, 15, 15, 0)
    drawfilloval (y + 50, 200, 15, 15, 0)
end for


I really need to know who to change the above program to get the two cars coming from opposite directions and crashing in the middle.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue May 08, 2007 6:58 pm   Post subject: RE:I need some help to crash cars...

There are a variety of ways of doing this. The easiest would be to just make your for loop step for i from 1 to half the width of the screen (you can incriment by more than 1 at a time, if you feel like speeding it up). Then draw one car at i, and the other at maxx - i. Then when that for loop is done, draw some crashing animation.
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: