Computer Science Canada Sprites in turing!! |
Author: | munt4life [ 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 ![]() |
Author: | tyuo9980 [ 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. |
Author: | munt4life [ 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 |
Author: | Raknarg [ Sun May 15, 2011 4:36 pm ] | ||
Post subject: | RE:Sprites in turing!! | ||
That's not quite how it works.
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. |
Author: | munt4life [ 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 |
Author: | Tony [ 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 |
Author: | munt4life [ Sun May 15, 2011 7:46 pm ] |
Post subject: | RE:Sprites in turing!! |
aha i see thanks ![]() |