Advertisement
Al99

Player.cpp

Nov 11th, 2019
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include "Player.h"
  2.  
  3. Player::Player(const LoaderParams* pParams) :
  4. SDLGameObject(pParams)
  5. {
  6. }
  7.  
  8. void Player::draw(SDL_Renderer* pRenderer)
  9. {
  10.     SDLGameObject::draw(pRenderer);
  11. }
  12.  
  13. void Player::update()
  14. {
  15.         m_velocity.setX(0);
  16.         m_velocity.setY(0);
  17.        
  18.         handleInput();
  19.        
  20.         m_currentFrame = int (((SDL_GetTicks() / 100) % 6));
  21.  
  22.         SDLGameObject::update();
  23.  
  24.         if(TheInputHandler::Instance()->xvalue(0, 1) > 0 ||
  25.         TheInputHandler::Instance()->xvalue(0, 1) < 0)
  26.         {
  27.             m_velocity.setX(1 * TheInputHandler::Instance()->xvalue(0, 1));
  28.         }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement