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

Username:   Password: 
 RegisterRegister   
 Cheaply Animated Stick Man
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Leftover




PostPosted: Sun Nov 14, 2004 11:47 pm   Post subject: Cheaply Animated Stick Man

I know this one had a lot of banging head's in my class, just working out everything properly. It's not beautiful, but it gets out the general message, and a lot of my friends were looking for the example, so here it is. Lot's of documentation because we get marked on that too Smile

code:

setscreen ("graphics:800;155,nobuttonbar") % Get rid of the button bar and set a reasonable workspace for the stickman to move

var fr1, fr2 : int

% Frame 1
Draw.Line (10, 1, 25, 50, 255) % Left Leg
Draw.Line (40, 1, 25, 50, 255) % Right Leg
Draw.Line (25, 50, 25, 100, 255) % Torso
Draw.Line (10, 75, 40, 100, 255) % Arms
Draw.FillOval (25, 125, 25, 25, 255) % Head

fr1 := Pic.New (0, 0, 125, 150) % Capture picture for use later
Draw.Cls % Clear and start drawing next

% Frame 2
Draw.Line (25, 1, 25, 50, 255) % Left Leg
Draw.Line (25, 1, 25, 50, 255) % Right Leg
Draw.Line (25, 50, 25, 100, 255) % Torso
Draw.Line (10, 100, 40, 75, 255) % Arms
Draw.FillOval (25, 125, 25, 25, 255) % Head

fr2 := Pic.New (0, 0, 125, 150) % Capture picture for use later
Draw.Cls % Clear and make way for animation

% Animate the frames to make the stick man move across the screen

loop
    for i : 0 .. 750 by 25
        Pic.Draw (fr1, i, 0, picCopy)
        Time.Delay (100)
        Pic.Draw (fr2, i, 0, picCopy)
        Time.Delay (100)
        Draw.Cls
    end for
   
% Animate the frames to make the stick man move back to where he started

    for decreasing i : 750 .. 0 by 25
        Pic.Draw (fr1, i, 0, picCopy)
        Time.Delay (100)
        Pic.Draw (fr2, i, 0, picCopy)
        Time.Delay (100)
        Draw.Cls
    end for

end loop


Edit: My bad, attached it now too.



stickman.t
 Description:
My crazy animated stick man

Download
 Filename:  stickman.t
 Filesize:  1.48 KB
 Downloaded:  607 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
cool dude




PostPosted: Mon Nov 15, 2004 5:14 pm   Post subject: (No subject)

not bad. i made one like that before accept i made the stick man bounce all over the screen. lol.
zomg




PostPosted: Tue Nov 16, 2004 11:47 am   Post subject: (No subject)

thats pretty i had to make something like in grade 10 lol i only got 52%

cuz i used pic.screenload o well
Viper




PostPosted: Mon Nov 22, 2004 1:14 pm   Post subject: (No subject)

lol it look funny
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  [ 4 Posts ]
Jump to:   


Style:  
Search: