Platform game gravity problem
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
And P1 is called like: player P1;
else P1.y += P1.gravityPull;
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?