Page 1 of 1

Turing help

Posted: Fri Jan 09, 2004 3:12 pm
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

Turing help

Posted: Fri Jan 09, 2004 3:49 pm
by estranged
hello.....anyone there

Archived topic from Iceteks, old topic ID:1891, old post ID:15523

Turing help

Posted: Fri Jan 09, 2004 4:42 pm
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

Turing help

Posted: Fri Jan 09, 2004 6:19 pm
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

Turing help

Posted: Fri Jan 09, 2004 6:23 pm
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

Turing help

Posted: Fri Jan 09, 2004 9:33 pm
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

Turing help

Posted: Fri Jan 09, 2004 11:45 pm
by syb
that would be hard to learn

Archived topic from Iceteks, old topic ID:1891, old post ID:15534

Turing help

Posted: Mon Jan 12, 2004 3:38 pm
by estranged
thanks syb,

ps. i found this site through google

Archived topic from Iceteks, old topic ID:1891, old post ID:15583

Turing help

Posted: Mon Jan 12, 2004 3:47 pm
by syb
good site eh.

Archived topic from Iceteks, old topic ID:1891, old post ID:15584

Turing help

Posted: Mon Jan 12, 2004 3:49 pm
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

Turing help

Posted: Mon Jan 12, 2004 3:49 pm
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

Turing help

Posted: Tue Jan 13, 2004 11:38 am
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

Turing help

Posted: Tue Jan 13, 2004 3:07 pm
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

Turing help

Posted: Tue Jan 13, 2004 3:28 pm
by estranged
anyone here??

Archived topic from Iceteks, old topic ID:1891, old post ID:15608

Turing help

Posted: Tue Jan 13, 2004 5:49 pm
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

Turing help

Posted: Tue Jan 13, 2004 10:07 pm
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

Turing help

Posted: Wed Jan 14, 2004 3:31 pm
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

Turing help

Posted: Wed Jan 14, 2004 3:47 pm
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

Turing help

Posted: Wed Jan 14, 2004 3:56 pm
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

Turing help

Posted: Thu Jan 15, 2004 10:02 am
by syb
np

Archived topic from Iceteks, old topic ID:1891, old post ID:15641