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

Username:   Password: 
 RegisterRegister   
 How do you use the spacebar in the game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Quakerstate98




PostPosted: Thu Jun 15, 2006 9:32 pm   Post subject: How do you use the spacebar in the game

I'm making a fighting game, and i wanna use spacebar for block but i can't figure out how, the help says to use (ORD_SPACE) as a int but i don't understand. I get how to use (KEY_DOWN_ARROW) and ('a') and stuff but i can't figure it out can anyone help me out
Sponsor
Sponsor
Sponsor
sponsor
TheOneTrueGod




PostPosted: Thu Jun 15, 2006 9:38 pm   Post subject: (No subject)

(' ') represents space bar.
Quakerstate98




PostPosted: Thu Jun 15, 2006 10:07 pm   Post subject: Thanks

Alright sweet it works, thanks
Bored




PostPosted: Fri Jun 16, 2006 8:56 am   Post subject: (No subject)

ORD_SPACE returns the ASCII value for space and is the same as ord (" "). ord() takes a character and returns the ordinal value. The reverse of this operation is chr, thus chr (ord ('a')) returns 'a'. This means that chr (ord (" ")) is equvilent to chr (ORD_SPACE), and so you could also use chr (ORD_SPACE). That's a little easier to tell what it is but i think having simple " " looks better. But now you know that the ORD constants return ordianl values whereas the KEY constants return the actual character, and thats why keys (ORD_SPACE) would not work.
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  [ 4 Posts ]
Jump to:   


Style:  
Search: