2022-10-30 23:44:30 +01:00
|
|
|
#include "Entity.h"
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
Entity::Entity(Vec2 p, Vec2 s, Vec2 a):
|
|
|
|
pos(p), spe(s), acc(a)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Entity::Update(){
|
|
|
|
pos = pos + spe + acc/2;
|
|
|
|
spe = spe + acc;
|
2022-11-02 07:44:57 +01:00
|
|
|
if(pos.y >= 1000){
|
|
|
|
spe.y = - spe.y + acc.y;
|
|
|
|
}
|
|
|
|
if(pos.x >= 1920){
|
|
|
|
pos.x = 0;
|
|
|
|
}
|
2022-10-30 23:44:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Entity::Debug() const{
|
|
|
|
std::cout << "pos= (" << pos.x << ", " << pos.y << ")"
|
|
|
|
<< "spe= (" << spe.x << ", " << spe.y << ")"
|
|
|
|
<< "acc= (" << acc.x << ", " << acc.y << ")" << std::endl;
|
|
|
|
}
|
2022-11-02 07:44:57 +01:00
|
|
|
|
|
|
|
Vec2 Entity::GetPos(){
|
|
|
|
return pos;
|
|
|
|
}
|