
-----------------------------------
fluxflashor
Mon Jun 04, 2007 7:49 am

Making a simple platform game for an ISU
-----------------------------------
I am having problems with the key.down function in turing. I have searched the forums, cannot find anything useful, maybe im just stupid.

this is my code, it worked out of soemthing I got in the turing help, but it isnt working with pictures.


var chars : array char of boolean
 var leftvivi : int := Pic.FileNew ("viviblueleft.gif")
 var rightvivi : int := Pic.FileNew ("viviblueright.gif")
        
loop
        Input.KeyDown (chars)
      if chars (KEY_LEFT_ARROW) then
            put Pic.FileNew ("viviblueleft.jpg")  %use to be left vivi
            else
            put "                "
      end if
      if chars (KEY_RIGHT_ARROW) then
            put Pic.FileNew ("viviblueright.jpg") %use to be rightvivi
            else
            put "                "
      end if
end loop


Help would be awesome. Thanks.

-----------------------------------
Clayton
Mon Jun 04, 2007 9:40 am

RE:Making a simple platform game for an ISU
-----------------------------------
I don't think your problem is with Input.KeyDown(), but rather with the Pic. module. I highly suggest you check out the tutorials on the Pic. module in the Turing Walkthrough.

-----------------------------------
rdrake
Mon Jun 04, 2007 10:34 am

Re: Making a simple platform game for an ISU
-----------------------------------
Erm... would using just one if statement work better here?


var chars : array char of boolean
var leftvivi : int := Pic.FileNew ("viviblueleft.gif")
var rightvivi : int := Pic.FileNew ("viviblueright.gif")

loop
    Input.KeyDown (chars)
    if chars (KEY_LEFT_ARROW) then
        put Pic.FileNew ("viviblueleft.jpg")      %use to be left vivi
    elsif chars (KEY_RIGHT_ARROW) then
        put Pic.FileNew ("viviblueright.jpg")     %use to be rightvivi
    else
        put "                "
    end if
end loop



-----------------------------------
fluxflashor
Tue Jun 05, 2007 7:53 am

Re: Making a simple platform game for an ISU
-----------------------------------
ok thanks will check that out. Kinda freaky your sigs not my name in it. I guess it just reads the user information if im not mistaken. :)

-----------------------------------
Clayton
Tue Jun 05, 2007 7:57 am

RE:Making a simple platform game for an ISU
-----------------------------------
Um... using put with Pic.FileNew() will work, but I don't see the point... instead, I think you're trying to actually draw the picture on the screen in which you should be using Pic.Draw (picID, x, y : int, text : string, mode : int)

You can read more on this in the Turing Reference Manual, or in the Turing Walkthrough.
