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

Username:   Password: 
 RegisterRegister   
 [Tutorial] Character control on screen (Input.KeyDown)
Index -> Programming, Turing -> Turing Tutorials
Goto page Previous  1, 2, 3, 4, 5  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
The_$hit




PostPosted: Wed Mar 02, 2005 10:50 pm   Post subject: (No subject)

What if i wanted to attach a picture and move that around what would I do?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Mar 02, 2005 11:50 pm   Post subject: (No subject)

You have your position variables X/Y, just draw your picture there instead of Draw.Box/Oval/whatever
ssr




PostPosted: Thu Mar 03, 2005 11:19 pm   Post subject: (No subject)

btw I think
code:
KEY_UP_ARROW
and
code:
KEY_DOWN_ARROW
only works on Turing 4.0.5
what about
code:
KEY_ENTER
samething?
8)
Bacchus




PostPosted: Fri Mar 04, 2005 7:05 am   Post subject: (No subject)

KEY_UP_ARROW and KEY_DOWN_ARROW both work in 4.0.4, i used them b4, 4.0.5 however recognizes them as keys and turns it black to not get them confused with vars Razz
ssr




PostPosted: Sat Mar 12, 2005 10:14 pm   Post subject: (No subject)

Bacchus wrote:
KEY_UP_ARROW and KEY_DOWN_ARROW both work in 4.0.4, i used them b4, 4.0.5 however recognizes them as keys and turns it black to not get them confused with vars Razz

so if I make a program using KEY_UP_ARROW, it will still work in Turing 4.04? 8)
Bacchus




PostPosted: Sat Mar 12, 2005 10:18 pm   Post subject: (No subject)

yes, at least they did for me b4 i got 4.0.5, .5 just turns the font black (in .4 it stays blue) that way it doesnt look like a var
[Gandalf]




PostPosted: Sun Mar 13, 2005 3:24 pm   Post subject: (No subject)

Where can I find the list of all the key names?

How would I do Space Bar without using ORD_SPACE? KEY_SPACE doesn't work, and I tried a bunch of different combinations...
Bacchus




PostPosted: Sun Mar 13, 2005 10:50 pm   Post subject: (No subject)

code:
var chars:array char of boolean

loop
   cls
   Input.KeyDown (chars)
   if chars (KEY_UP_ARROW) then
      put  "You pressed the Up Arrow!"
   elsif chars(' ') then
      put "You pressed the Space Bar!"
   elsif chars('a') then
      put "You pressed a!"
   else
      put "You can use the accual key name etc " " or "a" and quote them with
         aposterphies ('), if the key doesnt have an accual character it needs a
         special variable or watever its called ex: up arrow doesnt have a
         character so you use KEY_UP_ARROW"
   end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Tue Mar 15, 2005 8:18 am   Post subject: (No subject)

Open the turing reference (F10). Expand Turing Language. Expand PRedefined modules. Select Keyboard.
Also, Expand Turing Language. Select Keystroke codes. scroll down.
[Gandalf]




PostPosted: Tue Mar 15, 2005 2:17 pm   Post subject: (No subject)

Thanks a lot! Anyone know why they didn't make a KEY_SPACE - was it because it was just not neccessary?

Now I can finally use the spacebar for shooting Smile , thanks again.
Bacchus




PostPosted: Tue Mar 15, 2005 3:49 pm   Post subject: (No subject)

i would guess cause its not necissary, it has a character so Shocked
[Gandalf]




PostPosted: Sun May 15, 2005 6:35 pm   Post subject: (No subject)

Alright, here's another question which has been bothering me... I've see this done a lot, but I can't explain it.

Is there a reason why you have a seperate if statement for each key pressed? Why not just do elsif? That way you can also have an 'else' if you need it...
Cervantes




PostPosted: Sun May 15, 2005 7:23 pm   Post subject: (No subject)

The reason for this is because it prevents the user from hitting two keys at once. Say you had a shooter. WASD for movement, space bar is jump, weapons are the numbers. If you had a big long if .. elsif ..... elsif .. end if structure, only the first key in that structure would regester. So if you're moving, you might not be able to change your weapon. Or maybe you can't fire while moving. Or maybe you hold up (W) and right (D) and want to go on a diagonal up and right. But instead you only go up. None of this is good...
[Gandalf]




PostPosted: Sun May 15, 2005 7:55 pm   Post subject: (No subject)

Oh oops, I figured that out yesterday, and I just used the elsif method because I only have up/down left/right, but today I only remembered the question Doh! Doh!

Anways, thanks for saving me the trouble of having to figure that out again Laughing
theguru




PostPosted: Fri Oct 14, 2005 10:55 pm   Post subject: (No subject)

maybe something is wrong with my turing version but i think the oval's screwed up. i end up getting an '0'. but other than that, this tutorial and examples were really helpful! Smile
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 5  [ 63 Posts ]
Goto page Previous  1, 2, 3, 4, 5  Next
Jump to:   


Style:  
Search: