Re: Shooter XT - Open sourced 2D Sidescroller Shooter for BGT beginners
/*calculates the difference to buy the next building:
*Parameters:
*num_of_buildings (int) The current amount of buildings the player owns
*current_cost (int) The current cost to purchase the building
*multiplier (double) The amount by which the cost is going to be multiplied
*Return Value:
*The new cost for the purchased building
The function implementation could look like this:
int buy_building(int num_of_buildings, int current_cost, double multiplier)
{
return 1 + (num_of_buildings * 0.1) * current_cost * multiplier;
}
Of course, for a simple function like this, you could also do something like this in terms of comments.
/*calculates the difference to buy the next building*/
int buy_building(int num_of_buildings, int current_cost, double multiplier)
{
return 1 + (num_of_buildings * 0.1) * current_cost * multiplier;
}
Even if the function would be more complex, you'd still get it's purpose.
Commenting isn't easy, though, so at least it's a valuable learning experience for you.
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector