Computer Science Canada

I need help to make my pic move useing the keyboard!

Author:  Darkmantis [ Tue Oct 18, 2005 3:09 pm ]
Post subject:  I need help to make my pic move useing the keyboard!

I've been useing this code in school and it works but for some reason it doesn't work for me at home. PLz help me!

setscreen ("graphics:400,400")
var x, y, button : int
var kp : string (1)
x := 100
y := 100
procedure drawcar
Pic.ScreenLoad ("car1.bmp", x - 10, y - 10, picMerge)
delay (10)
end drawcar

procedure erasecar
drawfilloval (x, y, 50, 50, white)
end erasecar

kp := "z"
drawcar

loop
if hasch then
getch (kp)
end if


if kp= KEY_RIGHT_ARROW then <--It says that the KEY_RIGHT_ARROW
x := x + 40___________________has not been declared
drawcar
end if
end loop

Author:  beard0 [ Tue Oct 18, 2005 4:07 pm ]
Post subject: 

Your school has a more recent version of turing than you do. Instead of KEY_RIGHT_ARROW, which only got defined later on, use chr(205), and it will work. You can find this value and others in the help manual, under Turing Language -> Keystroke Codes.

Author:  Darkmantis [ Tue Oct 18, 2005 8:52 pm ]
Post subject: 

ok thanks a lot


: