sui-jin 0 Newbie Poster

hello im trying to create a similar to snake game in TMT pascal lite and whenever i have the snake constintly moving but then want to user to enter the direction he wants the snake i cant figure out how to stop the program from pausing while reading the key inputted from the user for example


key:=readkey;


case key of

'8':begin


setcolor(black);
putpixel(x-temp2,y-temp1);
dir_y:=-1;
dir_x:=0;
x:= x + dir_x;
y:= y + dir_y;
setcolor(white);
putpixel(x,y);
putpixel(x,y);
delay(30);
temp1:=dir_y;
temp2:=dir_x;

thats just a small bit of my code it may not be enough for you guys to understand but if u do i need help. is there another command to read a key entered from the user with out the program stopping or is there something i have to do with READKEY in order to keep the program from stopping like ill have one of my cases in a loop untill key=*whatever*
and when it goes to read the key it will pause the program untill the key is entered what im looking for is it to keep the snake moving and read the key the user inputs with out the snake pausing ive been up since 12:00 trying to figure just that part out and if i could recieve any help at all it will be of much thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.