Space on top & bottom of map for buttons and a banner ad

Does anyone know how to load a map inside a custom-sized space instead of full screen? I would like to have space at the top and bottom of the screen to put buttons and a banner ad.

Right now I am simply loading the map in like so:

mte.loadMap(“map1.tmx”)

mte.constrainCamera()

and my config file is simply:

application = {
    content = {
        width = 320,
        height = 480,
        scale = “letterbox”,
        xAlign = “center”,
        yAlign = “center”,
    }
}

I also have mte.setCameraFocus(player) to follow the player around the map.

These configurations do exactly what I want, but I just can’t seem to get the map to load on the screen in a space with my own height set.

Changing the height, scale, xAlign, and yAlign in the config file doesn’t seem to work. Any solutions?

Thanks : )

I’m pretty sure you don’t want to load a map for that task. Just make your own display group, make it the highest display group above the map, get the contentBounds of screen and add buttons/widgets to that display group, that way its always on the certain spot of the screen on top of the map. The widgets library should do what you want.

Got it working! I took your advice and set up some containers and also found that mte has a setScreenBounds function that allows you to change the values of the screen’s edges.

Thanks for the quick reply Azmar!

You might want to look at the Business Sample App.  https://github.com/coronalabs/business-app-sample

Thanks Rob, I will check it out!

I’m pretty sure you don’t want to load a map for that task. Just make your own display group, make it the highest display group above the map, get the contentBounds of screen and add buttons/widgets to that display group, that way its always on the certain spot of the screen on top of the map. The widgets library should do what you want.

Got it working! I took your advice and set up some containers and also found that mte has a setScreenBounds function that allows you to change the values of the screen’s edges.

Thanks for the quick reply Azmar!

You might want to look at the Business Sample App.  https://github.com/coronalabs/business-app-sample

Thanks Rob, I will check it out!