1
General / Re: Circe Shape only moves when variable change or key press?
« on: December 13, 2017, 07:27:02 am »
There are lots of issues I see in your code, I'll just go through a few:
I know this isn't codereview, and I know if I didn't say this now, someone else definitely would've, and Arcade already sort of has, but there you go. Object-orientation would be the biggest factor.
- You have 2 variables called AccelX & AccelY, first of all, assuming these are the accelerations, you want to use Ship::PlayerShip.move(Ship::AccelX, Ship::AccelY); instead of just setting the position. Secondly, use sf::Vector's, you're going to find yourself using the sf::Vector constructor with the X and Y for SFML function arguments, which isn't very human readable.
- Re-organize your classes. In my 3 years of C++, I've never seen a file called "Main.h". You got the .cpp for implementation and .h for declaration down, you just need to start splitting the files up accordingly, for example, your Window class should probably be in Window.h & Window.cpp.
- Member functions, Object-orientation, Static variables, you seem very confused about these three.
Remove the static parts from your Ship class and put those stray functions which affect ship movement inside the Ship class, in fact, I would just make a single update function inside the Ship class and put the stuff from Movement() and RotationMovement()
in there.
I know this isn't codereview, and I know if I didn't say this now, someone else definitely would've, and Arcade already sort of has, but there you go. Object-orientation would be the biggest factor.