22
33import com .badlogic .gdx .Gdx ;
44import com .badlogic .gdx .graphics .GL20 ;
5+ import com .badlogic .gdx .graphics .OrthographicCamera ;
6+ import com .badlogic .gdx .graphics .g2d .Animation ;
7+ import com .badlogic .gdx .graphics .g2d .SpriteBatch ;
8+ import com .badlogic .gdx .graphics .g2d .TextureRegion ;
59import com .badlogic .gdx .scenes .scene2d .Stage ;
610import com .badlogic .gdx .scenes .scene2d .ui .Image ;
711import com .badlogic .gdx .scenes .scene2d .ui .Label ;
12+ import com .sun .org .apache .bcel .internal .generic .FALOAD ;
813
14+ import gdx .kapotopia .Animations .EvilTomAnimation ;
915import gdx .kapotopia .Fonts .UseFont ;
1016import gdx .kapotopia .GameConfig ;
1117import gdx .kapotopia .Helpers .Align ;
2026
2127public class mockupG3 extends CinematicScreen {
2228
29+ private final float scalling_factor = 0.6f ;
30+
31+ private OrthographicCamera camera ;
32+ private SpriteBatch batch ;
33+
34+ private Animation <TextureRegion > evilTom ;
35+ private float stateTime ;
36+
2337 public mockupG3 (final Kapotopia game ) {
2438 super (game , new Stage (game .viewport ), "mockupG3" );
2539
@@ -75,7 +89,6 @@ public mockupG3(final Kapotopia game) {
7589 }
7690 };
7791
78- final float scalling_factor = 0.6f ;
7992 // Backgrounds
8093 final Image house = ImageHelper .getBackground (game .viewport , "game3/intro/Monde2Ecran1.png" );
8194 final Image inside = ImageHelper .getBackground (game .viewport , "game3/intro/Monde2Ecran2.png" );
@@ -132,7 +145,7 @@ public mockupG3(final Kapotopia game) {
132145 },
133146 {
134147 inside ,
135- tom ,
148+ // tom,
136149 bubbleRight
137150 },
138151 {
@@ -142,6 +155,17 @@ public mockupG3(final Kapotopia game) {
142155 }
143156 };
144157
158+ /* EXTRAS */
159+ // Camera
160+ this .camera = new OrthographicCamera (game .viewport .getWorldWidth (), game .viewport .getWorldHeight ());
161+ game .viewport .setCamera (camera );
162+ // Making Animations
163+ batch = new SpriteBatch ();
164+ evilTom = new EvilTomAnimation (Animation .PlayMode .NORMAL ).getAnimation ();
165+ stateTime = 0f ;
166+
167+ /* ENDING */
168+
145169 this .applyBundle (new ParameterBundleBuilder (ScreenType .GAME3 )
146170 .withImages (images ).withLabels (labels ).withFinishBtn (false ).withNextBtnStyle (UseFont .CLASSIC_BOLD_NORMAL_WHITE ));
147171 }
@@ -156,7 +180,21 @@ public void render(float delta) {
156180 Gdx .gl .glClearColor (0 , 0 , 0 , 1 );
157181 Gdx .gl .glClear (GL20 .GL_COLOR_BUFFER_BIT );
158182
183+ camera .update ();
184+ batch .setProjectionMatrix (camera .combined );
185+
186+
187+
159188 stage .act (Gdx .graphics .getDeltaTime ());
160189 stage .draw ();
190+
191+ if (getCurrentSeqIndex () == 4 ) {
192+ stateTime += delta ;
193+ batch .begin ();
194+ final TextureRegion t = evilTom .getKeyFrame (stateTime , false );
195+ batch .draw (t , camera .viewportWidth * 0.075f , camera .viewportHeight * 0.04f ,
196+ 0 , 0 , t .getRegionWidth (), t .getRegionHeight (), scalling_factor , scalling_factor , 0 );
197+ batch .end ();
198+ }
161199 }
162200}
0 commit comments