I have this class called player which I want to set gravity to, making it get pulled down until it hits a platform. Now i ahve this code for doing this
Code:
	if(P1.charRect.Intersect(&plat1->rect)){

	}
	else P1.y += P1.gravityPull;
And P1 is called like: player P1;
But I wanna avoid having to have such a code for each player, how do I do this?
Is there a way I can implement this gravity code into the class? So that each of the players will be gravity affected when the class is called?