summaryrefslogtreecommitdiffhomepage
path: root/Falling.cpp
blob: 38c05d425b24795552b056f446dc121617f00d51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "Falling.h"

#include <memory>

#include <raylib.h>

#include "Generator.h"


Falling::Falling(std::shared_ptr<Vector2> position, std::shared_ptr<Generator> generator) :
    m_speed {40},
    m_position {position},
    m_generator {generator}
{
}


void
Falling::update(const float dt)
{
    m_position->y += dt * m_speed;
    if (m_generator->m_enabled && m_position->y > 620)
        m_generator->m_enabled = false;
}