diff options
author | Sticmac <jujulem06@hotmail.fr> | 2015-05-05 21:51:40 +0200 |
---|---|---|
committer | Sticmac <jujulem06@hotmail.fr> | 2015-05-05 21:51:40 +0200 |
commit | bf359cf55f492a997b44ac689b26b16f75768372 (patch) | |
tree | 7fdfcafff4dd032f6ffc4f3f7a12a46ded1025fb /Robofactor/Entite.pde | |
download | Robofactor-Processing-origin/theremin.tar.gz Robofactor-Processing-origin/theremin.tar.bz2 Robofactor-Processing-origin/theremin.tar.xz Robofactor-Processing-origin/theremin.zip |
Original commitHEADorigin/thereminorigin/masterorigin/HEADthereminmaster
Diffstat (limited to 'Robofactor/Entite.pde')
-rw-r--r-- | Robofactor/Entite.pde | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/Robofactor/Entite.pde b/Robofactor/Entite.pde new file mode 100644 index 0000000..d0244d3 --- /dev/null +++ b/Robofactor/Entite.pde @@ -0,0 +1,56 @@ +abstract class Entite { + protected int rangee; //"Protected" signifie que les classes héritant de Entité auront accès à cette variable ! + protected PImage avatar; + protected int x, xBloc, y; + protected int vitesse; + protected boolean isDead = false; + + void deplacerY(int diff){ //toutes les entités se déplaceront sur les trois rangées. + rangee+=diff; + + if(isDead == false && rangee>=2){ + rangee = 2; + } + + else if(isDead == false && rangee<=0){ + rangee = 0; + } + + else if(isDead == true){ + rangee = 3; + } + } + + void deplacerYProgressif() { //cette fonction ne s'appliquera qu'à roboFactor, elle permet un déplacement progressif de ce dernier, d'une rangée à l'autre. + if (y<(100+200*rangee)-(avatar.height/2)) { + y+=20; + } + else if (y>(100+200*rangee)-(avatar.height/2)) { + y-=20; + } + } + + void deplacerX(){ + x-=vitesse; + + if(x<=-200){ + x=-200; + } + } + + int getx(){ + return x; + } + + int gety(){ + return y; + } + + int getRangee(){ + return rangee; + } + + PImage getAvatar(){ + return avatar; + } +}
|