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

Username:   Password: 
 RegisterRegister   
 animated gif files help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
lufthansa747




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: 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.
lufthansa747




PostPosted: 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
Euphoracle




PostPosted: 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.


.
lufthansa747




PostPosted: 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
TheGuardian001




PostPosted: 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.
lufthansa747




PostPosted: 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)
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  [ 7 Posts ]
Jump to:   


Style:  
Search: