Tablice, flagi i im podobne. To jest tylko potrzebne by napisać prosty skrypt wyboru i użycia broni/przedmiotów. :)
Przykład:
CREATE
warray[0,0] = 10;
warray[0,1] = 'Bron 0';
warray[0,2] = 10;
warray[1,0] = 10;
warray[1,1] = 'Bron 1';
warray[1,2] = 20;
warray[2,0] = 10;
warray[2,1] = 'Bron 2';
warray[2,2] = 130;
warray[3,0] = 10;
warray[3,1] = 'Bron 3';
warray[3,2] = 132;
warray[4,0] = 10;
warray[4,1] = 'Bron 4';
warray[4,2] = 13;
warray[5,0] = 10;
warray[5,1] = 'Bron 5';
warray[5,2] = 64;
warray[6,0] = 0;
warray[6,1] = 'Bron 6';
warray[6,2] = 345;
warray[7,0] = 10
warray[7,1] = 'Bron 7';
warray[7,2] = 421;
warray[8,0] = 0
warray[8,1] = 'Bron 8';
warray[8,2] = 13;
warray[9,0] = 10;
warray[9,1] = 'Bron 9';
warray[9,2] = 15;
ws = 0;
reload = 0;
STEP
//Wybor klawiszami 0-9
for( n = 0; n <= 9; n += 1 )
{
if( keyboard_check_pressed( ord('0') + n ) )
{
if( warray[n,0] > 0 )
{
ws = n;
}
}
}
if( ws >= 0 )
{
// Jesli magazynek broni jest pusty
if( !warray[ws,0] > 0 )
{
ws = -1;
// Szukaj broni ktora jeszcze ma amunicje
for( n = 0; n <= 9; n += 1 )
{
if( warray[n,0] > 0 )
{
ws = n;
}
}
if( ws = -1 )
exit;
}
// Strzelanie
if( reload <= 0 )
{
if( warray[ws,0] > 0 && keyboard_check( vk_space ) )
{
//Strzal!
warray[ws,0] -= 1;
reload = warray[ws,2];
}
}
else
reload -= 1;
}
DRAW
if( ws >= 0 )
draw_text( 0, 0, 'Bron: ' + string( ws ) + '#Nazwa: ' + warray[ws,1] + '#Amunicji: ' + string( warray[ws,0] ) + '#Przeladowanie: ' + string( warray[ws,2] / room_speed ) + 's' );
else
draw_text( 0, 0, 'Brak broni' );
I tyle. Jest do 10 typów broni. :)