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

Username:   Password: 
 RegisterRegister   
 A Car Movie
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Codi




PostPosted: Mon May 15, 2006 8:52 am   Post subject: A Car Movie

code:

View.Set (" nocursor, graphics: 600; 400")

proc car (x, y, length, height, clr : int)
    Draw.FillBox (x, y, x + length, y + height, yellow) % body of car
    Draw.FillOval (x + length div 4, y, height div 5, height div 5, black) % wheels
    Draw.FillOval (x + 3 * length div 4, y, height div 5, height div 5, black)
    Draw.Arc (x + length div 2, y + height, length div 4, length div 6, 0, 180, clr) %roof  of car
end car
proc carErase (x, y, length, height, clr : int)
    Draw.FillBox (x, y, x + length, y + height, clr) % body of car
    Draw.FillOval (x + length div 4, y, height div 5, height div 5, black) % wheels
    Draw.FillOval (x + 3 * length div 4, y, height div 5, height div 5, black)
    Draw.Arc (x + length div 2, y + height, length div 4, length div 6, 0, 180, clr) %roof  of car
end carErase

proc house (x, y, size : int)
    Draw.FillBox (x, y, x + size, y + size, red) % main house
    Draw.Line (x, y + size, x + size div 2, y + 3 * size div 2, red) % roof
    Draw.Line (x + size div 2, y + 3 * size div 2, x + size, y + size, red)
    Draw.Fill (x + size div 2, y + size + 1, red, red) % fill in roof
end house

proc scene (x, y : int)
    Draw.FillBox (x, y + maxy div 2, maxx, maxy, blue) % sky
    Draw.FillBox (x, y, maxx, maxy div 2, green) % green
end scene

proc animation1 % car moves across screene
    var speed : int := 5
    scene (0, 0)
    house (250, 120, 75)
    house (350, 120, 75)
    house (450, 120, 75)
    for x : 0 .. maxx by speed
        car (x, 60, 100, 40, brightred) % draw carin new spot
        delay (50)
        carErase (x, 60, 100, 40, green)
    end for
end animation1

proc animation2
    var x : int := 0
    var speed : int := 5
    scene (0, 0)
    loop
        car (maxx div 2 - 100, maxy div 4, 100, 40, brightred)
        delay (75)
        scene (0, 0)
        house (x + maxx, 120, 75)
        house (x + maxx, -100, 75)
        house (x + maxx, -200, 75)
        x := x - speed
        if x < -maxx then
            x := 0
           
        end if
        speed:= speed+ 10
    end loop
end animation2
% mainline
animation1
cls
animation2
Sponsor
Sponsor
Sponsor
sponsor
sylvester-27




PostPosted: Tue May 16, 2006 11:49 am   Post subject: (No subject)

you might want to clean up the animation with some View.Update
Voltage128




PostPosted: Sat Dec 02, 2006 10:58 pm   Post subject: (No subject)

Yes, i agree with sylvester-27. This movie could look a lot better if you used View.Update. Also it is a little weak on the detail. You could make it better by taking some time and touching up the houses and car. Also adding simple things such as moving clouds in the backround would make it more appealing.
ericfourfour




PostPosted: Sun Dec 03, 2006 12:43 am   Post subject: (No subject)

This topic's going on 6 months Voltage128. Try not to bring up old topics unless it is important.
Voltage128




PostPosted: Sun Dec 03, 2006 1:12 am   Post subject: (No subject)

sorry man, didnt even read dates. wont happen again. I was just looking through programs.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: