mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-18 11:29:21 +01:00
Add sun / moon, started on score / GameManager
This commit is contained in:
14
Game/Levels/World/OrbitingObject.cpp
Normal file
14
Game/Levels/World/OrbitingObject.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#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);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user