Computer Science Canada

Animation glitching

Author:  Honsly [ Sat Feb 23, 2013 6:48 pm ]
Post subject:  Animation glitching

I am trying to animate a man's arm moving up and down but it keeps glitching up.

It starts out fine but suddenly it just glitches and i don't know why."
Can someone please take a look at it and figure out why it glitches up. I don't have a clue.

I have pasted the code below to you can look at it and see it for yourself.

Turing:


%----------------------------Body------------------------------------------
drawline (30,0,80,150, black) %Left Leg
drawline (80,150,125,0, black) %Right Leg
drawline (80,150,80,300, black) %Body
drawline (80,300,30,175, black) %Left Arm
drawline (80,300,250,300, black) %Right Arm
drawfilloval (80,350,50,50, black) %Head
%----------------------Moving Arm----------------------------------------
var x : int := 250
var y : int := 300
var a : int := 200
var b : int := 250
loop
loop
    drawline (80,300,x,y, black) %Right Arm Goes Down
    x := x - 1
    y := y - 1
    delay (10)
    drawline (80,300,x + 1,y + 1, 0) %Right Arm Disappears
    exit when x = 200   
end loop
loop
    drawline (80,300,a,b, black) %Right Arm Goes Up
    a := a + 1
    b := b + 1
    delay (10)
    drawline (80,300,a - 1,b - 1, 0) %Right Arm Disappears
    exit when a = 251
end loop
end loop


I am using Turing 4.1.1

Author:  Insectoid [ Sun Feb 24, 2013 9:44 am ]
Post subject:  RE:Animation glitching

You need to reset your variables at the end of their loops.


: