I am attempting to move a sprite through a maze. here is a screen shot https://imgur.com/46vUtw1 here is the code I am working on. I am able to get the sprite to move up but not the left. I just need a hint on how to get the sprite to move through the maze. I am trying not to troll for answers.
void handleSpecialKeypress(int key, int, int y)
{
switch (key)
{
case GLUT_KEY_LEFT:
move_horizontal--;
if (move_horizontal <= 0.0f)
{
move_horizontal = 0.0f;
}
direction_x = -1;
break;
case GLUT_KEY_RIGHT:
move_horizontal++;
if (move_horizontal >= 0.0f)
{
move_horizontal = 0.0f;
}
direction_x = 1;
break;
case GLUT_KEY_UP:
move_vertical++;
if (move_vertical >= 20.0f)
{
move_vertical = 20.0f;
}
break;
case GLUT_KEY_DOWN:
move_vertical--;
if (move_vertical <= 0.0f)
{
move_vertical = 0.0f;
}
break;
}
glutPostRedisplay();
}