HumanSoldier.cpp 636 B

123456789101112131415161718192021222324252627
  1. //
  2. // Created by jovian on 18/07/17.
  3. //
  4. #include "HumanSoldier.h"
  5. HumanSoldier::HumanSoldier(TinyWorld *tinyWorld, Controller *ctrl, b2Vec2 spawn, unsigned int camp)
  6. : Soldier(ALLY, ctrl, tinyWorld, 0, camp, 100), m_zoom(DEFAULT_ZOOM) {
  7. // Shape
  8. createPhysicalShape(spawn);
  9. }
  10. void HumanSoldier::update() {
  11. // Zoom
  12. m_zoom = DEFAULT_ZOOM * m_ctrl->getZoomScale();
  13. // Call Soldier update
  14. Soldier::update();
  15. }
  16. Visual *HumanSoldier::makeLifeBar() {
  17. return new Visual(15 + m_life / 17, m_body->GetPosition() + b2Vec2(0.0f, -0.75f), 0.0f);
  18. }
  19. float HumanSoldier::getZoom() const {
  20. return m_zoom;
  21. }