Gornova/MarteEngine

World does not create a (default) Camera

Closed this issue · 2 comments

When an entity goes out of bounds it is still rendered. This happens because the camera checks what entities are out of bounds. But by default the world has no camera...

I would propose to create a simple camera in the world constructor. This camera has the same size as the window and does not move. It does check for entities outside of the camera bounds.

Instead of world.setCamera(Camera)
To start following an entity:
world.camera.followEntity(Entity)
stop:
world.camera.stopFollowingEntity
scroll around:
world.camera.scroll(targetX,targetY)

The best thing is that all the if camera!= null calls in world can be removed since there is always a camera instance.

I like this idea