Example #1
0
void Player::Initialize(Graphics *graphics)
{
  _moveSpeed = 3.0f;

  BodyNode *head = new BodyNode();
  head->Initialize(graphics);
  head->SetDirection(BodyNode::LEFT);
  head->moveSpeed = _moveSpeed;
  head->active = true;
  numCubes = 1;

  // Create first node for the player.
  _body.push_back(head);
  _difference = 0.0f;
}
Example #2
0
void Player::AddBodyPiece(Graphics *graphics)
{
  BodyNode *bodyPiece = new BodyNode();
  bodyPiece->Initialize(graphics);
  bodyPiece->moveSpeed = _moveSpeed;
  _body.size();

  // Copy over the information from the previous node.
  bodyPiece->GetTransform().position = _body[_body.size() - 1]->GetTransform().position;
  bodyPiece->directionChange = _body[_body.size() - 1]->directionChange;

  // Add the node to our list.
  _body.push_back(bodyPiece);
  numCubes++;
  _piecesToAdd++;
}