Adicionada constante TIME_RATE, deve ser passada para config depois
[Projeto-PCG.git] / thing.cpp
blob1bcb46966c9d74a6f56d1e4ac4b76964b6e9faa7
1 #include "thing.h"
2 #include "game.h"
4 Thing::Thing() {
5 onGround = false;
6 maxspeed.x = 99999;
7 maxspeed.y = 99999;
8 gravityRate = 0.3;
11 void Thing::addSpeed(double xspeed, double yspeed) {
12 setSpeed(velocidade.x+xspeed,velocidade.y+yspeed);
15 void Thing::setSpeed(double xspeed, double yspeed) {
16 velocidade.x = std::max(std::min(xspeed,maxspeed.x),-maxspeed.x);
17 velocidade.y = std::max(std::min(yspeed,maxspeed.y),-maxspeed.y);
20 void Thing::setPosition(double x, double y) {
21 posicao.x = x;
22 posicao.y = y;
25 void Thing::move(int t) {
26 posicao.x += velocidade.x*t/TIME_RATE;
27 posicao.y += velocidade.y*t/TIME_RATE;
30 Linha Thing::getBaseLine() {
31 Linha ret(0,0,0,0);
32 return ret;
35 Polygon Thing::getCollision() {
36 Polygon poly;
37 return poly;
40 void Thing::collide(Thing* b) {
41 return;