Changed Player initial position to be passed in constructor.
This commit is contained in:
parent
45f0b31d57
commit
34f0f95bce
3 changed files with 4 additions and 4 deletions
|
@ -30,7 +30,7 @@ Game::Game(const Vector2i& resolution) :
|
||||||
mView(Vector2f(0, 0), Vector2f(resolution)),
|
mView(Vector2f(0, 0), Vector2f(resolution)),
|
||||||
//mFps("test"),
|
//mFps("test"),
|
||||||
mTileManager(mWorld),
|
mTileManager(mWorld),
|
||||||
mPlayer(mWorld, mCollection),
|
mPlayer(mWorld, mCollection, Vector2f(200.0f, 100.0f)),
|
||||||
mElapsed(0),
|
mElapsed(0),
|
||||||
mQuit(false),
|
mQuit(false),
|
||||||
mPaused(false) {
|
mPaused(false) {
|
||||||
|
|
|
@ -17,8 +17,8 @@ const float Player::SPEED = 100.0f;
|
||||||
/**
|
/**
|
||||||
* Initializes Sprite.
|
* Initializes Sprite.
|
||||||
*/
|
*/
|
||||||
Player::Player(b2World& world, Collection& collection) :
|
Player::Player(b2World& world, Collection& collection, const Vector2f& position) :
|
||||||
Sprite("player.png", PhysicalData(Vector2f(200.0f, 100.0f), Vector2i(50, 50), world,
|
Sprite("player.png", PhysicalData(position, Vector2i(50, 50), world,
|
||||||
CATEGORY_ACTOR, MASK_ALL, true)),
|
CATEGORY_ACTOR, MASK_ALL, true)),
|
||||||
mWeapon(*this, collection, world),
|
mWeapon(*this, collection, world),
|
||||||
mDestination(Vector2i(50, 50)) {
|
mDestination(Vector2i(50, 50)) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Sprite;
|
||||||
class Player : public Sprite, public Actor {
|
class Player : public Sprite, public Actor {
|
||||||
// Public functions.
|
// Public functions.
|
||||||
public:
|
public:
|
||||||
Player(b2World& world, Collection& collection);
|
Player(b2World& world, Collection& collection, const Vector2f& position);
|
||||||
|
|
||||||
void setCrosshairPosition(const Vector2f& position);
|
void setCrosshairPosition(const Vector2f& position);
|
||||||
void fire();
|
void fire();
|
||||||
|
|
Reference in a new issue