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

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




PostPosted: Sun Jan 11, 2009 2:15 pm   Post subject: Animation problems

I am attempting to make my Alien's arms move up and down together in a loop. The aliens right arm (The code is written so that the Aliens right is our left and vise versa) works fine, however i am having problems with the left one. Any suggestions?


Turing:
var x, y, x2, y2, xr, yr, xr2, yr2 : int

process rightarmup

    yr := 215
    xr := 550

%right arm up
    for count : 1 .. 20
        xr := xr + 1
        yr := yr + 1
        %rght arm above
        Draw.ThickLine (360, 120, xr, yr, 30, 49)
        delay (50)
        Draw.ThickLine (360, 120, 550, 215, 30, 0)
    end for
end rightarmup

%Left arm up
process leftarmup
    y := 210
    x := 160
    for count : 1 .. 20
        x := x + 1
        y := y + 1
        %leftarm
        Draw.ThickLine (x, y, 280, 130, 30, 49)
        delay (50)
        Draw.ThickLine (x, y, 280, 130, 30, 0)

    end for
end leftarmup


%rest of Alien Drawn
loop
    %head
    drawfilloval (350, 245, 125, 70, 49)
    %right eye
    drawfilloval (400, 260, 25, 15, 44)
    %left eye
    drawfilloval (290, 260, 25, 15, 44)
    %left eye ring
    drawoval (400, 260, 10, 5, 12)
    %right eye ring
    drawoval (285, 260, 10, 5, 12)
    %right eye pupil
    drawfilloval (401, 260, 5, 2, 12)
    %left eye pupil
    drawfilloval (285, 260, 5, 2, 12)
    %right ear
    drawline (410, 307, 450, 350, 49)
    %right ear circle
    drawfilloval (450, 350, 20, 10, 49)
    %left ear
    drawline (300, 307, 250, 350, 49)
    %left ear circle
    drawfilloval (260, 350, 20, 10, 49)
    %mouth
    drawfilloval (350, 200, 25, 20, 225)
    %tounge
    drawline (350, 170, 350, 175, 62)
    %body
    drawfilloval (350, 105, 100, 70, 49)
    %right arm below
    Draw.ThickLine (370, 130, 520, 130, 30, 49)
    %leftarm below
    Draw.ThickLine (160, 130, 280, 130, 30, 49)
    %right wheel
    drawfilloval (400, 40, 40, 30, 255)
    %right wheel middle
    drawfilloval (400, 40, 10, 5, 0)
    %left wheel
    drawfilloval (290, 40, 40, 30, 255)
    %left wheel middle
    drawfilloval (290, 40, 10, 5, 0)
    %leftarm
    Draw.ThickLine (160, 210, 280, 130, 30, 49)




    % Right Arm Down
    xr2 := 570
    yr2 := 235
    for decreasing count : 20 .. 1
        xr2 := xr2 - 1
        yr2 := yr2 - 1

        Draw.ThickLine (360, 120, xr2, yr2, 30, 49)
        delay (50)
        Draw.ThickLine (360, 120, xr2, yr2, 30, 49)

    end for





    % Left Arm Down
    x2 := 180
    y2 := 230
    for decreasing count : 20 .. 1
        x2 := x2 - 1
        y2 := y2 - 1
        %leftarm
        Draw.ThickLine (160, 210, 280, 130, 30, 49)
        delay (50)
        Draw.ThickLine (160, 210, x2, y2, 30, 0)
    end for

    fork rightarmup
    fork leftarmup
end loop



Mod Edit: Remember to use syntax tags! Thanks Smile
code:
[syntax="turing"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
saltpro15




PostPosted: Sun Jan 11, 2009 3:39 pm   Post subject: RE:Animation problems

this would be easier to read with code tags, you say only one arm works?
Bleaych




PostPosted: Sun Jan 11, 2009 3:50 pm   Post subject: RE:Animation problems

well the other arm works, but it leaves a trail behind when it moves, even though i delayed it and erased it
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  [ 3 Posts ]
Jump to:   


Style:  
Search: