-SOLVED- Game in Landscape Mode?

I want to make a game in landscape mode, but I can't seem to figure out how. I made my game width 800 and my height 480. Then, in my build settings, I put that it's default is "landscapeRight" and it only supports "landscapeRight". My goal here is to get the simulator to rotate like it does for Tilt Monster. Unfortunately, I don't know how to do it.

A picture says a thousand words...
http://dl.dropbox.com/u/27644193/Makin%27%20Bank.PNG

config.lua

1
2
3
4
5
6
7
8
9
application =
{
        content =
        {
                width = 800,
                height = 480,
                scale = "letterbox",
        },
}

Anyone know? This is really bothering me...

change this line,

1
supported = {"landscapeRight","landScapeLeft"},

I tried what you said, but the simulator was still in portrait mode . :/

You have a missing comma in your build.settings between the versionCode and versionName entries. Any syntax error will cause the build.settings not to be used.

Unfortunately there's no error messages about this anywhere when you compile/run, but I've read in other posts that Ansca is aware of this problem.

I did what you said, and now I have a display problem. Check the first post for an updated picture and code.

this is how my build.setting looks like

1
2
3
4
5
6
7
8
9
10
11
12
13
settings =
{
        
        orientation =
        {
                default = "landscapeRight",
                supported =
        {
                "landscapeLeft", "landscapeRight"
        },
        },
        
}

Not sure what to make of this, but it looks like there's a mismatch between the content size you've specified (480x800) and the way you create your objects in your code.

All objects' coordinates must be set within the size given in config.lua, and since your orientation is in landscape you have a canvas that's 800 pixels wide and 480 pixels high.

For example, if you want a background fill with your settings you would use
local tmpSquare = display.newRect(0,0,800,480);

My images and config are right, but for some reason it thinks that (0, 0) is located towards the middle of the screen. The starting height is correct, but the ending height is not. Neither the starting or ending width is correct. If you don't know what I mean, click the picture link in the first post.

Hmmm. It's difficult to guess what the problem may be...
Could you post some code that produces the output in your test image you linked to above?

Other than the config and settings above?

game.lua (the scene when the picture is taken)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module(..., package.seeall)
display.setStatusBar(display.HiddenStatusBar)
local gameGroup = display.newGroup()
require("physics")
 
function new()
        setUpPhysics()
        createScene()
        createPig()
        return gameGroup
end
 
function setUpPhysics()
        physics.start()
        physics.setGravity(0, 0)
end
 
function createScene()
        local background = display.newImage("visuals/game_background.png", 0, 0)
        local ground = display.newImage("visuals/game_ground.png", 0, 445)
        gameGroup:insert(background)
        gameGroup:insert(ground)
end
 
function createPig()
        local pig = display.newImage("visuals/game_pig.png", 384, 397)
        gameGroup:insert(pig)
end

have you moved your gameGroup or set its position anywhere??

otherwise (0,0) is the topLeft corner of your device also as previously ur config.lua has wrong setting and you have changed that have you seen any changes after that have you changed coordinates of your group or objects accordingly

:)

One thing I noticed is that the config.lua you posted now has a syntax error, which can cause weird behavior.
There's an extra '}' at the end of the file that needs to be removed.
You should be getting an error message in the Terminal window about this though.

From the game.lua code you posted everything looks OK. As long as your background.png is created as a 800x480 image, and that you're not doing any manipulation to the gameGroup after it has been returned.

If you still get this behavior after correcting the syntax error I mentioned above, I would like to stress is that you double-check that you're using the right config.lua.
I get the exact same output as your screenshot when the settings in config.lua are incorrectly set to width=800 and height=480, which indicates to me that your app still isn't using the correct config.lua.

The extra } at the top was a typo, not something that is actually in my code. And I tested if my config was being used with a print(), and it said that it was being used. I really don't know what the problem could be...

I was able to fix it!

It's because my config had width = 800 and height = 480, when those should have been reversed.

Thank you everyone who helped!

Great!

However that was exactly what @hgvyas123 said in post #2 :-)

lol i was thinking that was changed and not seen that again but important thing it has been solved now.

:)

views:1159 update:2011/11/17 9:28:17
corona forums © 2003-2011