Jump to content
  • Advertisement
Sign in to follow this  
phil67rpg

Erasing Character

This topic is 721 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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, ' ');

}

 

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!