
-----------------------------------
munt4life
Sun May 15, 2011 8:15 am

Sprites in turing!!
-----------------------------------
Does anyone have a sample code of how i can move a sprite, ive been trying forever and have been confused :P

-----------------------------------
tyuo9980
Sun May 15, 2011 12:02 pm

Re: Sprites in turing!!
-----------------------------------
well assign it a x and y coord and modify them according to which keypress.

-----------------------------------
munt4life
Sun May 15, 2011 4:22 pm

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
Sun May 15, 2011 4:36 pm

RE:Sprites in turing!!
-----------------------------------
That's not quite how it works.

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
Sun May 15, 2011 7:29 pm

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
Sun May 15, 2011 7:34 pm

RE:Sprites in turing!!
-----------------------------------
You "move" the picture by drawing it in a different spot. Please read the documentation (and examples used) -- [tdoc]Pic.FileNew[/tdoc], [tdoc]Pic.Draw[/tdoc]

-----------------------------------
munt4life
Sun May 15, 2011 7:46 pm

RE:Sprites in turing!!
-----------------------------------
aha i see thanks :D
