Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (113)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Changing sprite size on android devices.  (Read 1180 times)
0 Members and 1 Guest are viewing this topic.
Offline Destronomy

Junior Newbie





« Posted 2013-06-11 07:50:11 »

I read through some tutorials on the libgdx site, and successfully made an animated brain walk around the screen depending on where mouse pointer ( or finger press on android ) was at. It works great, but on my android device ( Galaxy S4 ) the sprite seems very small. I read that you cannot change the resolution on android since the system controls it... so is the orthographic camera the only way to get my sprite to show up at a decent size?

Was hoping for a quick and dirty method just to get it working, but it keeps coming back to that darn Orthographic camera.  Undecided
Offline UprightPath
« Reply #1 - Posted 2013-06-11 08:05:38 »

Okay, are you talking about actual sprites IE- something like an enemy or a player Avatar moving around on screen, or just images like the UI?

For the Enemy/Player then it's better to use the OrthographicCamera method. This is because just resizing your images on the fly can make for wonky gameplay, unless you make sure you do other things. This is because just resizing your sprites will not change the visual distance between them, or their positions in regards to the origin (Bottom left). This will cause hit boxes to be be off visually and can cause your characters abilities to start in the wrong place compared to their positions. You have to make sure that the scale affects everything that is being painted rather than just the sprites. Easiest way is by adjusting the Z of your Orthographic camera (Basically move your camera closer or further away from your camera).

For the UI, then I believe that you can apply a scaling factor to the Stage and it'll propagate through everything.

Offline Destronomy

Junior Newbie





« Reply #2 - Posted 2013-06-11 08:14:22 »

Sorry. Yes I was referencing my player sprites, and I just found the Stage class after I wrote this... and yes it completely borked up my movement.  Grin

So stretching the screen to fit the device is not the way to go.

I will just have to rewrite it all after I finish reading on the camera, but I guess that is the best way to learn. hehe.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Dwinin (16 views)
2014-09-12 09:08:26

Norakomi (50 views)
2014-09-10 13:57:51

TehJavaDev (59 views)
2014-09-10 06:39:09

Tekkerue (27 views)
2014-09-09 02:24:56

mitcheeb (50 views)
2014-09-08 06:06:29

BurntPizza (34 views)
2014-09-07 01:13:42

Longarmx (20 views)
2014-09-07 01:12:14

Longarmx (23 views)
2014-09-07 01:11:22

Longarmx (22 views)
2014-09-07 01:10:19

mitcheeb (31 views)
2014-09-04 23:08:59
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!