mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-16 21:01:48 +01:00
15 lines
563 B
C++
15 lines
563 B
C++
#include "pch.h"
|
|
#include "OrbitingObject.h"
|
|
|
|
#include <iostream>
|
|
OrbitingObject::OrbitingObject(const Vector2f& orbit, float distance, float speed, Texture* texture, float offset): m_Texture(texture), m_Orbit(orbit), m_Speed(speed), m_Distance(distance), m_currentCycle(offset) {
|
|
}
|
|
void OrbitingObject::Update(float elapsedSecs) {
|
|
m_Position = Vector2f(m_Orbit.x + cosf(m_currentCycle) * m_Distance, m_Orbit.y + sinf(m_currentCycle) * m_Distance);
|
|
m_currentCycle += m_Speed * elapsedSecs;
|
|
}
|
|
void OrbitingObject::Draw() const {
|
|
m_Texture->Draw(m_Position);
|
|
|
|
}
|