1 #ifndef SPACE_MOVEABLE_H_
2 #define SPACE_MOVEABLE_H_
13 Moveable(Vector<Scalar> pos, Scalar speed)
14 : dir(0, 0), pos(pos), speed(speed) { }
17 const Vector<Scalar> &Pos() const { return pos; }
18 Vector<Scalar> Vel() const { return Vector<Scalar>(dir) * speed; }
19 void SetSpeed(float s) { speed = s; }
21 void Update(Scalar delta) {
26 void MoveUp() { dir.y -= 1; }
27 void StopUp() { dir.y += 1; }
28 void MoveDown() { dir.y += 1; }
29 void StopDown() { dir.y -= 1; }
30 void MoveLeft() { dir.x -= 1; }
31 void StopLeft() { dir.x += 1; }
32 void MoveRight() { dir.x += 1; }
33 void StopRight() { dir.x -= 1; }