Scale your sprites properly in LibGDX
Also use this tip to greet "Hello All!" :)
For first tip, some lines of pseudo code to scale your sprite which instance of Image class while maintaining the aspect ratio.
//you have an instance of Image
Image image = createInstanceOfImage();
//These lines will resize your sprite to half of screen's width while keeping the ratio
image.width = .5f * Gdx.graphics.getWidth();
image.setScaling(Scaling.fillX);
//To resize in height's scale
image.width = .5f * Gdx.graphics.getHeight();
image.setScaling(Scaling.fillY);
If you can't figure out yet whether use width or height as scale, use Scaling.fill will help.
Written by Hendra Gunawan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Game
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#