use of com.ilargia.games.logicbrick.system.game.AnimationSystem in project Entitas-Java by Rubentxu.
the class GameSceneState method initialize.
@Override
public void initialize() {
atlas = assetsManager.getTextureAtlas(SPRITE_ATLAS);
Array<TextureAtlas.AtlasRegion> heroWalking = atlas.findRegions("Andando");
Array<TextureAtlas.AtlasRegion> heroJump = atlas.findRegions("Saltando");
Array<TextureAtlas.AtlasRegion> heroFall = atlas.findRegions("Cayendo");
Array<TextureAtlas.AtlasRegion> heroIdle = atlas.findRegions("Parado");
Animation walking = new Animation(RUNNING_FRAME_DURATION, heroWalking, Animation.PlayMode.LOOP);
Animation jump = new Animation(RUNNING_FRAME_DURATION * 7, heroJump, Animation.PlayMode.NORMAL);
Animation fall = new Animation(RUNNING_FRAME_DURATION * 5, heroFall, Animation.PlayMode.NORMAL);
Animation idle = new Animation(RUNNING_FRAME_DURATION * 4, heroIdle, Animation.PlayMode.LOOP);
Map animationHero = Collections.createMap(String.class, Animation.class);
animationHero.put("WALKING", walking);
animationHero.put("JUMPING", jump);
animationHero.put("FALL", fall);
animationHero.put("HURT", fall);
animationHero.put("IDLE", idle);
animationHero.put("HIT", fall);
Body body = bodyBuilder.fixture(new FixtureDefBuilder().boxShape(0.5f, 0.5f)).type(BodyDef.BodyType.KinematicBody).build();
systems.add(new InputsControllerSystem(entitas.input, guiFactory)).add(new AnimationSystem(entitas)).add(new TextureRendererSystem(entitas, engine.batch));
entitas.game.getPlayerEntity().addTextureView(null, new Bounds(0.8f, 1.2f), false, false, 1, 1, Color.WHITE).addAnimations(animationHero, walking, 0.02f).addRigidBody(body);
}
Aggregations