- abstract class Entity {
- int vie;
- float x, y, w, h;
- PImage im, masque;
- boolean ally;
- Entity(int vie, float x, float y, PImage im, PImage masque, boolean ally)
- {
- this.x = x;
- this.y = y;
- this.w = im.width;
- this.h = im.height;
- this.im = im;
- this.masque = masque;
- this.ally = ally;
- this.vie = vie;
- }
- void update()
- {
- }
- void display()
- {
- image(im, x, y);
- }
- void destroy() //sera exécuté lorsque l'objet sera détruit
- {
- }
- }
- class Vaisseau extends Entity {
- double delay;
- double delayTir;
- Vaisseau(int vie, float x, float y, PImage im, PImage masque, boolean player)
- {
- super(vie, x, y, im, masque, player);
- this.ally = player;
- delayTir = ally ? 10 : random(200, 250);
- delay = (ally ? delayTir : delayTir/2) * dTime ;
- }
- void update()
- {
- }
- void tir()
- {
- if (delay > delayTir)
- {
- entities.add(new Bullet(ally ? x+70 : x-im.height/2, ally ? y+32 : y+im.width/2, ally));
- delay = 0;
- }
- delay += dTime;
- }
- }