🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

About the game loop.

Started by
0 comments, last by eu5 3 years, 6 months ago

Hi. I'm implementing a simple game like the Galaga and this is my first game.

I implement a function that move a bullet.

And If the moved bullet's position reach in end of screen, the bullet will be deleted.

void MoveBullet()
{
  while(...)
  {  
  	if(IsCollisionBulletVsWall(...))
  	{
     	// Is it good place for a bullet's deletion?
     	// or I have to move the deletion to other function? 
     	bullet->Delete();
  	}
  	else
  	{
     	bullet->Move();
  	}
  }
}

In here, I have a question.

Is it appropriate to be located the bullet's deletion code in MoveBullet()?

I think it's also good that If the function name is ‘MoveBullet’, JUST have a code about ONLY MOVE.

What do you think?

This topic is closed to new replies.

Advertisement