Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Lab06_Gravity_Collisions::GameTick(double deltaTime)
- {
- //double actorSpeed;
- if(GAME_ENGINE->IsKeyDown('A') != true || GAME_ENGINE->IsKeyDown('D') != true)
- {
- m_ActorSpeed = 0;
- }
- if(GAME_ENGINE->IsKeyDown('D'))
- {
- m_ActorSpeed += 150.0;
- }
- if(GAME_ENGINE->IsKeyDown('A'))
- {
- m_ActorSpeed += -150.0;
- }
- if(GAME_ENGINE->IsKeyDown(VK_HOME))
- {
- m_ActorPos.x = 0;
- m_ActorPos.y = 0;
- m_ActorVelocity.x = m_ActorSpeed;
- m_ActorVelocity.y = 0;
- }
- m_ActorVelocity.x = m_ActorSpeed;
- m_ActorPos.x += m_ActorVelocity.x * deltaTime;
- m_ActorPos = m_ActorPos + m_ActorVelocity * deltaTime ;
- if(m_ActorPos.y > 330)
- {
- m_ActorPos.y = 330;
- m_ActorVelocity.y = 0;
- m_ActorVelocity.x = 0;
- m_ActorVelocity = m_ActorVelocity + m_Gravity * deltaTime;
- }
- else
- {
- m_ActorVelocity = m_ActorVelocity + m_Gravity * deltaTime;
- }
- m_HitActorVPtr->SetPos(m_ActorPos.x + 15, m_ActorPos.y);
- m_HitActorHPtr->SetPos(m_ActorPos.x, m_ActorPos.y);
Add Comment
Please, Sign In to add comment