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

Username:   Password: 
 RegisterRegister   
 Importing a picture and using it in an Animation?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
revangrey




PostPosted: Fri Jan 02, 2009 8:04 pm   Post subject: Importing a picture and using it in an Animation?

now I am trying to place a picture in an animation and make that picture move

I was thinking of a Santa in a sleigh making a run across the screen sort of thing

but before I can do that I need to import a picture,
.jpg preferably not those other random things turing supports...


This is what I got from the picture importing thread, by Dan I believe

code:
var varname :int := Pic.FileNew (" c:\Documents and Settings\My Documents\Administrator\My Pictures\spartan6.jpg")
%to specify the exact location of this file
       var mypic :int:= Pic.FileNew ("c:\Documents and Settings\My Documents\Administrator\My Pictures\spartan6.jpg")
       
%to draw the picture in the center of the screen with no mode
Pic.Draw (mypic, maxx div 2, maxy div 2, 0)



Any and ALL help is appreciated thanks in advance!
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Fri Jan 02, 2009 8:14 pm   Post subject: RE:Importing a picture and using it in an Animation?

importing and using an image of any supported type works the same way.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Insectoid




PostPosted: Fri Jan 02, 2009 8:16 pm   Post subject: RE:Importing a picture and using it in an Animation?

Put the image into the folder your code is contained in. That way you don't have to type the whole directory.

code:

Pic.FileNew ("sparten6.jpg")


I don't know if Turing does this, but many languages use the backslash ('\') as an escape character, meaning it does things to the string Razz. To get around that, use a double backslash ('\\').

Another thing, if you create the picture when you initialize the variable, you don't need :int. You can just do:

code:

var mypic := Pic.FileNew ("sparten6.jpg")


Either should work.
revangrey




PostPosted: Fri Jan 02, 2009 8:16 pm   Post subject: Re: Importing a picture and using it in an Animation?

ARGH

didnt see you post that sry.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: