Ciele
- Zobrazenie skóre
- Entity, prvky GUI
Úvod
-
V tomto cvičeni implementujeme nový kontajner entít - teda nový screen zobrazujúci skóre v prípade prehry
Postup
-
Úloha: Vytvorte novuú triedu - entity container GameOverScreenÚloha: Implementujte rozhrania IEntityContainer, Screen, ApplicationContextAwarePoznámka: Nezabudnite vytvoriť bean v applicationContext.xmlÚloha: Implementujte inicializačnú metódu
- Vytvorte Label, v ktorom sa bude skóre vypisovať
Label.LabelStyle labelStyle = new Label.LabelStyle(); labelStyle.font = new BitmapFont(); scores = new Label(".........",labelStyle);
- Implementujte metódu show()
Poznámka: Napríklad pomocou formatera alebo string buildera pripravte tabuľku, ktorú ako text nasetujte do vytvoreného labela
scores.setText(builder);
Poznámka: nezabudnite pridať label do Stage-u aby sa vykresľovalPoznámka: po určitom čase nastavte screen naspäť na hrací screen a reštartujte hracie poleÚloha: Pred každým zobrazením skóre uložte aktualne nahraté skóre - Vytvorte Label, v ktorom sa bude skóre vypisovať