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

Username:   Password: 
 RegisterRegister   
 Sprites in turing!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
munt4life




PostPosted: Sun May 15, 2011 8:15 am   Post subject: Sprites in turing!!

Does anyone have a sample code of how i can move a sprite, ive been trying forever and have been confused Razz
Sponsor
Sponsor
Sponsor
sponsor
tyuo9980




PostPosted: Sun May 15, 2011 12:02 pm   Post subject: Re: Sprites in turing!!

well assign it a x and y coord and modify them according to which keypress.
munt4life




PostPosted: Sun May 15, 2011 4:22 pm   Post subject: RE:Sprites in turing!!

i tried something like


var x := Pic.FileNew("left1.bmp")

var chars : array char of boolean
loop
Input.KeyDown (chars)
if chars (KEY_RIGHT_ARROW) then
x:=x+5
end if
if chars (KEY_LEFT_ARROW) then
x:=x-5
end if
Pic.Draw(x,100,50,picMerge)
delay(10)
cls

end loop
Raknarg




PostPosted: Sun May 15, 2011 4:36 pm   Post subject: RE:Sprites in turing!!

That's not quite how it works.
Turing:

var x := Pic.FileNew("left1.bmp")

That's assigning x to that picture's ID. Its not the number you want to adjust. Instead, assign the 100 to x. 100 is the x position, which im assuming you're trying to change.
munt4life




PostPosted: Sun May 15, 2011 7:29 pm   Post subject: RE:Sprites in turing!!

ok so if i assign x to 100, how would the picture move?
do i say left1.bmp :=left1.bmp+5 or something of that sort
Tony




PostPosted: Sun May 15, 2011 7:34 pm   Post subject: RE:Sprites in turing!!

You "move" the picture by drawing it in a different spot. Please read the documentation (and examples used) -- Pic.FileNew, Pic.Draw
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
munt4life




PostPosted: Sun May 15, 2011 7:46 pm   Post subject: RE:Sprites in turing!!

aha i see thanks Very Happy
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: