Android Question Help with libgdx.

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
I have been trying for a few days to do something with libgdx.
I really don´t figured out.

I want:
Load a tilemap and do a vertical scroll. Similar to a racing game.

Let's say a screen of (width: 100%x and Height: 5000dip)

Please, if you have some example that does something similar can it show?

Or, if you can dedicate a time to write a sample code.

Thank you very much.
 

Informatix

Expert
Licensed User
Longtime User
I have been trying for a few days to do something with libgdx.
I really don´t figured out.

I want:
Load a tilemap and do a vertical scroll. Similar to a racing game.

Let's say a screen of (width: 100%x and Height: 5000dip)

Please, if you have some example that does something similar can it show?

Or, if you can dedicate a time to write a sample code.

Thank you very much.
You have examples provided with the library. Map_tIDE shows how to move the camera. It's just a Camera.Translate call.
 
Upvote 0

andymc

Well-Known Member
Licensed User
Longtime User
my best advice from how I use it, is to set a viewport size, then use the width and height you specify and work with those dimensions, forget about DIPs and %s

e.g.
Dim vpW As Float = 217 'set view port width
Dim vpH As Float = 398 'set view port height
in globals

then
Camera.Initialize
Camera.SetToOrtho2(False, vpW, vpH) 'set camera viewport to viewport size vpW by vpH
in the resize method

check out this project a basic example
https://www.dropbox.com/s/eo9g1zwk8mnljqo/Twin stick shooter - part 1.zip?dl=0
 
Upvote 0

Eme Fibonacci

Well-Known Member
Licensed User
Longtime User
Very well.
I've walked a little. I already load some bitmaps and a tilemap. Scroll the camera.
Can anyone talk a bit more about what is the coordinate system and screen resolution and sprites in libgdx and how to deal with it in b4a? Thank you.
 
Upvote 0
Top