Skocz do zawartości

Draw czyli utrapienie


Rekomendowane odpowiedzi

Witam!

Dzisiaj mam problem z tym kodem, którego zadanie jest narysowanie panelu z aktywnym przedmiotem:

GML
ini_open('confing.ini');

rysujK=ini_read_real('Kaspersky','Bonus','');

rysujN=ini_read_real('Norton','Bonus','');

ini_close();

 

if( view_current = 0 )

{

draw_sprite_ext( panel, -1, view_xview[view_current], view_yview[view_current], 1, 1, 0, c_white, 1 );

if(instance_number(Kaspersky) == 1)

{

draw_set_color(c_green);

draw_text(view_xview[view_current]+58, view_yview[view_current]+9, Kaspersky.energia);

draw_set_color(c_blue);

draw_text(view_xview[view_current]+75, view_yview[view_current]+32, Kaspersky.ochrona);

draw_set_color(c_yellow);

draw_text(view_xview[view_current]+130, view_yview[view_current]+19, Kaspersky.SP);

}

switch (rysujK)

{

case 0:

{

draw_sprite_ext( spr_Blank, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 1:

{

draw_sprite_ext( spr_Blank, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 2:

{

draw_sprite_ext( spr_Apteczka1, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 3:

{

draw_sprite_ext( spr_Apteczka2, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 4:

{

draw_sprite_ext( spr_Apteczka3, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 5:

{

draw_sprite_ext( spr_SPPlus, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 6:

{

draw_sprite_ext( spr_Ochrona, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 7:

{

draw_sprite_ext( spr_Niewidzialnosc, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 8:

{

draw_sprite_ext( spr_ICE, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 9:

{

draw_sprite_ext( spr_PociskZS, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 10:

{

draw_sprite_ext( spr_Pulapka, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 11:

{

draw_sprite_ext( spr_DzialoDXD, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 12:

{

draw_sprite_ext( spr_Bomba, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 13:

{

draw_sprite_ext( spr_Bum, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 14:

{

draw_sprite_ext( spr_SztormP, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

 

 

}

 

}

else

{

draw_sprite_ext( panel, -1, view_xview[view_current], view_yview[view_current], 1, 1, 0, c_white, 1 );

if(instance_number(Norton) == 1)

{

draw_set_color(c_green);

draw_text(view_xview[view_current]+58, view_yview[view_current]+9, Norton.energia);

draw_set_color(c_blue);

draw_text(view_xview[view_current]+75, view_yview[view_current]+32, Norton.ochrona);

draw_set_color(c_yellow);

draw_text(view_xview[view_current]+130, view_yview[view_current]+19, Norton.SP);

}

switch (rysujN)

{

case 0:

{

draw_sprite_ext( spr_Blank, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 1:

{

draw_sprite_ext( spr_Blank, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 2:

{

draw_sprite_ext( spr_Apteczka1, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 3:

{

draw_sprite_ext( spr_Apteczka2, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 4:

{

draw_sprite_ext( spr_Apteczka3, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 5:

{

draw_sprite_ext( spr_SPPlus, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 6:

{

draw_sprite_ext( spr_Ochrona, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 7:

{

draw_sprite_ext( spr_Niewidzialnosc, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 8:

{

draw_sprite_ext( spr_ICE, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 9:

{

draw_sprite_ext( spr_PociskZS, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 10:

{

draw_sprite_ext( spr_Pulapka, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 11:

{

draw_sprite_ext( spr_DzialoDXD, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 12:

{

draw_sprite_ext( spr_Bomba, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 13:

{

draw_sprite_ext( spr_Bum, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

case 14:

{

draw_sprite_ext( spr_SztormP, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

 

 

}

 

}

Jestem na 10000% pewien że działa zawsze:

GML
case 0:

{

draw_sprite_ext( spr_Blank, -1, view_xview[view_current]+180, view_yview[view_current]+20, 1, 1, 0, c_white, 1 );

continue;

}

Ale reszta się nie rysuje. Proszę o pomoc.

Odnośnik do komentarza
Udostępnij na innych stronach

Tylko że

GML
bonusa=random(14);

ini_open('confing.ini');

ini_write_real('Kaspersky','Bonus',bonusa);

ini_close();

Nie wyobrażam sobie jako stringa. Może dasz do tego przykład? A tak zresztą te random ma taki minus że zamiast liczby całkowitej daje liczbę np. 8,37. Jak na to poradzić?

Odnośnik do komentarza
Udostępnij na innych stronach

A tak zresztą te random ma taki minus że zamiast liczby całkowitej daje liczbę np. 8,37. Jak na to poradzić?

 

GML
zmienna = round( random( xx ) );
?

 

Hmmm to może zrób tak:

 

Zapisywanie:

 

GML
bonusa = round( random( 14 ) );

ini_open( 'confing.ini' );

ini_write_string( 'Kaspersky', 'Bonus', string( bonusa ) );

ini_close();

 

Wczytywanie:

 

GML
ini_open( 'confing.ini' );

rysujK = real( ini_read_string( 'Kaspersky', 'Bonus', 0 ) );

rysujN = real( ini_read_string( 'Norton', 'Bonus', 0 ) );

ini_close();

Odnośnik do komentarza
Udostępnij na innych stronach

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...