As you know, the GameManager has already created the main world and the world layers, but what are these exactly, how can we use these for games and live wallpapers.
WORLD
Here is my main world that extends "AbstractWorldScene2D" of Mtx (AbstractWorldScene2D also extends LibGDX Scene2D Group). Basicly this is the main Scene2D Group that will hold all other world groups and actors. (Do not worry about GameState, I will talk about on next tutorial). I give reference to gameManager in each my world to provide connection among the world layers whenever is needed.
WORLD LAYERS
World layers basicly same thing with main wolrd (Also extends AbstractWorldScene2D). Here is the example of "WorldLayer1"
- I set the bluish background
- I set bottom soils/grass
- I set the the clouds
OTHER WORLD LAYERS
WorldLayer order is also important, it defines what comes top/bottom.
WorldLayer2
- I only set flying enemy objects
- I only set snow effect
WHY MANY LAYERS
Of course, I could have done everything in a single layer, but I like cohesion/coupling, it gives me flexibility. I give a responsibility to each layer (Background layer, environment layer, enemy layer, player layer, shooting layer, menu layer, etc..). Then everything is easy to improve and maintain. It is best to avoid confusion and do a fast implementation.
SNOW EFFECT ON WORLDLAYER3
Again, I want to talk about my SmartModel for you envrionments. I believe you noticed that nice snowing effect which is natural and no-strecthing in any device.
It took only a minute to set up this snow effect. I wanted my snow to with an angle, so I gave different direction to first half and second half of my snow flakes.
Direction is like;
0 yorum:
Yorum Gönder