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

Username:   Password: 
 RegisterRegister   
 Making a simple platform game for an ISU
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
fluxflashor




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: 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.
rdrake




PostPosted: 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

fluxflashor




PostPosted: 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
Clayton




PostPosted: 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.
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  [ 5 Posts ]
Jump to:   


Style:  
Search: