1 //  Mine.hpp -- Floating space mine things.
2 //  Copyright (C) 2008  Nick Gasson
3 //
4 //  This program is free software: you can redistribute it and/or modify
5 //  it under the terms of the GNU General Public License as published by
6 //  the Free Software Foundation, either version 3 of the License, or
7 //  (at your option) any later version.
8 //
9 //  This program is distributed in the hope that it will be useful,
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //  GNU General Public License for more details.
13 //
14 //  You should have received a copy of the GNU General Public License
15 //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INC_MINE_HPP
19 #define INC_MINE_HPP
20 
21 #include "ObjectGrid.hpp"
22 #include "Viewport.hpp"
23 #include "AnimatedImage.hpp"
24 #include "GameObjFwd.hpp"
25 
26 class Mine : public StaticObject {
27 public:
28    Mine(ObjectGrid* o, Viewport* v, int x, int y);
29 
30    void Move();
31    void Draw() const;
32    bool CheckCollision(Ship& ship);
33 
34    static const int MINE_FRAME_COUNT = 18;
35 
36 private:
37    static const int MINE_ROTATION_SPEED = 5;
38    static const int MINE_MOVE_SPEED = 1;
39 
40    enum Direction { dirUp, dirRight, dirDown, dirLeft, dirNone };
41 
42    ObjectGrid* objgrid;
43    Viewport* viewport;
44    Direction dir;
45    int current, rotcount, movetimeout;
46    int displace_x, displace_y, movedelay;
47 
48    AnimatedImage image;
49 };
50 
51 #endif
52