Computer Science Canada

animated gif files help

Author:  lufthansa747 [ Mon Dec 28, 2009 10:48 pm ]
Post subject:  animated gif files help

What is it you are trying to achieve?
i have an animated gif of a guy walking but i only want it to play when i am moving him. how do i do this

Please specify what version of Turing you are using
4.1.1

Author:  TheGuardian001 [ Mon Dec 28, 2009 11:10 pm ]
Post subject:  Re: animated gif files help

Use Pic.FileNewFrames to load the animation into an array, but instead of using Pic.DrawFrames to draw the entire array, use the standard Pic.Draw with only one element of the array. Use an integer to keep track of what frame should be drawn, and draw the relevant frame.

Author:  lufthansa747 [ Tue Dec 29, 2009 9:17 pm ]
Post subject:  RE:animated gif files help

ok but how do i move the pic cause it not a sprite

Author:  Euphoracle [ Tue Dec 29, 2009 9:52 pm ]
Post subject:  Re: animated gif files help

TheGuardian001 @ Mon Dec 28, 2009 11:10 pm wrote:
Use Pic.FileNewFrames to load the animation into an array, but instead of using Pic.DrawFrames to draw the entire array, use the standard Pic.Draw with only one element of the array. Use an integer to keep track of what frame should be drawn, and draw the relevant frame.


.

Author:  lufthansa747 [ Tue Dec 29, 2009 11:10 pm ]
Post subject:  RE:animated gif files help

i understand that but if i do that the previose frame will not go away if it is moving forward

Author:  TheGuardian001 [ Tue Dec 29, 2009 11:21 pm ]
Post subject:  Re: animated gif files help

Two ways around this:
1) Clear the screen(cls). This is the option I generally use, as it works quite well and isn't overly annoying. You're going to have to redraw everything anyways, might as well just get rid of it all.

2)redraw the image using the picXor picture mode.
code:

Pic.Draw(myImage,x,y,picMerge) %draw the image
delay(200) %give them a bit of time to see the image
Pic.Draw(myImage,x,y,picXor) %reset to background colour.

Which will reset the area previously occupied by the image to the Background colour.

Author:  lufthansa747 [ Fri Jan 01, 2010 4:34 pm ]
Post subject:  RE:animated gif files help

i am trying to load the file but on the last line of the below code i get arro segmentation violation

var numGuyFramesRight : int := Pic.Frames ("ManRightWalk.gif")
var guyPicIDsRight : array 1 .. numGuyFramesRight of int
var guyDelayTimeRight : int
Pic.FileNewFrames ("ManRightWalk.gif", guyPicIDsRight, guyDelayTimeRight)


: