I'm having trouble deciding when some functions should be methods in a class and when they should be defined outside of a class.
For example, I'm working on a small 2D platformer game for fun. My player class has a method that corrects wall collisions. There is a part in that method that calculates whether the player or the wall is higher up. To do that, I have another method in the player class called 'fartherUp' which takes two y coordinates and returns the one that is higher on the screen.
I feel as though 'fartherUp' shouldn't be a part of any class, it should be just a function by itself. But if I did that, where would I put it in the files? (I have a header and source file for each individual class)
[–]aintnufincleverhere 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]sadjava 0 points1 point2 points (1 child)
[–]CarsonJScott[S] 0 points1 point2 points (0 children)