Back to project page Station42.
The source code is released under:
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUC...
If you think the Android project Station42 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.station42.player; /*www. jav a 2 s.c om*/ import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Rectangle; import com.station42.base.Engine; import com.station42.base.EngineRenderer; import com.station42.base.EngineUpdateListener; import com.station42.base.Entity; import com.station42.basic.EntityLocation; public class PlayerTrackingCameraSystem implements EngineUpdateListener { Entity playerEntity; OrthographicCamera camera; public PlayerTrackingCameraSystem(OrthographicCamera camera, Rectangle viewport, Entity entity) { this.camera = camera; playerEntity = entity; } @Override public void update(Engine engine, float delta) { EntityLocation entityPoint = playerEntity.getComponent(EntityLocation.class); camera.position.set((int)entityPoint.getCenterX(), (int)entityPoint.getCenterY(), 1); camera.update(); } }