aboutsummaryrefslogtreecommitdiffstats
path: root/src/wp_nadelauncher.cpp
blob: 224b0a6f12f222df7506051d175dd57746f3d74a (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "wp_nadelauncher.hpp"

#include <raylib.h>
#include <raymath.h>
#include <iostream>

#include "entity.hpp"
#include "projectile.hpp"

wp_nadelauncher::wp_nadelauncher(const char* s, const char* r)
    : AWeapon(300.0f, 1, 30, 0.0, s, r, "nade", true) {}
wp_nadelauncher::~wp_nadelauncher() {}

int wp_nadelauncher::bang(std::vector<Entity>* enemies, Entity* player) {
    if (barrel == 0) {
        return (1);
    } else {
        Projectile* proj = new Projectile();
        proj->dir = player->direction;
        proj->radius = player->radius;
        proj->posX = player->posX;
        proj->posY = player->posY;

        barrel--;
        PlaySound(shot);
        t = GetTime();
        // here
        //
        //
        // there
        if (barrel == 0) {
            empty = true;
        }
        return (0);
    }
}

Projectile const& wp_nadelauncher::getProjectile() const {
    return (projectile);
}