Sign in to follow this  
phil67rpg

simple variable question

Recommended Posts

phil67rpg    443
I am getting a "left" ambiguous variable error. I am trying to move a breakout paddle left. I was told not to use global variables but then I am unsure of how to tackle this problem. I will do more research on functions and global variables.
[code]
void paddle_left(void)
{
//draw paddle
glBegin(GL_QUADS);
glTexCoord2f(-1.0f, 0.0f);
glVertex3f(-1.0+left, -4.5f, 0.0f);
glTexCoord2f(-1.0F, 1.0f);
glVertex3f(1.0f+left, -4.5f, 0.0f);
glTexCoord2f(0.0f, 1.0f);
glVertex3f(1.0f+left, -5.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(-1.0+left, -5.0f, 0.0f);
glEnd();
left-=1;
}
[/code]
I am using texture mapping to draw the paddle.

Share this post


Link to post
Share on other sites
SelethD    456
From what I can tell, you need to either have the variable left, as a global, or if you dont want to do that, you need to pass in the variable for 'left' as a parameter....

void paddle_left(float left)
{
....
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this