18 const int img_num_step = 4; |
18 const int img_num_step = 4; |
19 const int img_height = 20; |
19 const int img_height = 20; |
20 const int img_width = 17; |
20 const int img_width = 17; |
21 |
21 |
22 Player::Player(GameState &state, Vector position, bool visible) : |
22 Player::Player(GameState &state, Vector position, bool visible) : |
23 PhysicsObject(state.world, PLAYER_MASS, position, Vector(0, 0), PLAYER, PLAYER_COLLISION_ELASTICITY), state(state), |
23 PhysicsObject(state.world, PLAYER_MASS, position, Vector(0, 0), PLAYER, PLAYER_COLLISION_ELASTICITY), |
24 visible(visible), weapons(buildWeaponsList()), selectedWeapon(0), animation_step(0), rope(*this) |
24 state(state), |
|
25 visible(visible), |
|
26 weapons(buildWeaponsList()), |
|
27 selectedWeapon(0), |
|
28 rope(*this), |
|
29 animation_step(0) |
25 { |
30 { |
26 // XXX: populate weapons from somewhere else |
31 // XXX: populate weapons from somewhere else |
27 |
32 |
28 // build the player's shape |
33 // build the player's shape |
29 // XXX: these dimensions are incorrect... |
34 // XXX: these dimensions are incorrect... |
84 if (getCurrentWeapon()) |
89 if (getCurrentWeapon()) |
85 getCurrentWeapon()->tickReload(dt); |
90 getCurrentWeapon()->tickReload(dt); |
86 } |
91 } |
87 |
92 |
88 void Player::handleRopeState (RopeState state) { |
93 void Player::handleRopeState (RopeState state) { |
89 |
94 (void) state; |
90 } |
95 } |
91 |
96 |
92 void Player::handleRopeLength (float length) { |
97 void Player::handleRopeLength (float length) { |
93 |
98 (void) length; |
94 } |
99 } |
95 |
100 |
96 void LocalPlayer::fireWeapon (Weapon *weapon) { |
101 void LocalPlayer::fireWeapon (Weapon *weapon) { |
97 // calculate new position and velocity |
102 // calculate new position and velocity |
98 Vector shotPosition = position + getDirection() * PROJECTILE_START_DISTANCE; |
103 Vector shotPosition = position + getDirection() * PROJECTILE_START_DISTANCE; |