Turing help

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

im new to turing and i wanted to know how to make something move, corresponding to the arrow keys

Archived topic from Iceteks, old topic ID:1891, old post ID:15522
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

hello.....anyone there

Archived topic from Iceteks, old topic ID:1891, old post ID:15523
Chris Vogel
Posts: 5140
Joined: Fri Jan 10, 2003 1:14 am

Turing help

Post by Chris Vogel »

I'm sorry, but I can't help you. Turing must not be very popular. I didn't know about it until I saw our first thread on it. Speaking of that, anyone with a need for Turing help should consider posting in one of our other Turing threads instead of starting a brand-new one.

EDIT:
Turing help threads
http://www.iceteks.com/forums/index.php?showtopic=1879&
http://www.iceteks.com/forums/index.php?showtopic=1881&
http://www.iceteks.com/forums/index.php?showtopic=1859&
http://www.iceteks.com/forums/index.php?showtopic=1831&

Archived topic from Iceteks, old topic ID:1891, old post ID:15524
syb
Posts: 222
Joined: Wed Jun 18, 2003 10:12 pm

Turing help

Post by syb »

poeple are here. i am looking it up as we speak.

Archived topic from Iceteks, old topic ID:1891, old post ID:15525
The wisdom of sight comes from the father of lights
syb
Posts: 222
Joined: Wed Jun 18, 2003 10:12 pm

Turing help

Post by syb »

Input.KeyDown get keyboard state

Syntax Input.KeyDown (var chars : array char of boolean)

Description The Input.Keydown procedure allows a program to read which keys are currently being pressed. This procedure is different from getch in that it allows a program to detect when a user presses and releases a button. As such, it is not to be used in conjunction with getch.
The procedure can be used in games where an action takes place while a key is depressed.


Example Determine if the T key is pressed. Note that we check for the lower case letter.

var chars : array char of boolean
Input.KeyDown (chars)
if chars ('t') then
put "The T key is pressed"
end if

Details The array returned is a list of all the characters. A key is currently pressed if the array element with the corresponding character is true. For example, the a key is pressed is chars ('a') is true. Note that each key is individually represented, so if the user has pressed Shift+a to get a 'A', then Input.KeyDown would register Shift and 'a' as pressed, but not 'A'.
A full list of all the possible characters that can be set with Input.KeyDown can be found in the Key Codes appendix.


Details The array returned is a list of all the characters. A key is currently pressed if the array element with the corresponding character is true. For example, the a key is pressed is chars ('a') is true. Note that each key is individually represented, so if the user has pressed Shift+a to get a 'A', then Input.KeyDown would register Shift and 'a' as pressed, but not 'A'.

Details The number of keys that can be pressed simultaneously is hardware dependent. Most keyboards can detect a minimum of two keys + Shift + Control + Alt. This means that if you are designing a two player game to be played at a single keyboard and you wish to make certain that players cannot “hog the keyboard” by holding down keys, you should not use more than 6 different keys and three of them should be the Shift, Control and Alt keys.

Example The program reads the keyboard and displays a message while the arrow keys are pressed. It can detect up to all four arrow keys pressed at once.

var chars : array char of boolean
loop
Input.KeyDown (chars)
locate (1, 1)
if chars (KEY_UP_ARROW) then
put "Up Arrow Pressed " ..
else
put " " ..
end if
if chars (KEY_RIGHT_ARROW) then
put "Right Arrow Pressed " ..
else
put " " ..
end if
if chars (KEY_LEFT_ARROW) then
put "Left Arrow Pressed " ..
else
put " " ..
end if
if chars (KEY_DOWN_ARROW) then
put "Down Arrow Pressed " ..
else
put " " ..
end if
end loop

Status Exported qualified.
This means that you can only call the function by calling Input.KeyDown, not by calling KeyDown.




Archived topic from Iceteks, old topic ID:1891, old post ID:15526
The wisdom of sight comes from the father of lights
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Turing help

Post by Red Squirrel »

yeah we must be featured on some kind of turing site or something. :D I wish we could help more but I don't know turing, only a bit of C++ and more php. I want to learn assembly one of these days. :banana:

Archived topic from Iceteks, old topic ID:1891, old post ID:15531
Honk if you love Jesus, text if you want to meet Him!
syb
Posts: 222
Joined: Wed Jun 18, 2003 10:12 pm

Turing help

Post by syb »

that would be hard to learn

Archived topic from Iceteks, old topic ID:1891, old post ID:15534
The wisdom of sight comes from the father of lights
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

thanks syb,

ps. i found this site through google

Archived topic from Iceteks, old topic ID:1891, old post ID:15583
syb
Posts: 222
Joined: Wed Jun 18, 2003 10:12 pm

Turing help

Post by syb »

good site eh.

Archived topic from Iceteks, old topic ID:1891, old post ID:15584
The wisdom of sight comes from the father of lights
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

is ther anyway i can just draw a box, and move it over 10 pixels when i press the arrow keys??? It will take too long doing it all in IF statements.

Archived topic from Iceteks, old topic ID:1891, old post ID:15585
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Turing help

Post by Red Squirrel »

Haha

http://www.google.ca/search?q=turing+forum...le+Search&meta=

That is cool. :D

Archived topic from Iceteks, old topic ID:1891, old post ID:15586
Honk if you love Jesus, text if you want to meet Him!
syb
Posts: 222
Joined: Wed Jun 18, 2003 10:12 pm

Turing help

Post by syb »

wow nowonder everyone go's here. Okay you want to know if you can move a box over 10 pixs without a if statement. hm... I am not sure but you may be able to use lable. I think the if stament is the only way.

Archived topic from Iceteks, old topic ID:1891, old post ID:15605
The wisdom of sight comes from the father of lights
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

hey syb,
i got my box to move a little but i need help with the syntax,
when i press the right arrow i want it to move over by 10 pxl's so i have it add 10 to x1,y1,x2,y2, but i am unsure how to declare these as the variables

Archived topic from Iceteks, old topic ID:1891, old post ID:15607
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

anyone here??

Archived topic from Iceteks, old topic ID:1891, old post ID:15608
User avatar
Red Squirrel
Posts: 29209
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

Turing help

Post by Red Squirrel »

Yes, but syb is the only one here who knows turing. I can help with php though... :D

Archived topic from Iceteks, old topic ID:1891, old post ID:15613
Honk if you love Jesus, text if you want to meet Him!
syb
Posts: 222
Joined: Wed Jun 18, 2003 10:12 pm

Turing help

Post by syb »

i am to tiered to think... you do know how to use "Input.KeyDown" stament?


Archived topic from Iceteks, old topic ID:1891, old post ID:15616
The wisdom of sight comes from the father of lights
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

yeah, heres what i have so far ( i still get errors and don't know what to do)

var chars : array char of boolean
var x1,y1,x2,y2: int
drawfillbox(x1,y1,x2,y2,7)
loop
Input.KeyDown (chars)
if chars (KEY_RIGHT_ARROW) then
cls x1=x1+10 and x2=x2+10 and y1=y1 and y2=y2
elsif chars (KEY_LEFT_ARROW) then
cls x1=x1-10 and x2=x2-10 and y1=y1 and y2=y2
elsif chars (KEY_DOWN_ARROW) then
cls x1=x1 and x2=x2 and y1=y1-10 and y2=y2-10
elsif chars (KEY_UP_ARROW) then
cls x1=x1 and x2=x2 and y1=y1+10 and y2=y2+10
end if
end loop

Archived topic from Iceteks, old topic ID:1891, old post ID:15626
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

corection this is what i have

var chars : array char of boolean
var x1,y1,x2,y2: int
x1:=50
x2:=60
y1:=50
y2:=60


loop
drawfillbox(x1,y1,x2,y2,7)
Input.KeyDown (chars)
if chars (KEY_RIGHT_ARROW) then
cls
x1:=x1+10
x2:=x2+10
elsif chars (KEY_LEFT_ARROW) then
cls
x1:=x1-10
x2:=x2-10
elsif chars (KEY_DOWN_ARROW) then
cls
y1:=y1-10
y2:=y2-10
elsif chars (KEY_UP_ARROW) then
cls
y1:=y1+10
y2:=y2+10
end if
end loop


Archived topic from Iceteks, old topic ID:1891, old post ID:15628
estranged
Posts: 10
Joined: Fri Jan 09, 2004 3:10 pm

Turing help

Post by estranged »

I GOT IT!!
i just had to add a short delay before i ended the loop (i am not sure why though)

syb, thanks for telling me how to use the keyboard

Archived topic from Iceteks, old topic ID:1891, old post ID:15630
syb
Posts: 222
Joined: Wed Jun 18, 2003 10:12 pm

Turing help

Post by syb »

np

Archived topic from Iceteks, old topic ID:1891, old post ID:15641
The wisdom of sight comes from the father of lights
Locked