setScreenBounds..

Hi dyson,

My display window is the left half of the screen.  The right half is for game info.

I’m using:

mte.setScreenBounds(0,0,display.contentWidth / 2,display.contentHeight)

What I am seeing is that when I scroll the map, my sprites go beyond the right boundary to the right half of my screen.

And also, my map tiles are not drawn all the way to my right boundary until I move to the right, at which point they get drawn past the mid point of my screen (my tile size is 128, I don’t know if that is related to the problem).

Thanks, Greg

The best way to confine the map to a certain area of the screen is to put it into a container object;

mte.setScreenBounds(display.contentWidth / -4, display.contentHeight / -2, display.contentWidth / 4, display.contentHeight / 2) local mapObj = mte.getMapObj() local newGroup1 = display.newContainer(display.contentWidth / 2, display.contentHeight) newGroup1.x = display.contentWidth / 4 newGroup1.y = display.contentHeight / 2 newGroup1:insert(mapObj)

Containers clip their contents to produce a nice clean edge. Try that and let me know if you’re still having trouble with tiles not drawing to the edges. 

Wow that works great, and give a super nice clean right edge!

And it also contains the sprites within the map now!

Thanks dyson!

Hi dyson,

I just noticed, that even though the map only takes up the left half the display, and is inside the container, it still responds to touch events that are over on the right side of the screen.

Thanks, Greg

I’m not seeing that behavior on my end. Could you post some of your code, for example your touch listener and how you’ve configured it?

it was me!  I was thinking the mte had a listener built into it!

Thanks, Greg

The best way to confine the map to a certain area of the screen is to put it into a container object;

mte.setScreenBounds(display.contentWidth / -4, display.contentHeight / -2, display.contentWidth / 4, display.contentHeight / 2) local mapObj = mte.getMapObj() local newGroup1 = display.newContainer(display.contentWidth / 2, display.contentHeight) newGroup1.x = display.contentWidth / 4 newGroup1.y = display.contentHeight / 2 newGroup1:insert(mapObj)

Containers clip their contents to produce a nice clean edge. Try that and let me know if you’re still having trouble with tiles not drawing to the edges. 

Wow that works great, and give a super nice clean right edge!

And it also contains the sprites within the map now!

Thanks dyson!

Hi dyson,

I just noticed, that even though the map only takes up the left half the display, and is inside the container, it still responds to touch events that are over on the right side of the screen.

Thanks, Greg

I’m not seeing that behavior on my end. Could you post some of your code, for example your touch listener and how you’ve configured it?

it was me!  I was thinking the mte had a listener built into it!

Thanks, Greg