How to ensure visual compatibility across devices?

I’m working on a game for Android, but I’m coming across a very tedious problem. My code is written with variables that should work universally, but on some devices I can see what is off screen on another device.

Here’s an example. Say I have a wall that’s off-screen on the bottom of the device. I write it so that it’s right along the edge but isn’t visible. Here’s what it would look like:

\_W = display.contentWidth  
\_H = display.contentHeight  
  
local wallBottom = display.newRect( 0, \_H - 5, \_W, 5)  

This code will work on say, the Nexus 1, but when I display it on the Galaxy I see the wall.

How do I go about fixing this? Is it something in config.lua that I would have to modify? Any help would be greatly appreciated! [import]uid: 66386 topic_id: 12010 reply_id: 312010[/import]

Never mind, I got it fixed. [import]uid: 66386 topic_id: 12010 reply_id: 43849[/import]

Please tell us how you fixed it. Someone may search the forum and find your post, have the same problem as you, and then be disappointed when they find you’ve solved it but not posted the solution. [import]uid: 26769 topic_id: 12010 reply_id: 43853[/import]

Well I realized lots of the numbers I put in were hard-coded. My father helped me out and reminded me that all variables should be in reference to something that can remain consistent between devices. For example, a distance of 5 pixels between objects will make the end result much different on a Galaxy tab than a Nexus 1. To fix that, I replaced nearly all of my variables in reference to the width or height of the screen itself, so that regardless of what device it’s on, it will look proper. There’s also the config.lua file, but that’s a given. [import]uid: 66386 topic_id: 12010 reply_id: 43854[/import]