123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include "Ally.h"
- Ally::Ally()
- :SpaceShip( true ), m_xFront( 0 ), m_thruster( false )
- {
-
- }
- Ally::~Ally()
- {
-
- }
- void Ally::scroll( int rel )
- {
- m_pos.y += rel ;
- if ( m_pos.y < 0 )
- m_pos.y = 0;
- else if ( m_pos.y > 720 - m_pos.h )
- m_pos.y = 720 - m_pos.h;
- }
- void Ally::loadShape( std::string path )
- {
-
- SpaceShip::loadShape( path );
-
- m_xFront = 1200 - m_pos.w;
- m_pos.x = 1280;
- m_pos.y = 300;
-
- m_thruster = false;
- }
- void Ally::update()
- {
-
- SpaceShip::update();
-
- if ( m_pos.x > m_xFront )
- m_pos.x -= 2;
-
- if ( m_thruster )
- m_pos.x -= 3;
- }
- void Ally::enableThruster( bool state )
- {
- m_thruster = state;
- }
|