Adicionando cabeca a caixa de colisao
[Projeto-PCG.git] / platform.cpp
blob271b2fb88d6f58c163b4560e08339791c1baac2a
1 #include "platform.h"
2 #include "math.h"
4 Platform::Platform(Linha aline, bool pass, double r, double g, double b): line(aline), passable(pass) {
5 line.color[0] = r;
6 line.color[1] = g;
7 line.color[2] = b;
10 void Platform::desenha() {
11 line.desenha();
14 double Platform::angle() {
15 double x1 = line.vertices[0].x, x2 = line.vertices[1].x,
16 y1 = line.vertices[0].y, y2 = line.vertices[1].y;
17 double size = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
18 if (size == 0.0)
19 return 0;
20 return asin(abs(y2-y1)/size);