Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
enemies.cpp
00001 #include "enemies.h" 00002 00003 eninumber enemies::enemiesjudge(int xp1, int xp2) 00004 { 00005 if (xp1 <= 0){ 00006 _p1 = 1; 00007 } else { 00008 _p1 = 0; 00009 } 00010 if (xp2 <= 0){ 00011 _p2 = 1; 00012 } else { 00013 _p2 = 0; 00014 } 00015 eninumber enin = {_p1, _p2}; 00016 return enin; 00017 } 00018 00019 00020 void enemies::drawenemies_small(float x, float y, N5110 &lcd){ 00021 if(!x == 0){ 00022 lcd.drawRect(x, y, 5, 5,FILL_BLACK); 00023 lcd.drawRect(x, y + 3, 2, 1,FILL_WHITE); 00024 lcd.setPixel(x + 4, y, false); 00025 lcd.setPixel(x+4, y+4, false); 00026 lcd.drawRect(x + 5, y + 1, 2, 2,FILL_BLACK); 00027 lcd.drawRect(x + 7, y, 3, 4, FILL_BLACK); 00028 lcd.drawRect(x + 10, y + 1, 2, 2,FILL_BLACK); 00029 } 00030 } 00031 00032 Vector2D enemies::set_coord1(int p1){ 00033 if (p1 == 1){ 00034 _xp1 = 70; 00035 _yp1 = (rand()%27) + 3; 00036 } 00037 Vector2D enicoord1 = {_xp1, _yp1}; 00038 return enicoord1; 00039 } 00040 00041 00042 Vector2D enemies::set_coord2(int p2){ 00043 if (p2 == 1){ 00044 _xp2 = 70; 00045 _yp2 = (rand()%27) + 3; 00046 } 00047 Vector2D enicoord2 = {_xp2, _yp2}; 00048 return enicoord2; 00049 } 00050 00051 00052 int enemies::open_fire_en(int x, int y, N5110 &lcd){ 00053 _vp = 4; 00054 lcd.drawCircle(x-_vp, y, 1, FILL_BLACK); 00055 x = x - _vp; 00056 return x; 00057 } 00058 00059 void enemies::drawenemies_large(float x, float y, N5110 &lcd){ 00060 if(!x == 0) { 00061 lcd.setPixel(x,y,true); 00062 lcd.drawRect(x -2 , y +1, 2, 2,FILL_BLACK); 00063 lcd.drawRect(x, y +2, 2, 1,FILL_BLACK); 00064 lcd.drawRect(x+2 , y , 5, 2,FILL_BLACK); 00065 lcd.drawRect(x+5 , y+1 , 3, 2,FILL_BLACK); 00066 lcd.setPixel(x-3,y+2,true); 00067 } 00068 } 00069 00070 00071
Generated on Fri Jul 15 2022 11:33:55 by
