Computer Science Canada

Making a simple platform game for an ISU

Author:  fluxflashor [ Mon Jun 04, 2007 7:49 am ]
Post subject:  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.

code:

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.

Author:  Clayton [ Mon Jun 04, 2007 9:40 am ]
Post subject:  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.

Author:  rdrake [ Mon Jun 04, 2007 10:34 am ]
Post subject:  Re: Making a simple platform game for an ISU

Erm... would using just one if statement work better here?

Turing:

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


Author:  fluxflashor [ Tue Jun 05, 2007 7:53 am ]
Post subject:  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. Smile

Author:  Clayton [ Tue Jun 05, 2007 7:57 am ]
Post subject:  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.


: