code error!!

if (keys[’ '] && !sp)
{
sp=TRUE;
object++;
if(object>5)
object=0;

			}
			if (!keys[' '])
			{
				sp=FALSE;
			}
			if (keys[VK_PRIOR])
			{
				z-=0.02f;
			}
			if (keys[VK_NEXT])
			{
				z+=0.02f;
			}
			if (keys[VK_UP])
			{
				xspeed-=0.01f;
			}
			if (keys[VK_DOWN])
			{
				xspeed+=0.01f;
			}
			if (keys[VK_RIGHT])
			{
				yspeed+=0.01f;
			}
			if (keys[VK_LEFT])
			{
				yspeed-=0.01f;
			}
			if (keys['t'] && !tp)
			{
				tp=TRUE;
				
				while(xspeed!=0.00f)
				{
					xspeed=0.00f;
				}

				while(yspeed!=0.0f)
				{
					yspeed=0.00f;
				}
			}
			if (!keys['t'])
			{
				tp=FALSE;
			}

When i pressed the spacebar the image will loop to display a series of images. The VK_UP, DOWN, LEFT ,RIGHT are to rotate the image. VK_NEXT, PRIOR are to increase and decrease the image depth.

Ok. My problem is that when the image is rotating after the arrow keys are pressed, i want to stop the rotation by pressing the ‘t’ key. But i cant seem to get it…
What’s wrong with my coding??
Can anyone help??? Thanks in advance…

Looking at your code, I was a little confused because you have stuff like
Key[‘t’]

When you index an array, it has to be an integer that you pass to it.
You probably wanted to say something like
if(Key[1] = ‘t’)
where 1 can be an integer variable.

My bad, dont forget to use double operator to compare.

if(Key[1] == ‘t’)

I think that he is using the NEHE basecode, which uses an array if booleans, one for each character, so the Keys[‘t’] is correct. I would suggest switching the t to a T, that might correct the problem

I’ve got it!!
Thanks alot for your help!!