Danbias/Code/Game/GameLogic/Player.cpp

60 lines
1.0 KiB
C++
Raw Normal View History

2013-11-19 11:07:14 +01:00
#include "Player.h"
2013-11-25 11:03:06 +01:00
#include "OysterMath.h"
#include "CollisionManager.h"
2013-11-25 11:03:06 +01:00
2013-11-19 11:07:14 +01:00
using namespace GameLogic;
2013-11-25 11:03:06 +01:00
using namespace Oyster::Physics;
2013-11-19 11:07:14 +01:00
Player::Player(std::wstring objFile)
:Object( objFile )
2013-11-19 11:07:14 +01:00
{
2013-11-26 11:30:49 +01:00
life = 100;
rigidBody->SetSubscription(CollisionManager::PlayerCollision);
2013-11-19 11:07:14 +01:00
}
Player::~Player(void)
{
delete this->rigidBody;
2013-11-21 12:05:39 +01:00
}
2013-11-29 09:05:01 +01:00
void Player::Update(keyInput keyPressed)
2013-11-21 12:05:39 +01:00
{
if(keyPressed != keyInput_none)
{
2013-11-29 09:05:01 +01:00
Move(keyPressed);
}
2013-11-21 12:05:39 +01:00
}
2013-11-29 09:05:01 +01:00
void Player::Move(keyInput keyPressed)
2013-11-21 12:05:39 +01:00
{
2013-11-29 09:05:01 +01:00
if(keyPressed == keyInput_A)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x -= 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_D)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.x += 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_S)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.y -= 0.1;
rigidBody->SetCenter(pos);
}
if(keyPressed == keyInput_W)
{
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
pos.y += 0.1;
rigidBody->SetCenter(pos);
}
2013-11-21 12:05:39 +01:00
}
void Player::Shoot()
{
2013-11-19 11:07:14 +01:00
}