very early prototype of a spaceshooter in SFML
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

player.hpp 674B

12345678910111213141516171819202122232425
  1. #pragma once
  2. #include <SFML/Graphics.hpp>
  3. #include <SFML/System.hpp>
  4. #include <SFML/Window.hpp>
  5. namespace Proto4 {
  6. class Player : public sf::CircleShape {
  7. sf::Vector2f speed {0.f, 0.f};
  8. const float acceleration = 2500;
  9. const float deceleration = 3;
  10. const float maxSpeed = 850;
  11. const float maxRotationSpeed = 800;
  12. sf::Vector2f keyboard2Acceleration();
  13. void updateSpeed(float timeStep, sf::Vector2f acceleration);
  14. void updateRotation(float timeStep, sf::Vector2f mousePos);
  15. public:
  16. Player();
  17. void update(sf::Time timeStep, sf::Vector2f mousePosition);
  18. void reset();
  19. };
  20. }