Java Game Tutorial: Ep 13 - Camera

preview_player
Показать описание
Learning Java 2D Game programming: Ep13 - Camera
In this episode we implement a camera that can follow a GameObject, such as a Player (which we of course use xD)
We also make sure to clamp it within our GameMap bounds.

Рекомендации по теме
Комментарии
Автор

Omg so much work for such a small thing

DieterKlingberg
Автор

just want to remind you how great this series is! Glad i found it :)

erikarrona
Автор

project lombok may pick your interest for autogenerated accessors 😁 an IntelliJ has support for it

zoladkow
Автор

So, I dont know how or why, but in my attempt to follow this tutorial the character just disappears out of existence when he gets to the lowest quarter of the map lol

crtnkd
Автор

Hey, maybe you could add a condition in the renderMap method of the renderer class that sets the startX to the first visible tile and the endX to the last visible tile. Same for the y axis. Then you won't render all tiles even though they aren't visible. So start with the camera x position divided by the SPRITE_SIZE and end at (camera x position + camera windowsize width) divided by the SPRITE_SIZE.
kind regards

patrickschwenk