Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
MATTHEW SLUG 0.5 - mylib.cpp

mylib.cpp

Caricato da: Matthew
Scarica il programma completo

  1. #include "mylib.h"
  2.  
  3.  
  4. bool collide_x(float x, int w, float x1, int w1)
  5. {
  6.         if(( (x>x1) && (x<(x1+w1)) ) | ( (x+w>x1) && ((x+w)<(x1+w1)) ) | ( (x<=x1) && (x+w>=x1+w1)))
  7.         {
  8.                 return true;
  9.         }
  10.         return false;
  11. }
  12.  
  13. bool collide_y(float y, int h, float y1, int h1)
  14. {
  15.         if(( (y>y1) && (y<(y1+h1)) ) | ( (y+h>y1) && ((y+h)<(y1+h1)) ) | ( (y<=y1) && (y+h>=y1+h1)))
  16.         {
  17.                 return true;
  18.         }
  19.         return false;
  20. }
  21. void error_load_bitmap()
  22. {
  23.         set_gfx_mode(GFX_TEXT,0,0,0,0);
  24.         allegro_message("Cannot load bitmap!\n");
  25.         allegro_exit();
  26.         exit(-1);
  27. }
  28. void drawLife(BITMAP *buf, Character *obj)
  29. {
  30.         rectfill(buf, obj->getX(), obj->getY()-10, obj->getX()+obj->getW(), obj->getY()-5, makecol(255,0,0));
  31.         rectfill(buf, obj->getX(), obj->getY()-10, obj->getX()+(int)(obj->getW()*obj->getLife()/obj->getLifeInit()), obj->getY()-5, makecol(0,255,0));
  32.         rect(buf, obj->getX(), obj->getY()-10, obj->getX()+obj->getW(), obj->getY()-5, makecol(0,0,0));
  33. }