Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

LibGDX – Rendering things in different classes

$
0
0

thanks for your time!

I’m really new to LibGDX (and Java itself).

Which approach should I use to render my different game parts?
I want to show a background, the main character, a bunch of enemies and an HUD. The playable area will be bigger than the screen so the camera has to move following the main character (top view).
Also everything has to be procedurally generated.

For example, I have the code to generate the map (background) but I don’t know how to render it if it’s in another class (not the core entry point one).
I can think of calling a custom background.draw() method from my main.render() class and pass a batch to draw onto but probably there are better ways.
I’ve tried to use Stages (scene2D) aswell but I can’t get my camera to move (are they mostly made for UI?).

I’d like to be pointed towards the best solution performance-wise since it’s gonna be called every frame :P


Viewing all articles
Browse latest Browse all 434

Trending Articles