Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


#Actualwarnexus

Posted 30 March 2013 - 02:57 PM

If I add more projectiles for my character or for present/future monsters in my game, eventually the collision checks will soon grown in my game loop. There will definitely be far too many if statements checking instances of projectile and skill which I know will be difficult to manage or inefficient code. Right now it is okay since I only added a laser for my ship character and a skill for a ghost. But I thought I think long term when it comes to a large codebase for a game. smile.png
 
Here's what I mean:  
 
while(!isLooping)
{
 
 
if(isRunning){
// collision detection checks of the game
for(GameComponent component: gameObjects){
if(component instanceof Laser)
{
((Laser) component).checkMonsterCollision(gameObjects);
 
}
if(component instanceof GhostSkill)
{
((GhostSkill) component).checkShipCollision(gameObjects,shipLifeTitle,shipHealthSystem);
 
} 
 
} 
}
}

#2warnexus

Posted 30 March 2013 - 02:56 PM

If I add more projectiles for my character or for present/future monsters in my game, eventually the collision checks will soon grown in my game loop. There will definitely be far too many if statements checking instances of projectile and skill which I know will be difficult to manage or inefficient code. Right now it is okay since I only added a laser for my ship character and a skill for a ghost. But I thought I think long term when it comes to a large codebase like a game. smile.png
 
Here's what I mean:  
 
while(!isLooping)
{
 
 
if(isRunning){
// collision detection checks of the game
for(GameComponent component: gameObjects){
if(component instanceof Laser)
{
((Laser) component).checkMonsterCollision(gameObjects);
 
}
if(component instanceof GhostSkill)
{
((GhostSkill) component).checkShipCollision(gameObjects,shipLifeTitle,shipHealthSystem);
 
} 
 
} 
}
}

#1warnexus

Posted 30 March 2013 - 02:55 PM

If I add more projectiles for my character or for present/future monsters in my game, eventually the collision checks will soon grown in my game loop. There will definitely be far too many if statements checking instances of projectile and skills which I know will be difficult to manage or inefficient code. Right now it is okay since I only added a laser for my ship character and a skill for a ghost. But I thought I think long term when it comes to a large codebase like a game. smile.png 
 
Here's what I mean:  
 
while(!isLooping)
{
 
 
if(isRunning){
// collision detection checks of the game
for(GameComponent component: gameObjects){
if(component instanceof Laser)
{
((Laser) component).checkMonsterCollision(gameObjects);
 
}
if(component instanceof GhostSkill)
{
((GhostSkill) component).checkShipCollision(gameObjects,shipLifeTitle,shipHealthSystem);
 
} 
 
} 
}
}

PARTNERS