00001 /********************************************************************** 00002 ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 00003 ** 00004 ** This file is part of the Qtopia Environment. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 ** 00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00015 ** 00016 ** Contact info@trolltech.com if any conditions of this licensing are 00017 ** not clear to you. 00018 ** 00019 **********************************************************************/ 00020 #include <qcanvas.h> 00021 00022 #include "bullet.h" 00023 00024 class Cannon : public QObject, public QCanvasSprite 00025 { 00026 Q_OBJECT 00027 00028 public: 00029 Cannon(QCanvas*); //create cannon 00030 ~Cannon(); //destroy cannon 00031 00032 enum Direction{ Left, Right, NoDir }; 00033 00034 void pointCannon(Direction dir); 00035 void setCoords(); 00036 double shootAngle(); 00037 void shoot(); 00038 int rtti() const; 00039 00040 int shotsFired() { return shotsfired; }; 00041 00042 void reposition(void); 00043 00044 protected: 00045 void advance(int stage); 00046 00047 signals: 00048 void score(int); 00049 00050 private: 00051 QCanvasPixmapArray* cannonarray; 00052 int index; 00053 int cannonx; 00054 int cannony; 00055 int barrelxpos; 00056 int barrelypos; 00057 int moveDelay; 00058 Direction movedir; 00059 int shotsfired; 00060 };
1.4.2