blob: cec27ce2ae78477ff6cb69128eb71d120bb4f7fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#pragma once
#include <crepe/api/Event.h>
#include <crepe/api/Script.h>
#include <chrono>
class PlayerScript : public crepe::Script {
public:
void init();
void fixed_update(crepe::duration_t dt);
private:
bool on_collision(const crepe::CollisionEvent & ev);
// bool on_key_up(const crepe::KeyReleaseEvent& ev);
void shoot(const crepe::vec2& location,float angle);
private:
int prev_anim = 0;
std::chrono::time_point<std::chrono::steady_clock> last_fired;
std::chrono::duration<float> shot_delay = std::chrono::duration<float>(0.5);
};
|