2 * nInvaders - a space invaders clone for ncurses
3 * Copyright (C) 2002-2003 Dettus
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 * homepage: http://ninvaders.sourceforge.net
20 * mailto: ninvaders-devel@lists.sourceforge.net
27 #include "nInvaders.h"
29 static int fShowUfo
= 0;
32 * initialize ufo attributes
36 ufoClear(ufo
.posX
, ufo
.posY
); // clear old position of player
38 fShowUfo
= 0; // do not show ufo
39 ufo
.posY
= UFOPOSY
; // set vertical Position
40 ufo
.posX
= SCREENWIDTH
- UFOWIDTH
;// set horizontal Position
44 * move ufo horizontally to position posX
46 static void ufoMove(int posX
)
48 ufoClear(ufo
.posX
, ufo
.posY
); // clear sprite
51 ufoDisplay(ufo
.posX
, ufo
.posY
);
56 * move ufo and check if it reached the left screen border
60 // check if space between ufo and screen border is big enough
62 // desired movement is possible
63 ufoMove(ufo
.posX
- 1);
70 * check if the first screen line is free for the ufo and
75 if (aliens
.posY
> 0 && fShowUfo
== 0) { // aliens one line down
76 if ((random() % 200) == 0) {
85 * check if ufo was hit by player and delete it from screen
87 int ufoHitCheck(int shotX
, int shotY
)
91 // if shot reached vertikal position of ufo
92 if (shotY
== UFOPOSY
) {
94 if (shotX
>= ufo
.posX
&& shotX
<= ufo
.posX
+ UFOWIDTH
-1) {
This page took 0.462033 seconds and 4 git commands to generate.