Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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 2293 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  

hadezbladez (276 views)
2018-11-16 13:46:03

hadezbladez (154 views)
2018-11-16 13:41:33

hadezbladez (287 views)
2018-11-16 13:35:35

hadezbladez (69 views)
2018-11-16 13:32:03

EgonOlsen (2124 views)
2018-06-10 19:43:48

EgonOlsen (2148 views)
2018-06-10 19:43:44

EgonOlsen (1361 views)
2018-06-10 19:43:20

DesertCoockie (1957 views)
2018-05-13 18:23:11

nelsongames (1598 views)
2018-04-24 18:15:36

nelsongames (2246 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!