Computer Science Canada

how do I move an imported image back and forth?

Author:  aigi [ Thu Jun 09, 2011 8:37 am ]
Post subject:  how do I move an imported image back and forth?

What is it you are trying to achieve?
moving an imported image (a crab) back and forth in a loop

What is the problem you are having?
image trails after itself each time it moves

Describe what you have tried to solve this problem
cls, but it then clears the rest of the images i've already drawn.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
i'm well aware i'm using picMerge, i prefer it to be like that unless there's another way to show the background and move the image without it trailing itself
Turing:

%crab
    var crab:= Pic.FileNew("crab.gif")

var x := 25

var y := 20


loop
for i : 1 .. 10
 
        Pic.Draw (crab, x,y, picMerge)
x := x + 20
delay (50)
end for
for i : 1 .. 10
        Pic.Draw (crab, x+20,y, picMerge)
x := x -20
delay (50)
end for
end loop




Please specify what version of Turing you are using
4.0.5

i'm still kind of new at this stuff, so thanks in advance

Author:  Raknarg [ Thu Jun 09, 2011 9:30 am ]
Post subject:  RE:how do I move an imported image back and forth?

Yes, there is.
Turing:

var crab:= Pic.FileNew("crab.gif")
var x := 25
var y := 20

loop
     for i : 1 .. 10
          (draw background)
          Pic.Draw (crab, x,y, picCopy)
          x := x + 20
          delay (50)
          cls
     end for
     for i : 1 .. 10
          (draw background)
          Pic.Draw (crab, x+20,y, picCopy)
          x := x -20
          delay (50)
          cls
     end for
end loop


: