refactoring the code for projectile type object