summaryrefslogtreecommitdiffhomepage
path: root/Player-inl.h
blob: 32f61176f1bc6c60543f8c50fcd85c89074612b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#pragma once

#include <vector>

#include <raylib.h>


template<typename T>
bool
Player::collide(const std::vector<T>& bullets)
{
    if (m_invulnerability > 0)
        return false;
    for (const auto& bullet : bullets) {
        if (CheckCollisionCircles(m_position, 4, bullet.position, bullet.radius)) {
            hit();
            return true;
        }
    }
    return false;
}