Erasing Character

Started by
4 comments, last by Scouting Ninja 7 years, 9 months ago

well I am trying to erase a character using glutBitmapCharacter. here is my code so far

void draw_ship()

{

glColor3f(0.0f,0.0f,0.0f);

glRasterPos2i(0,0);

glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24 'F');

glRasterPos2i(0,0);

glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, ' ');

}

Advertisement

As usual, you're not giving nearly enough information and just posting random pieces of code.

That said, what you're asking for sounds like the wrong way to solve your stated problem.

If you want to stop drawing something, just don't draw it.

Every frame, clear the screen, and only draw the things you want to draw.

Hello to all my stalkers.

Precisely, you have been told already.

well here is a pong game I have developed, this shows that I can actually program, let me know what you think.

well here is a pong game I have developed, this shows that I can actually program, let me know what you think.

I'm not very keen on running random executables on my machine.

That said, you making a pong game before has absolutely nothing to do with the topic at hand.

To erase something visually, just stop drawing it. That's all there is to it.

Hello to all my stalkers.

The way I do it is I have a character class, each character on screen is a instance of this class.

The draw call and all other effects is contained in the instance so deleting the instance deletes the character.

Some times this can lead to some basic problems, like if a turret is targeting the character and a bullet deletes it then the turret calls a invalid object. This can be prevented by checking if the turret has a valid target before executing the code.

This topic is closed to new replies.

Advertisement