config.lua on Android

Below is my config.lua.  It works fine on all the Apple products and most of the other products.   However there are a few items in the Simulator that displays the assets incorrectly (see item 2b below).  

All of the assets are set up using the following set up using the following method:    

asset.x = display.contentCenterX, asset.y = display.contentCenterY

  1. Which of the phones in the Simulator are considered “Android”?   Which one’s would be applicable if I released the game on Google (excluding the obvious iPhones)?

2a) The config.lua works as expected on the following:  HTC Sensation, Samsung Galaxy S3, Samsung Galaxy S5, Kindle Fire, Kindle Fire HD 7", Kindle Fire HD 9", Nook Tab, Amazon Fire TV’s, Ouya’s,  Nokia Lumina 920 and Samsung ATIV S, all apple phones and iPads.

 2b)  The config.lua does NOT work as expected on the following:  NexusOne and HTC Windows Phone 8S

Is there a way to fix this on these two items without impacting all the other items that are currently working?

Can I exclude these phones from the release?   Are they even relevant to releasing to Google?

I attached some screen prints so you can see what I am talking about.  One good one and two bad ones.

Thanks,

Lori

-----------------------

CONFIG.LUA

------------------------

–calculate the aspect ratio of the device

local aspectRatio = display.pixelHeight / display.pixelWidth

application = {

         content = 

         {

                 width = aspectRatio > 1.5 and 800 or math.floor( 1200 / aspectRatio ),

                  height = aspectRatio < 1.5 and 1200 or math.floor( 800 * aspectRatio ),

                   scale = “letterBox”,

                   fps = 30,

                 imageSuffix = 

                 {        

                           ["@2x"] = 1.3,

                  },

            },


license =

  {

       google =

       {

           key = 

    “MY GOOGLE KEY #”,

       },

   },

}

I think you forgot to attached your screenshots and config.lua code

I tried again and it keeps telling me the file is too big - even when I try to upload one screen shot.  I tried making it smaller but same thing.  Thoughts?

Lori

Hi Lori,

Do you have an image editing program to down-size the images?

If you can’t upload images, can you describe what you mean by “a few items in the Simulator that displays the assets incorrectly”? What does “incorrectly” mean here? Alignment? Resolution? Position? Any details you can provide should help squash this issue… my initial guess is that you need to change your image suffix value because the “misbehaving” devices aspect ratios are making some things fall outside of the range you’ve specified.

Brent

P.S. - Obviously, the “HTC Windows Phone 8S” has no relevance to Google. :slight_smile:

This is a good picture.  HTC Sensation

 

This is a bad picture:  NexusOne

The HTC Sensation is how it is supposed to look and the Nexus One is messed up.   The balls go on the out edges of the table and the target is above the table.  When I play the game on NexusOne Skin the ball goes to the outside of the table.

Since Windows HTC is not applicable to Google, I guess NexusOne is the only issue.

Sorry the pics are so small.   That was the only way I could get them uploaded.

Thanks - I appreciate the help.

Lori

Click on “More Post Options” button below the exit box. There you can attach larger files.

This is the bad display.  The balls are on top of the table and the boundaries of the table are actually outside the graphic so the “bumper” is outside of where it should be graphically.   Also, the target hole is above the table.  This is using the NexusOne Skin

[sharedmedia=core:attachments:4623]

This is the correct display (different level but same principle).  The balls all align within the parameters of the table and the target hole is on the table and the boundaries for the bumpers align with the picture so the game plays as expected by the user.   This works as it should on all skins except NexusOne

[sharedmedia=core:attachments:4622]

Every level has a different layout but the measurements of the table and assets are the same.  This only a problem on the NexusOne skin.

Sorry for the poor quality of the picture.

Thanks

Lori

Hi Lori,

First, please add the following code somewhere in main.lua and run it on the NexusOne and then also on a device you know is working (where things are positioned where they should be). Then report back your results.

[lua]

print( “IMAGE SUFFIX: [”, display.imageSuffix, “]” )

[/lua]

Thanks,

Brent

NEXUS ONE came back  IMAGE SUFFIX: [nil]

HTC Sensaation came back MAGE SUFFIX: [nil] as well but the screen is displayed correctly.

Thanks

Lori

How do you actually position the green and white balls in your code? I can’t imagine that they’re purely “display.contentCenterX” and “display.contentCenterY” because they’re not aligned in the center (the green ball is definitely somewhere above the horizontal center).

Brent

This is cut and pasted from my code.  I do have to add + or - on either side of center of the X so that it will align in a row.

Below the ball code is the set up for the table.  I think the graphic for the table is not sizing correctly.  If the graphic for the table (picture) were larger it would align with the hidden bumpers with physics and would be placed under the target etc…’


–GAME BALL 1 BOTTOM ROW LEFT SIDE


ball1=display.newImage(“Images/ballFuryGreen.png”) 

ball1.x = display.contentCenterX-100; ball1.y = display.contentCenterY +100

sceneGroup:insert(ball1)

physics.addBody(ball1, ballBody)

ball1.id = “gameBall1”

ball1.type = “solid”

ball1.value = 10

ball1.count = -1

ball1.postCollision = ballCollisionAudio

ball1.linearDamping = 0.3 – simulates friction of felt

ball1.angularDamping = 2 – stops balls from spinning forever

ball1.isBullet = true – If true physics body always awake

ball1.active = true – Ball is set to active

ball1.bullet = false – force continuous collision detection, to stop really fast shots from passing through other balls


–TABLE TOP


local tableTop = display.newImage(“Images/borderYellowGreen2.png”)

tableTop:scale(0.98, 0.98)

tableTop.x = display.contentCenterX; tableTop.y = display.contentCenterY

sceneGroup:insert(tableTop)

Hi Lori,

I notice you’re not using dynamic image selection. You really should be using that if you’re deploying to devices with varying aspect ratios and resolutions (which you are doing).

Brent

OK.  What is that?

It’s basically using “display.newImage Rect ()” which tells Corona to use the proper-resolution image depending on the resolution of the device. That ensures that you get sharp, precise images on a wide array of devices without taking up excessive texture memory on older/smaller devices which don’t necessarily need hi-res images.

Still, that might not be the issue here. Can you try just putting a vector rectangle in the center of the scene, tinted transparent red, and test out different devices?

[lua]

local testRect = display.newRect( sceneGroup, display.contentCenterX, display.contentCenterY, 200, 300 )

testRect:setFillColor( 1, 0, 0, 0.5 )

[/lua]

Brent

The vector square is in the center on both of the devices.

I’m having trouble with the picture again.  I can’t figure out how to get it it  into my media to attach.  I’m not sure what i did to get those others two in my media.

Thanks

Lori

OK, now try to set the vector square to the same location as the ball. Does it reside centered around the ball?

Used the Y location of the cue ball and did it again with the Y of the green balls.  The brighter colored square is over each of the type of balls respectfully.  However, the rectangle is longer with darker colors on the outside and a bright red in the center.

Thanks

What do you mean by rectangle? I think you’ll need to post another screenshot. :slight_smile:

You can use a free image host like postimage.org to upload images, then just post the link here

screenshot1.jpgThanks for the tip. screenshot0.jpg

This is what I meant by the rectangle