Ju1ian Temat założony przez niniejszego użytkownika |
» 2009-03-04 17:15:31 Hm... Spróbowałem coś z tym zrobić i wywala mi błędy: main.cpp: In function `bool naniesOdleglosc(int, int, int, int, int)': main.cpp:207: error: invalid types `int[int]' for array subscript main.cpp:208: error: return-statement with no value, in function returning 'int' Mój kod: #include <allegro.h> #include <fstream> #include <string> #include <cmath>
using namespace std;
volatile long speed = 0; void increment_speed() { speed++; } END_OF_FUNCTION( increment_speed ); LOCK_VARIABLE( speed ); LOCK_FUNCTION( increment_speed );
volatile int game_time = 0; void game_time_ticker() { game_time++; } END_OF_FUNCTION( game_time_ticker )
const int updates_per_second = 60;
class CPlayer { public: int x, y; int sila; int obrona; int level; int exp; int health; short int kierunek, klatka; }; class CObject { public: int x, y; int atak; int obrona; };
void obl_zero( short int & obliczona ) { if( obliczona < 0 ) { obliczona = - obliczona; } }
BITMAP * zadanie = NULL; BITMAP * ludek = NULL; BITMAP * hp = NULL; BITMAP * pelne_hp = NULL; BITMAP * logo = NULL; BITMAP * gui = NULL; BITMAP * teren = NULL; BITMAP * bufor = NULL; BITMAP * tablica = NULL; BITMAP * czarne = NULL; BITMAP * trollik = NULL; BITMAP * troll_atak = NULL; BITMAP * dead = NULL; BITMAP * blood = NULL;
int hp_x = 505, hp_y = 70; int logo_x = 520, logo_y = 90; int zadanie_x = 50, zadanie_y = 2; int tablica_x = 20, tablica_y = 375;
CPlayer player; CPlayer troll;
int scrolling_x = 0, scrolling_y = 0; int alpha = 0; float licznik = 0.0f;
bool czy_dostal_expa = false; float ogranicznik_ataku = 0.0; float ogranicznik_ataku_potwora = 0.0; int frame = 0;
int mapa_x = 0, mapa_y = 1;
short int map[ 18 ][ 30 ] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 15, 15, 15, 15, 15, 15, 1, 15, 15, 15, 15, 1, 15, 1, 15, 15, 15, 15, 15, 15, 10, 1, 1, 1, 1, 1, 1, 1, 1, 13, 4, 0, 0, 0, 0, 0, 1, 0, 3, 0, 5, 1, 4, 1, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 13, 7, 6, 3, 0, 0, 0, 1, 0, 2, 0, 6, 8, 7, 8, 6, 7, 6, 7, 6, 7, 14, 1, 1, 1, 1, 1, 1, 1, 1, 13, 0, 7, 6, 6, 7, 6, 8, 6, 7, 6, 7, 1, 0, 1, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 13, 0, 0, 0, 0, 4, 0, 1, 0, 0, 0, 1, 1, 5, 1, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 13, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 1, 1, 1, 1, 1, 1, 1, 1, 12, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
void wys_mape() { int licznik_x, licznik_y; for( licznik_x = 0; licznik_x < 20; licznik_x++ ) { for( licznik_y = 0; licznik_y < 13; licznik_y++ ) { blit( teren, bufor, ( map[ licznik_y + mapa_y ][ licznik_x + mapa_x ] % 4 ) * 40, ( map[ licznik_y + mapa_y ][ licznik_x + mapa_x ] / 4 ) * 40, licznik_x * 40, licznik_y * 40, 40, 40 ); } } };
bool kolizja_w_prawo( int x1, int x2, int y1, int y2 ) { if((( x1 ==( x2 - 40 ) ) &&( y1 ==( y2 ) ) ) ) return true; else return false; } bool kolizja_w_lewo( int x1, int x2, int y1, int y2 ) { if((( x1 ==( x2 + 40 ) ) &&( y1 ==( y2 ) ) ) ) return true; else return false; } bool kolizja_w_dol( int x1, int x2, int y1, int y2 ) { if((( x1 ==( x2 ) ) &&( y1 ==( y2 - 40 ) ) ) ) return true; else return false; } bool kolizja_w_gore( int x1, int x2, int y1, int y2 ) { if((( x1 ==( x2 ) ) &&( y1 ==( y2 + 40 ) ) ) ) return true; else return false; } bool kolizja_prawo_gora( int x1, int x2, int y1, int y2 ) { if((( x1 ==( x2 + 40 ) ) &&( y1 ==( y2 - 40 ) ) ) ) return true; else return false; } bool kolizja_prawo_dol( int x1, int x2, int y1, int y2 ) { if((( x1 ==( x2 + 40 ) ) &&( y1 ==( y2 + 40 ) ) ) ) return true; else return false; } bool kolizja_lewo_gora( int x1, int x2, int y1, int y2 ) { if((( x1 ==( x2 - 40 ) ) &&( y1 ==( y2 - 40 ) ) ) ) return true; else return false; } bool kolizja_lewo_dol( int x1, int x2, int y1, int y2 ) { if((( x1 ==( x2 - 40 ) ) &&( y1 ==( y2 + 40 ) ) ) ) return true; else return false; } bool kolizja_z_mapa_prawo( int x1, int y1 ) { if((( map[ mapa_y +( y1 ) / 40 ][ mapa_x + 1 +( x1 ) / 40 ] ) == 0 ) ||(( map[ mapa_y +( y1 ) / 40 ][ mapa_x + 1 +( x1 ) / 40 ] ) == 2 ) ||(( map[ mapa_y +( y1 ) / 40 ][ mapa_x + 1 +( x1 ) / 40 ] ) == 6 ) ||(( map[ mapa_y +( y1 ) / 40 ][ mapa_x + 1 +( x1 ) / 40 ] ) == 7 ) ||(( map[ mapa_y +( y1 ) / 40 ][ mapa_x + 1 +( x1 ) / 40 ] ) == 8 ) ) return false; else return true; } bool kolizja_z_mapa_lewo( int x1, int y1 ) { if((( map[ mapa_y +( y1 ) / 40 ][ mapa_x - 1 +( x1 ) / 40 ] ) == 0 ) ||(( map[ mapa_y +( y1 ) / 40 ][ mapa_x - 1 +( x1 ) / 40 ] ) == 2 ) ||(( map[ mapa_y +( y1 ) / 40 ][ mapa_x - 1 +( x1 ) / 40 ] ) == 6 ) ||(( map[ mapa_y +( y1 ) / 40 ][ mapa_x - 1 +( x1 ) / 40 ] ) == 7 ) ||(( map[ mapa_y +( y1 ) / 40 ][ mapa_x - 1 +( x1 ) / 40 ] ) == 8 ) ) return false; else return true; } bool kolizja_z_mapa_dol( int x1, int y1 ) { if((( map[ mapa_y +( y1 ) / 40 + 1 ][ mapa_x +( x1 ) / 40 ] ) == 0 ) ||(( map[ mapa_y +( y1 ) / 40 + 1 ][ mapa_x +( x1 ) / 40 ] ) == 2 ) ||(( map[ mapa_y +( y1 ) / 40 + 1 ][ mapa_x +( x1 ) / 40 ] ) == 6 ) ||(( map[ mapa_y +( y1 ) / 40 + 1 ][ mapa_x +( x1 ) / 40 ] ) == 7 ) ||(( map[ mapa_y +( y1 ) / 40 + 1 ][ mapa_x +( x1 ) / 40 ] ) == 8 ) ) return false; else return true; } bool kolizja_z_mapa_gora( int x1, int y1 ) { if((( map[ mapa_y +( y1 ) / 40 - 1 ][ mapa_x +( x1 ) / 40 ] ) == 0 ) ||(( map[ mapa_y +( y1 ) / 40 - 1 ][ mapa_x +( x1 ) / 40 ] ) == 2 ) ||(( map[ mapa_y +( y1 ) / 40 - 1 ][ mapa_x +( x1 ) / 40 ] ) == 6 ) ||(( map[ mapa_y +( y1 ) / 40 - 1 ][ mapa_x +( x1 ) / 40 ] ) == 7 ) ||(( map[ mapa_y +( y1 ) / 40 - 1 ][ mapa_x +( x1 ) / 40 ] ) == 8 ) ) return false; else return true; } int random( int nMin, int nMax ) { return rand() %( nMax - nMin + 1 ) + nMin; } bool naniesOdleglosc( int x, int y, int celX, int celY, int odleglosc ) { if(( map[ y ][ x ] != 1 ) &&( map[ y ][ x ] != 3 ) &&( map[ y ][ x ] != 4 ) &&( map[ y ][ x ] != 5 ) &&( map[ y ][ x ] == 0 || map[ y ][ x ] > odleglosc ) ) { odleglosc[( y ) / 40 ][( x ) / 40 ] = odleglosc; if( x == celX && y == celY ) return; if( x > 0 ) naniesOdleglosc( x - 1, y, celX, celY, odleglosc + 1 ); if( x < 19 + 1 ) naniesOdleglosc( x + 1, y, celX, celY, odleglosc + 1 ); if( y > 0 ) naniesOdleglosc( x, y - 1, celX, celY, odleglosc + 1 ); if( y < 8 + 1 ) naniesOdleglosc( x, y + 1, celX, celY, odleglosc + 1 ); } }
int mx = 0, my = 0, mb = 0; void myszka() { if( mx != mouse_x || my != mouse_y || mb != mouse_b ) { mx = mouse_x; my = mouse_y; mb = mouse_b; } };
int main() { srand( static_cast < unsigned int >( time( NULL ) ) ); player.x = 240; player.y = 160; troll.x = 360; troll.y = 320; player.sila = 50; player.obrona = 15; player.level = 1; troll.level = 1; player.exp = 0; troll.exp = 20; troll.sila = 100; troll.obrona = 20; player.health = 100; troll.health = 100; player.klatka = 0; player.kierunek = 0; allegro_init(); install_keyboard(); set_color_depth( 16 ); set_gfx_mode( GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0 ); install_timer(); install_int_ex( increment_speed, BPS_TO_TIMER( updates_per_second ) ); LOCK_VARIABLE( game_time ); LOCK_FUNCTION( game_time_ticker ); install_int_ex( game_time_ticker, BPS_TO_TIMER( 10 ) ); install_mouse(); show_mouse( screen ); unscare_mouse(); bool quit = false; int fps = 0; int frames_done = 0; int old_time = 0; bufor = create_bitmap( 640, 480 ); if( !bufor ) { set_gfx_mode( GFX_TEXT, 0, 0, 0, 0 ); allegro_message( "Nie mogę utworzyć bufora !" ); allegro_exit(); return 0; } teren = load_bmp( "bmp/maps/teren.bmp", default_palette ); ludek = load_bmp( "bmp/characters/player/ludek.bmp", default_palette ); gui = load_bmp( "bmp/gui/gui.bmp", default_palette ); hp = load_bmp( "bmp/gui/hp.bmp", default_palette ); pelne_hp = load_bmp( "bmp/gui/pelne_hp.bmp", default_palette ); logo = load_bmp( "bmp/gui/logo.bmp", default_palette ); zadanie = load_bmp( "bmp/gui/zadanie.bmp", default_palette ); tablica = load_bmp( "bmp/gui/tablica.bmp", default_palette ); czarne = load_bmp( "bmp/other/czarne.bmp", default_palette ); trollik = load_bmp( "bmp/characters/monsters/troll/troll.bmp", default_palette ); troll_atak = load_bmp( "bmp/gui/troll_atak.bmp", default_palette ); dead = load_bmp( "bmp/characters/dead.bmp", default_palette ); blood = load_bmp( "bmp/characters/blood.bmp", default_palette ); while( !key[ KEY_ESC ] ) { if( player.health == 0 ) { licznik += 1.0f; } ogranicznik_ataku += 0.01; ogranicznik_ataku_potwora += 0.01; while( speed == 0 ) { rest( 100 / updates_per_second ); } while( speed > 0 ) { int old_ticks = speed; myszka(); if( player.health > 0 ) { if(( key[ KEY_RIGHT ] ) &&( mapa_x < 20 ) ) { if(( !kolizja_w_prawo( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) || troll.health == 0 ) && !kolizja_z_mapa_prawo( player.x, player.y ) ) { mapa_x = mapa_x + 1; player.kierunek = 1; scrolling_x += 40; } else { mapa_x = mapa_x; } } else if(( key[ KEY_LEFT ] ) &&( mapa_x > 0 ) ) { if(( !kolizja_w_lewo( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) || troll.health == 0 ) && !kolizja_z_mapa_lewo( player.x, player.y ) ) { mapa_x = mapa_x - 1; player.kierunek = 2; scrolling_x -= 40; } else { mapa_x = mapa_x; } } else if(( key[ KEY_DOWN ] ) &&( mapa_y < 8 ) ) { if(( !kolizja_w_dol( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) || troll.health == 0 ) && !kolizja_z_mapa_dol( player.x, player.y ) ) { mapa_y = mapa_y + 1; player.kierunek = 0; scrolling_y += 40; } else { mapa_y = mapa_y; } } else if(( key[ KEY_UP ] ) &&( mapa_y > 0 ) ) { if(( !kolizja_w_gore( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) || troll.health == 0 ) && !kolizja_z_mapa_gora( player.x, player.y ) ) { mapa_y = mapa_y - 1; player.kierunek = 3; scrolling_y -= 40; } else { mapa_y = mapa_y; } } naniesOdleglosc( troll.x - scrolling_x, troll.y - scrolling_y, player.x, player.y, 0 ); short int obliczona_x = troll.x - scrolling_x - player.x; short int obliczona_y = troll.y - scrolling_y - player.y; obl_zero( obliczona_x ); obl_zero( obliczona_y ); if( troll.health != 0 ) { if( obliczona_x > obliczona_y ) { if(( player.x < troll.x - scrolling_x ) &&( !kolizja_w_lewo( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) && !kolizja_z_mapa_lewo( troll.x - scrolling_x, troll.y - scrolling_y ) ) { troll.x -= 40; } if(( player.x > troll.x - scrolling_x ) &&( !kolizja_w_prawo( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) && !kolizja_z_mapa_prawo( troll.x - scrolling_x, troll.y - scrolling_y ) ) { troll.x += 40; } } else { if(( player.y > troll.y - scrolling_y ) &&( !kolizja_w_dol( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) && !kolizja_z_mapa_dol( troll.x - scrolling_x, troll.y - scrolling_y ) ) { troll.y += 40; } if(( player.y < troll.y - scrolling_y ) &&( !kolizja_w_gore( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) && !kolizja_z_mapa_gora( troll.x - scrolling_x, troll.y - scrolling_y ) ) { troll.y -= 40; } } } } speed -= 5; frame++; if( old_ticks <= speed ) break; if( key[ KEY_LEFT ] || key[ KEY_RIGHT ] || key[ KEY_DOWN ] || key[ KEY_UP ] ) { if( frame > 4 ) frame = 0; if( frame < 2 ) { player.klatka = 0; } else if(( frame >= 2 && frame < 4 ) ) { player.klatka = 1; } } if( game_time - old_time >= 10 ) { fps = frames_done; frames_done = 0; old_time = game_time; } frames_done++; clear_keybuf(); } clear_to_color( bufor, makecol( 150, 150, 150 ) ); wys_mape(); fstream plik; string sila_trolla; string obrona_trolla; string level_trolla; string exp_trolla; plik.open( "data/troll.dupa", ios::in ); if( plik.good() == true ) { getline( plik, sila_trolla ); getline( plik, obrona_trolla ); getline( plik, level_trolla ); getline( plik, exp_trolla ); plik.close(); } troll.sila = atoi( sila_trolla.c_str() ); troll.obrona = atoi( obrona_trolla.c_str() ); troll.level = atoi( level_trolla.c_str() ); troll.exp = atoi( exp_trolla.c_str() ); if( troll.health == 0 ) { masked_blit( dead, bufor, 0, 0, troll.x - scrolling_x, troll.y - scrolling_y, dead->w, dead->h ); } else { masked_blit( trollik, bufor, 0, 0, troll.x - scrolling_x, troll.y - scrolling_y, trollik->w, trollik->h ); } if( player.health == 0 ) { masked_blit( dead, bufor, 0, 0, player.x, player.y, dead->w, dead->h ); } else { masked_blit( ludek, bufor, player.kierunek * 40, player.klatka * 40, player.x, player.y, 40, 40 ); } masked_blit( gui, bufor, 0, 0, 0, 0, gui->w, gui->h ); masked_blit( hp, bufor, 0, 0, hp_x, hp_y, hp->w, hp->h ); masked_blit( logo, bufor, 0, 0, logo_x, logo_y, logo->w, logo->h ); masked_blit( pelne_hp, bufor, 0, 0, hp_x, hp_y, player.health, pelne_hp->h ); if( map[ mapa_y + 4 ][ mapa_x + 6 ] == 2 ) { blit( tablica, bufor, 0, 0, tablica_x, tablica_y, tablica->w, tablica->h ); if( key[ KEY_P ] ) { masked_blit( zadanie, bufor, 0, 0, zadanie_x, zadanie_y, zadanie->w, zadanie->h ); } } if( player.health > 0 ) { if((( kolizja_w_lewo( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) ) ||( kolizja_w_prawo( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) ) ||( kolizja_w_dol( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) ) ||( kolizja_w_gore( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) ) ||( kolizja_prawo_gora( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) ) ||( kolizja_prawo_dol( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) ) ||( kolizja_lewo_gora( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) ) ||( kolizja_lewo_dol( player.x, troll.x - scrolling_x, player.y, troll.y - scrolling_y ) ) ) && troll.health > 0 ) { blit( troll_atak, bufor, 0, 0, tablica_x, tablica_y, tablica->w, tablica->h ); textprintf_ex( bufor, font, tablica_x + 13, tablica_y + 40, makecol( 0, 0, 0 ), - 1, "%d / 100", troll.health ); if( key[ KEY_A ] && ogranicznik_ataku >= 1 ) { int hp_zabrane_player; if( 3 *(( player.sila + player.level ) /( troll.obrona + troll.level ) ) <= 5 ) { hp_zabrane_player = random( 0, 3 *(( player.sila + player.level ) /( troll.obrona + troll.level ) ) ); } else { hp_zabrane_player = random( 1, 3 *(( player.sila + player.level ) /( troll.obrona + troll.level ) ) ); } troll.health -= hp_zabrane_player; masked_blit( blood, bufor, 0, 0, troll.x - scrolling_x, troll.y - scrolling_y, blood->w, blood->h ); rest( 50 ); ogranicznik_ataku = 0.0; } } } if( troll.health != 0 ) { if((( kolizja_w_lewo( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) ||( kolizja_w_prawo( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) ||( kolizja_w_dol( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) ||( kolizja_w_gore( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) ||( kolizja_prawo_gora( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) ||( kolizja_prawo_dol( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) ||( kolizja_lewo_gora( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) ||( kolizja_lewo_dol( troll.x - scrolling_x, player.x, troll.y - scrolling_y, player.y ) ) ) && player.health > 0 ) { if( ogranicznik_ataku_potwora >= 1 ) { int hp_zabrane_troll; if( 3 *(( troll.sila + troll.level ) /( player.obrona + player.level ) ) <= 5 ) { hp_zabrane_troll = random( 0, 3 *(( troll.sila + troll.level ) /( player.obrona + player.level ) ) ); } else { hp_zabrane_troll = random( 1, 3 *(( troll.sila + troll.level ) /( player.obrona + player.level ) ) ); } player.health -= hp_zabrane_troll; masked_blit( blood, bufor, 0, 0, player.x, player.y, blood->w, blood->h ); rest( 50 ); ogranicznik_ataku_potwora = 0.0; } } } if( troll.health < 0 ) troll.health = 0; if( player.health < 0 ) player.health = 0; if( troll.health == 0 &&( !czy_dostal_expa ) ) { player.exp += troll.exp; czy_dostal_expa = true; } if( player.exp >= 20 ) { player.level = 2; } if( player.exp >= 60 ) { player.level = 3; } if( player.exp >= 100 ) { player.level = 4; } if( player.exp >= 200 ) { player.level = 5; } if( licznik >= 1 && alpha <= 170 ) { alpha += 1; licznik = 0.0f; } if( player.health == 0 ) { set_trans_blender( 0, 0, 0, alpha ); draw_trans_sprite( bufor, czarne, 0, 0 ); textprintf_ex( bufor, font, 180, 180, makecol( 255, 255, 255 ), - 1, "Niestety nie zyjesz!" ); } textprintf_ex( bufor, font, 610, 74, makecol( 255, 255, 255 ), - 1, "%d", player.health ); textprintf_ex( bufor, font, 505, 260, makecol( 255, 255, 255 ), - 1, "Level: %d", player.level ); textprintf_ex( bufor, font, 505, 280, makecol( 255, 255, 255 ), - 1, "Experiance: %d", player.exp ); textprintf_ex( bufor, font, 505, 300, makecol( 255, 255, 255 ), - 1, "Strenght: %d", player.sila ); textprintf_ex( bufor, font, 505, 320, makecol( 255, 255, 255 ), - 1, "Defence: %d", player.obrona ); textprintf_ex( bufor, font, 505, 340, makecol( 255, 255, 255 ), - 1, "ATAK TROLLA: %d", troll.sila ); textprintf_ex( bufor, font, 505, 360, makecol( 255, 255, 255 ), - 1, "OBRONA TROLLA: %d", troll.obrona ); textprintf_ex( bufor, font, 505, 380, makecol( 255, 255, 255 ), - 1, "LEVEL TROLLA: %d", troll.level ); textprintf_ex( bufor, font, 505, 400, makecol( 255, 255, 255 ), - 1, "EXP TROLLA: %d", troll.exp ); textprintf_ex( bufor, font, 20, 20, makecol( 255, 255, 255 ), - 1, "FPS: %d", fps ); blit( bufor, screen, 0, 0, 0, 0, 640, 480 ); } remove_int( increment_speed ); destroy_bitmap( teren ); destroy_bitmap( ludek ); destroy_bitmap( gui ); destroy_bitmap( hp ); destroy_bitmap( bufor ); destroy_bitmap( zadanie ); destroy_bitmap( logo ); destroy_bitmap( pelne_hp ); destroy_bitmap( trollik ); destroy_bitmap( troll_atak ); destroy_bitmap( dead ); destroy_bitmap( blood ); allegro_exit(); return 0; }
END_OF_MAIN();
Dziękuję za pomoc |