Commit ced5f74a880f1edcce83f5c16a40e4ede4635ac7

Authored by root
1 parent 0ed3f148

sauvegarde avant le nettoyage

atmega328p/eeprom.hex 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +:00000001FF
@@ -100,9 +100,9 @@ struct task{ @@ -100,9 +100,9 @@ struct task{
100 100
101 uint8_t cpt = 0; 101 uint8_t cpt = 0;
102 uint8_t premier_lancement = 0; 102 uint8_t premier_lancement = 0;
103 -struct task lecture_boutons = {0x300, 0, 0}; 103 +struct task lecture_boutons = {0x300, 0};
104 struct task lecture_joystick = {0x0500, 0}; 104 struct task lecture_joystick = {0x0500, 0};
105 -struct task affiche_led = {0x0700, 0, 0}; 105 +struct task affiche_led = {0x0700, 0};
106 106
107 107
108 108
atmega328p/main.o 0 → 100644
No preview for this file type
atmega328p/usb.elf 0 → 100755
No preview for this file type
atmega328p/usb.hex 0 → 100644
@@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
  1 +:100000000C9434000C9451000C9451000C94510049
  2 +:100010000C9451000C9451000C9451000C9451001C
  3 +:100020000C9451000C9451000C9451000C94380124
  4 +:100030000C9451000C9451000C9451000C945100FC
  5 +:100040000C9451000C9451000C9451000C945100EC
  6 +:100050000C9451000C9451000C9451000C945100DC
  7 +:100060000C9451000C94510011241FBECFEFD8E026
  8 +:10007000DEBFCDBF11E0A0E0B1E0EEE2F6E002C0ED
  9 +:1000800005900D92AA30B107D9F721E0AAE0B1E0BE
  10 +:1000900001C01D92AC30B207E1F70E94E5020C945A
  11 +:1000A00015030C94000084B18F6184B985B18FEF82
  12 +:1000B00085B92FEF85EA9EE0215080409040E1F71E
  13 +:1000C00000C0000085B115B80895092E000CAA0BD8
  14 +:1000D000BB0B9C01AD0184E0220F331F441F551F51
  15 +:1000E0008A95D1F760E074E284EF90E00E94F30219
  16 +:1000F000215031093093C5002093C40088E18093DA
  17 +:10010000C10086E08093C200E0ECF0E080818D7F4A
  18 +:10011000808308959091C00095FFFCCF8093C60026
  19 +:1001200008958091C00087FFFCCF8091C60008959C
  20 +:10013000EAE7F0E0808187608083ACE7B0E08C91F3
  21 +:1001400080648C938C918F778C938C918F7D8C9322
  22 +:10015000ABE7B0E08C91887F8C938081806880834E
  23 +:10016000808180648083089590917C00982B909387
  24 +:100170007C0090917A00906490937A0090917A003C
  25 +:1001800096FDFCCF90917C008095892380937C0024
  26 +:1001900080917800909179000895E1E8F0E0808105
  27 +:1001A0008860808380818460808380818160808397
  28 +:1001B00088E690E09093890080938800EFE6F0E075
  29 +:1001C00080818260808308958AB18AB98BB18FEF74
  30 +:1001D0008BB984B18F6384B9089580E0D1E0C9B14F
  31 +:1001E000C2FBCC27C0F9CD274B9BC2604C9BC4609F
  32 +:1001F0004D9BC8604E9BC061C81719F08C2F0E94A0
  33 +:100200008A008FE39CE90197F1F700C000008C2F72
  34 +:10021000E6CFC0E080E00E94B4008C0181E00E9443
  35 +:10022000B400C1110BC0C80134E0969587953A958A
  36 +:10023000E1F780680E948A00C1E009C024E0969539
  37 +:1002400087952A95E1F7806C0E948A00C0E08FE3D1
  38 +:100250009CE90197F1F700C00000DCCF0E949100FB
  39 +:1002600085B98FE39CE90197F1F700C00000F6CF54
  40 +:100270001F920F920FB60F9211242F933F934F931B
  41 +:100280005F936F937F938F939F93AF93BF93EF93FE
  42 +:10029000FF9380910A0181110CC081E080930A01D3
  43 +:1002A000789480910001909101019EBF8DBF0E94C2
  44 +:1002B0002E01813009F036C00F920FB6F8940F92DC
  45 +:1002C0001F9211242F923F924F925F926F927F92D2
  46 +:1002D0008F929F92AF92BF92CF92DF92EF92FF9256
  47 +:1002E0000F931F932F933F934F935F936F937F933E
  48 +:1002F0008F939F93AF93BF93CF93DF93EF93FF932E
  49 +:100300008DB79EB7909301018093000182E08093A6
  50 +:100310000A01789480910301909104019EBF8DBFE2
  51 +:100320000E940901823009F036C00F920FB6F8948E
  52 +:100330000F921F9211242F923F924F925F926F92D1
  53 +:100340007F928F929F92AF92BF92CF92DF92EF9265
  54 +:10035000FF920F931F932F933F934F935F936F934E
  55 +:100360007F938F939F93AF93BF93CF93DF93EF933D
  56 +:10037000FF938DB79EB7909304018093030183E0B0
  57 +:1003800080930A01789480910601909107019EBFA5
  58 +:100390008DBF0E94ED0080910B01811154C00F921E
  59 +:1003A0000FB6F8940F921F9211242F923F924F9202
  60 +:1003B0005F926F927F928F929F92AF92BF92CF92F5
  61 +:1003C000DF92EF92FF920F931F932F933F934F93E0
  62 +:1003D0005F936F937F938F939F93AF93BF93CF93CD
  63 +:1003E000DF93EF93FF938DB79EB7909307018093B0
  64 +:1003F000060180910001909101019EBF8DBFFF9188
  65 +:10040000EF91DF91CF91BF91AF919F918F917F91AC
  66 +:100410006F915F914F913F912F911F910F91FF909D
  67 +:10042000EF90DF90CF90BF90AF909F908F907F9094
  68 +:100430006F905F904F903F902F901F900F900FBE46
  69 +:100440000F9081E056C0813009F056C00F920FB670
  70 +:10045000F8940F921F9211242F923F924F925F9225
  71 +:100460006F927F928F929F92AF92BF92CF92DF92C4
  72 +:10047000EF92FF920F931F932F933F934F935F93AE
  73 +:100480006F937F938F939F93AF93BF93CF93DF939C
  74 +:10049000EF93FF938DB79EB7909301018093000176
  75 +:1004A00080910301909104019EBF8DBFFF91EF9158
  76 +:1004B000DF91CF91BF91AF919F918F917F916F917C
  77 +:1004C0005F914F913F912F911F910F91FF90EF906E
  78 +:1004D000DF90CF90BF90AF909F908F907F906F9064
  79 +:1004E0005F904F903F902F901F900F900FBE0F90F6
  80 +:1004F00082E080930B0157C0823009F054C00F9204
  81 +:100500000FB6F8940F921F9211242F923F924F92A0
  82 +:100510005F926F927F928F929F92AF92BF92CF9293
  83 +:10052000DF92EF92FF920F931F932F933F934F937E
  84 +:100530005F936F937F938F939F93AF93BF93CF936B
  85 +:10054000DF93EF93FF938DB79EB790930401809351
  86 +:10055000030180910601909107019EBF8DBFFF911D
  87 +:10056000EF91DF91CF91BF91AF919F918F917F914B
  88 +:100570006F915F914F913F912F911F910F91FF903C
  89 +:10058000EF90DF90CF90BF90AF909F908F907F9033
  90 +:100590006F905F904F903F902F901F900F900FBEE5
  91 +:1005A0000F9010920B017894FF91EF91BF91AF9152
  92 +:1005B0009F918F917F916F915F914F913F912F917B
  93 +:1005C0000F900FBE0F901F9018950E94530080E867
  94 +:1005D00095E20E9465000E9498000E94CD000E9452
  95 +:1005E000E4007894FFCFA1E21A2EAA1BBB1BFD01E9
  96 +:1005F0000DC0AA1FBB1FEE1FFF1FA217B307E40702
  97 +:10060000F50720F0A21BB30BE40BF50B661F771F59
  98 +:10061000881F991F1A9469F7609570958095909539
  99 +:0E0620009B01AC01BD01CF010895F894FFCFFE
  100 +:0A062E0000070000050000030000B3
  101 +:00000001FF
games/ninvaders/nInvaders 0 → 100755
No preview for this file type
games/ninvaders/nInvaders.c
@@ -167,8 +167,8 @@ void readInput() @@ -167,8 +167,8 @@ void readInput()
167 receiveData(2, &data, handle, endpoint_desc_list); 167 receiveData(2, &data, handle, endpoint_desc_list);
168 if(data != 0){ 168 if(data != 0){
169 if((data & 0x10) == 0x10) ch = KEY_LEFT; 169 if((data & 0x10) == 0x10) ch = KEY_LEFT;
170 - else if((data & 0x04) == 0x04) ch = KEY_RIGHT;  
171 - else if((data & 0x08) == 0x08) ch = ' '; 170 + else if((data & 0x02) == 0x02) ch = KEY_RIGHT;
  171 + else if((data & 0x04) == 0x04) ch = ' ';
172 else return; 172 else return;
173 } 173 }
174 else return; 174 else return;
@@ -192,7 +192,9 @@ void readInput() @@ -192,7 +192,9 @@ void readInput()
192 lives = 3; // restore lives 192 lives = 3; // restore lives
193 sendLives(); 193 sendLives();
194 status = GAME_NEXTLEVEL; 194 status = GAME_NEXTLEVEL;
195 - } else if (ch == 'q') { // quit game 195 + } else if (ch == 'q') { // quit
  196 + lives = 0;
  197 + sendLives(0);
196 status = GAME_EXIT; 198 status = GAME_EXIT;
197 } 199 }
198 break; 200 break;
@@ -230,6 +232,8 @@ void readInput() @@ -230,6 +232,8 @@ void readInput()
230 sendLives(); 232 sendLives();
231 drawscore(); 233 drawscore();
232 } else if (ch == 'q') { // quit game 234 } else if (ch == 'q') { // quit game
  235 + lives = 0;
  236 + sendLives();
233 status = GAME_EXIT; 237 status = GAME_EXIT;
234 } else { // disable turbo mode if key is not kept pressed 238 } else { // disable turbo mode if key is not kept pressed
235 lastmove = ' '; 239 lastmove = ' ';
games/save 0 → 100644
@@ -0,0 +1,431 @@ @@ -0,0 +1,431 @@
  1 +/**
  2 + * nInvaders - a space invaders clone for ncurses
  3 + * Copyright (C) 2002-2003 Dettus
  4 + *
  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.
  9 + *
  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.
  14 + *
  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
  18 + *
  19 + * homepage: http://ninvaders.sourceforge.net
  20 + * mailto: ninvaders-devel@lists.sourceforge.net
  21 + *
  22 + */
  23 +
  24 +
  25 +#include <stdio.h>
  26 +#include <string.h>
  27 +#include <sys/time.h>
  28 +#include "nInvaders.h"
  29 +#include "player.h"
  30 +#include "aliens.h"
  31 +#include "ufo.h"
  32 +#include "arduino.h"
  33 +#include <libusb-1.0/libusb.h>
  34 +#include <stdlib.h>
  35 +#include <signal.h>
  36 +#include <unistd.h>
  37 +
  38 +#define FPS 50
  39 +
  40 +int lives;
  41 +long score;
  42 +int status; // status handled in timer
  43 +
  44 +#define GAME_LOOP 1
  45 +#define GAME_NEXTLEVEL 2
  46 +#define GAME_PAUSED 3
  47 +#define GAME_OVER 4
  48 +#define GAME_EXIT 5
  49 +#define GAME_HIGHSCORE 6
  50 +
  51 +libusb_device_handle *handle;
  52 +struct libusb_endpoint_descriptor endpoint_desc_list[ENDPOINTS_NUMBER];
  53 +int waitUSB = 0;
  54 +
  55 +void sendLives(){
  56 + uint8_t toSend = 0x00;
  57 + if(lives == 5) toSend = 0x1F;
  58 + else if(lives == 4) toSend = 0x0F;
  59 + else if(lives == 3) toSend = 0x07;
  60 + else if(lives == 2) toSend = 0x03;
  61 + else if(lives == 1) toSend = 0x01;
  62 + else if(lives == 0) toSend = 0x00;
  63 + if(handle != NULL && endpoint_desc_list != NULL && waitUSB == 0){
  64 + waitUSB = 1;
  65 + usleep(100000); // wait for endpoints to be free (100 ms)
  66 + sendData(0, toSend, handle, endpoint_desc_list);
  67 + waitUSB = 0;
  68 + }
  69 +}
  70 +
  71 +/**
  72 + * initialize level: reset attributes of most units
  73 + */
  74 +static void initLevel()
  75 +{
  76 + playerReset();
  77 + aliensReset();
  78 + ufoReset();
  79 + bunkersReset();
  80 + render();
  81 + drawscore();
  82 +}
  83 +
  84 +/**
  85 + * evaluate command line parameters
  86 + */
  87 +static void evaluateCommandLine(int argc, char **argv)
  88 +{
  89 +
  90 + // -l : set skill level
  91 + if (argc == 3 && strcmp(argv[1], "-l") == 0) {
  92 + if (argv[2][0] >= '0' && argv[2][0] <= '9') {
  93 + skill_level = argv[2][0] - 48;
  94 + } else {
  95 + argc = 2;
  96 + }
  97 + }
  98 +
  99 + // -gpl : show GNU GPL
  100 + if (argc == 2 && strcmp(argv[1], "-gpl") == 0) {
  101 + showGpl();
  102 + }
  103 +
  104 + // wrong command line: show usage
  105 + if (argc == 2 || (argc == 3 && strcmp(argv[1], "-l") != 0)) {
  106 + showVersion();
  107 + showUsage();
  108 + exit(1);
  109 + }
  110 +}
  111 +
  112 +
  113 +static void finish(int sig)
  114 +{
  115 + endwin();
  116 + showGplShort();
  117 +
  118 + fprintf(stderr,"\n");
  119 + fprintf(stderr,"\n");
  120 + fprintf(stderr,"=========================================================================\n");
  121 + fprintf(stderr,"\n");
  122 +
  123 + fprintf(stderr,"Final score: %7.7ld, Final level: %2.2d\nFinal rating... ",score,level);
  124 + if (lives>0)
  125 + fprintf(stderr,"Quitter\n\n");
  126 + else if(score<5000)
  127 + fprintf(stderr,"Alien Fodder\n\n");
  128 + else if(score<7500)
  129 + fprintf(stderr,"Easy Target\n\n");
  130 + else if(score<10000)
  131 + fprintf(stderr,"Barely Mediocre\n\n");
  132 + else if(score<12500)
  133 + fprintf(stderr,"Shows Promise\n\n");
  134 + else if(score<15000)
  135 + fprintf(stderr,"Alien Blaster\n\n");
  136 + else if(score<20000)
  137 + fprintf(stderr,"Earth Defender\n\n");
  138 + else if(score>19999)
  139 + fprintf(stderr,"Supreme Protector\n\n");
  140 +
  141 + showVersion();
  142 + exit(0);
  143 +}
  144 +
  145 +
  146 +void drawscore()
  147 +{
  148 + statusDisplay(level, score, lives);
  149 +}
  150 +
  151 +
  152 +/**
  153 + * reads input from keyboard and do action
  154 + */
  155 +void readInput()
  156 +{
  157 + int ch;
  158 + static int lastmove;
  159 +
  160 + timeout(100);
  161 + ch = getch(); // get key pressed
  162 +
  163 + static uint8_t data = 0;
  164 + if(ch == -1){ // keyboard first
  165 + usleep(1000000); // slow down inputs (100 ms)
  166 + if(handle != NULL && endpoint_desc_list != NULL && waitUSB == 0)
  167 + receiveData(2, &data, handle, endpoint_desc_list);
  168 + if(data != 0){
  169 + if((data & 0x10) == 0x10) ch = KEY_LEFT;
  170 + else if((data & 0x04) == 0x04) ch = ' ';
  171 + else if((data & 0x02) == 0x02) ch = KEY_RIGHT;
  172 + else return;
  173 + }
  174 + else return;
  175 + }
  176 +
  177 + switch (status) {
  178 +
  179 + case GAME_PAUSED:
  180 +
  181 + if (ch == 'p') {
  182 + status = GAME_LOOP;
  183 + }
  184 + break;
  185 +
  186 + case GAME_HIGHSCORE:
  187 +
  188 + if (ch == ' ') {
  189 + titleScreenClear();
  190 + level = 0; // reset level
  191 + score = 0; // reset score
  192 + lives = 3; // restore lives
  193 + sendLives();
  194 + status = GAME_NEXTLEVEL;
  195 + } else if (ch == 'q') { // quit game
  196 + status = GAME_EXIT;
  197 + }
  198 + break;
  199 +
  200 + case GAME_OVER:
  201 + break; // don't do anything
  202 +
  203 + default:
  204 +
  205 + if (ch == 'l' || ch == KEY_RIGHT) { // move player right
  206 + if (lastmove == 'l') {
  207 + playerTurboOn(); // enable Turbo
  208 + } else {
  209 + playerTurboOff(); // disable Turbo
  210 + }
  211 + playerMoveRight(); // move player
  212 + lastmove = 'l'; // remember last move for turbo mode
  213 + } else if (ch == 'h' || ch == KEY_LEFT) { // move player left
  214 + if (lastmove == 'h') {
  215 + playerTurboOn(); // enable Turbo
  216 + } else {
  217 + playerTurboOff(); // disable Turbo
  218 + }
  219 + playerMoveLeft(); // move player
  220 + lastmove = 'h'; // remember last move for turbo mode
  221 + } else if (ch == 'k' || ch == ' ') { // shoot missile
  222 + playerLaunchMissile();
  223 + } else if (ch == 'p') { // pause game until 'p' pressed again
  224 + // set status to game paused
  225 + status = GAME_PAUSED;
  226 + } else if (ch == 'W') { // cheat: goto next level
  227 + status = GAME_NEXTLEVEL;
  228 + } else if (ch == 'L') { // cheat: one more live
  229 + lives++;
  230 + sendLives();
  231 + drawscore();
  232 + } else if (ch == 'q') { // quit game
  233 + status = GAME_EXIT;
  234 + } else { // disable turbo mode if key is not kept pressed
  235 + lastmove = ' ';
  236 + }
  237 +
  238 + } // switch
  239 +
  240 +}
  241 +
  242 +
  243 +/**
  244 + * timer
  245 + * this method is executed every 1 / FPS seconds
  246 + */
  247 +void handleTimer()
  248 +{
  249 + static int aliens_move_counter = 0;
  250 + static int aliens_shot_counter = 0;
  251 + static int player_shot_counter = 0;
  252 + static int ufo_move_counter = 0;
  253 + static int title_animation_counter = 0;
  254 + static int game_over_counter = 0;
  255 +
  256 + switch (status) {
  257 +
  258 + case GAME_NEXTLEVEL: // go to next level
  259 +
  260 + level++; // increase level
  261 +
  262 + initLevel(); // initialize level
  263 +
  264 + aliens_move_counter = 0;
  265 + aliens_shot_counter = 0;
  266 + player_shot_counter = 0;
  267 + ufo_move_counter = 0;
  268 +
  269 + weite = (shipnum+(skill_level*10)-(level*5)+5)/10;
  270 +
  271 + if (weite < 0) {
  272 + weite = 0;
  273 + }
  274 +
  275 + // change status and start game!
  276 + status = GAME_LOOP;
  277 +
  278 + case GAME_LOOP: // do game handling
  279 +
  280 + // move aliens
  281 + if (aliens_move_counter == 0 && aliensMove() == 1) {
  282 + // aliens reached player
  283 + lives = 0;
  284 + sendLives();
  285 + status = GAME_OVER;
  286 + }
  287 +
  288 + // move player missile
  289 + if (player_shot_counter == 0 && playerMoveMissile() == 1) {
  290 + // no aliens left
  291 + status = GAME_NEXTLEVEL;
  292 + }
  293 +
  294 + // move aliens' missiles
  295 + if (aliens_shot_counter == 0 && aliensMissileMove() == 1) {
  296 + // player was hit
  297 + lives--; // player looses one life
  298 + sendLives();
  299 + drawscore(); // draw score
  300 + playerExplode(); // display some explosion graphics
  301 + if (lives == 0) { // if no lives left ...
  302 + status = GAME_OVER; // ... exit game
  303 + }
  304 + }
  305 +
  306 + // move ufo
  307 + if (ufo_move_counter == 0 && ufoShowUfo() == 1) {
  308 + ufoMoveLeft(); // move it one position to the left
  309 + }
  310 +
  311 +
  312 + if (aliens_shot_counter++ >= 5) {aliens_shot_counter=0;} // speed of alien shot
  313 + if (player_shot_counter++ >= 1) {player_shot_counter=0;} // speed of player shot
  314 + if (aliens_move_counter++ >= weite) {aliens_move_counter=0;} // speed of aliend
  315 + if (ufo_move_counter++ >= 3) {ufo_move_counter=0;} // speed of ufo
  316 +
  317 + refreshScreen();
  318 + break;
  319 +
  320 + case GAME_PAUSED: // game is paused
  321 + break;
  322 +
  323 + case GAME_OVER: // game over
  324 + if (game_over_counter == 100) {
  325 + battleFieldClear();
  326 + status = GAME_HIGHSCORE;
  327 + game_over_counter = 0;
  328 + } else {
  329 + gameOverDisplay();
  330 + game_over_counter++;
  331 + }
  332 + break;
  333 +
  334 + case GAME_EXIT: // exit game
  335 + finish(0);
  336 + break;
  337 +
  338 + case GAME_HIGHSCORE: // display highscore
  339 + if (title_animation_counter == 0) {
  340 + titleScreenDisplay();
  341 + }
  342 +
  343 + if (title_animation_counter++ >= 6) {title_animation_counter = 0;} // speed of animation
  344 + break;
  345 +
  346 + }
  347 +}
  348 +
  349 +
  350 +/**
  351 + * set up timer
  352 + */
  353 +void setUpTimer()
  354 +{
  355 + struct itimerval myTimer;
  356 + struct sigaction myAction;
  357 + myTimer.it_value.tv_sec = 0;
  358 + myTimer.it_value.tv_usec = 1000000 / FPS;
  359 + myTimer.it_interval.tv_sec = 0;
  360 + myTimer.it_interval.tv_usec = 1000000 / FPS;
  361 + setitimer(ITIMER_REAL, &myTimer, NULL);
  362 +
  363 + myAction.sa_handler = &handleTimer;
  364 + myAction.sa_flags = SA_RESTART;
  365 + sigaction(SIGALRM, &myAction, NULL);
  366 +}
  367 +
  368 +
  369 +int go = 1;
  370 +/*void signalINT(int sig){
  371 + if(sig == SIGINT){
  372 + go = 0;
  373 + }
  374 +}*/
  375 +int main(int argc, char **argv)
  376 +{
  377 + libusb_context *context;
  378 + libusb_device **devices;
  379 + struct libusb_config_descriptor *config_desc;
  380 +
  381 + // start
  382 + start(&context, &devices, &handle, &config_desc, endpoint_desc_list);
  383 +
  384 + // singals
  385 + /*struct sigaction action;
  386 + action.sa_handler = signalINT;
  387 + sigaction(SIGINT, &action, NULL);*/
  388 +
  389 + // nInvaders
  390 + weite = 0;
  391 + score = 0;
  392 + lives = 3;
  393 + sendLives();
  394 + level = 0;
  395 + skill_level = 1;
  396 +
  397 + evaluateCommandLine(argc, argv); // evaluate command line parameters
  398 + graphicEngineInit(); // initialize graphic engine
  399 +
  400 + // set up timer/ game handling
  401 + setUpTimer();
  402 + status = GAME_HIGHSCORE;
  403 +
  404 + // read keyboard input
  405 + do {
  406 + // do movements and key-checking
  407 + readInput(handle, endpoint_desc_list);
  408 + } while (go);
  409 +
  410 + // stop
  411 + stop(config_desc, handle, devices, context);
  412 +
  413 + return 0;
  414 +}
  415 +
  416 +
  417 +void doScoring(int alienType)
  418 +{
  419 + int points[4] = {500, 200, 150, 100}; // 0: ufo, 1:red, 2:green, 3:blue
  420 +
  421 + score += points[alienType]; // every alien type does different scoring points
  422 +
  423 + // every 6000 pts player gets a new live
  424 + if (score % 6000 == 0){
  425 + lives++;
  426 + sendLives();
  427 + }
  428 +
  429 + drawscore(); // display score
  430 +}
  431 +