-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCircleActor.h
50 lines (35 loc) · 1.07 KB
/
CircleActor.h
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
41
42
43
44
45
46
47
48
49
50
#pragma once
#include "Actor.h"
#include "Arena.h"
#include "Color.h"
class CircleActor : public Actor
{
void init();
protected:
struct State {
vector_type s, v, a;
};
void state( const State& state );
State state();
public:
// Status info
bool isActive;
bool isMovable;
bool isDeadly;
bool isAttractor;
CircleActor();
CircleActor( const vector_type& position );
virtual value_type radius() const = 0;
virtual value_type mass() const = 0;
virtual State on_off_screen( State state );
virtual State integrate( State state, int dt, value_type maxSpeed=0 );
// Overloads Actor::move to add functionality like staying on the
// screen.
void move_impl( float dt, value_type maxSpeed=0 );
// How many points are awarded for killing this. Allows negative values.
virtual int score_value() = 0;
virtual void collide_with( CircleActor& collider ) = 0;
// The general color of this.
virtual Color color() = 0;
};
bool collision( const CircleActor& c1, const CircleActor& c2 );