tom strehle / Mbed 2 deprecated projetv2

Dependencies:   mbed

Revision:
11:0b85a680ad28
Parent:
8:cfcf73c16fab
--- a/LED2.h	Tue Sep 14 13:45:11 2021 +0000
+++ b/LED2.h	Mon Mar 28 17:50:41 2022 +0000
@@ -1,4 +1,9 @@
 // Rassurez vous,  VOUS n'avez pas a changer ces lignes de commandes 
+extern int mvie;
+extern int mvie2;
+extern int autoritir1;
+extern int autoritir2;
+
 
 // variables propres Affichage vers led  en 16 bandes
     int AL ; int AP ;  int AT ; // Affichae AL ligne AP pix  AT temps
@@ -168,4 +173,59 @@
       
       pix ( px , py , br , bv , bb );  
     }
- 
\ No newline at end of file
+    
+ void carre( int xd, int yd , int longueur , int hauteur , int vr , int vv , int vb ) 
+    {
+        int jesus;
+        int oui;
+        for(jesus=0;jesus<hauteur;jesus=jesus+1)
+        {
+  for(oui=0;oui<longueur;oui=oui+1)
+  {
+      pix(xd+oui,yd+jesus,vr,vv,vb);
+      }
+      }
+}
+
+void mob(int x,int y,int vie)  // a éteindre
+    {
+     if(vie>=1)
+     {
+     pix(x,y,0,0,4);
+     pix(x,y+1,0,0,4);
+     pix(x-1,y+1,0,0,4);
+     pix(x+1,y+1,0,0,4);
+     pix(x+1,y+2,0,0,4);
+     pix(x-1,y+2,0,0,4);
+     }
+
+}
+/*hitmob(20,20,mvie,15+vaisseauy+ccyy+tir2/4,vaisseauy+ccyy+tir/4,tirx2,tirx,autoritir2,autoritir1) */
+
+void hitmob(int x,int y,int vie,int ty2,int ty1,int tx2,int tx1,int auto2,int auto1)
+{ if(tx2<x+2 && tx2>x-2 && ty2>=y-1 && ty2>=y-1 && auto2==1 && vie>0)
+ {
+  mvie=mvie-1;
+  autoritir2=0;
+  }
+  if(tx1<x+2 && tx1>x-2  && ty1>=y-1 && ty1>=y-1 && auto1==1 && vie>0)
+ {
+  mvie=mvie-1;
+  autoritir1=0;
+  }
+  }
+  
+  void hitmob2(int x,int y,int vie,int ty2,int ty1,int tx2,int tx1,int auto2,int auto1)
+{ if(tx2<x+2 && tx2>x-2 && ty2>=y-1 && ty2>=y-1 && auto2==1 && vie>0)
+ {
+  mvie2=mvie2-1;
+  autoritir2=0;
+  }
+  if(tx1<x+2 && tx1>x-2  && ty1>=y-1 && ty1>=y-1 && auto1==1 && vie>0)
+ {
+  mvie2=mvie2-1;
+  autoritir1=0;
+  }
+  }
+
+