MTE parallax layers offset

Hi All

Let me start saying that MTE is grat. Thanks for creating it. It is exactly what I need for my scroll shooter.

I have few questions though, and the first one I have to ask today as I cant figure out how to setup my scene properly.

What I have is a 32x32 tiles on a 200x10 map.

I have 3 layers with parallex set to 0.3 , 0.5 and 1

when I load map into Corona  and mte.goto (1,1) the layers show in middle on thes screeen with kind of offset and I cant setup them to allign corectly from screen edge.  

I guess the problemy is probably related to height of map set to 10.

when I remove parallax the problem disapears.

So how can I setup the map with parallax layers and have it alligned correctly at the map start?

TIA

Are you using world wrap? If not the layers will only continue up to the edges of the map, and at position 1,1 the edge of the map is near the center of the screen.

@dyson122

using wrap is not an option here.

please notice myscene height (map height) is exactly the sixe of screen so when wrap is on the map is repeating which in my case is not acceptable.

again, what I work on right now is a side scrolling shooter and I need the height of screen to be 10 *32.

What I need is kind of setting reference (anchor) point of the whole map or separate layers.

and say to mte that it should start draw layers from top left side of the screen and not in the middle of the screen

is it doable?

[edit]

in other words what I need is a parallax but only in the X axis with Y axis parallax off.

Ah yes, that’s an interesting problem. It sounds to me like you don’t want the background to move in the Y direction at all, so that it always exactly fills the screen from top to bottom. In this scenario it doesn’t make sense to use setCameraFocus. Instead you would load your map and perform the goto, then you would use mte.moveCamera to fit your layer in the screen. Instead of calling mte.moveSprite and letting setCameraFocus move the camera, you would call met.moveSprite using both your x and y velocities and then mte.moveCamera using your x velocity but 0 for your y velocity. 

I’ll look into adding some kind of reference point system to MTE for the next update, to make all this easier. 

@dyson122

Yes, that’s exactly wht I need. And you’re right what I do is to scroll the map with mte.goto () as it makes sense for this scrolling shooter I work on. 

So if you could make something like thatI, that would be kool. For now I’ll wait.

BTW: I have another idea for you… I don’t need collision between sprites and map so I use Corona’s default sprites. 

Now when I move my sprite to top or bottom of the screen it would be great to slide the map (with parallax ofcourse :wink: ) a little bit up and down accordinglyh and show outside of the main map… you see that in almost all 90’s scroll shooters :wink:

So?

TIA

You’ve piqued my interest now. What manner of scrolling shooter are you working on? When I think of scrolling shooter I think of an aircraft or spaceship moving from left to right (or bottom to top) blowing stuff up as it enters the right (or top) of the screen. 

I’m in the process of adding functionality which will more conveniently solve your parallax offset problem. I go into more detail in the main thread, but basically you’ll be able to define a rectangle on the map which the camera can’t leave. In your case the rectangle will be one pixel high, because you desire no vertical movement of the map layers. The camera will then follow this narrow rectangle back and forth sort of like a rail.

@dyson122

Great news.

When can we expect this in new features in new release?

The plan is to release it sometime next week. Messing with the movement functions always calls for a good deal of testing.

It’s coming along pretty nicely in it’s current incomplete state. You can specify whether you want the camera to move into the constrained area using an easing-over-time movement like inOutExpo, or you can have it snap to the nearest allowed position inside the constrained area in a single frame. 

Are you using world wrap? If not the layers will only continue up to the edges of the map, and at position 1,1 the edge of the map is near the center of the screen.

@dyson122

using wrap is not an option here.

please notice myscene height (map height) is exactly the sixe of screen so when wrap is on the map is repeating which in my case is not acceptable.

again, what I work on right now is a side scrolling shooter and I need the height of screen to be 10 *32.

What I need is kind of setting reference (anchor) point of the whole map or separate layers.

and say to mte that it should start draw layers from top left side of the screen and not in the middle of the screen

is it doable?

[edit]

in other words what I need is a parallax but only in the X axis with Y axis parallax off.

Ah yes, that’s an interesting problem. It sounds to me like you don’t want the background to move in the Y direction at all, so that it always exactly fills the screen from top to bottom. In this scenario it doesn’t make sense to use setCameraFocus. Instead you would load your map and perform the goto, then you would use mte.moveCamera to fit your layer in the screen. Instead of calling mte.moveSprite and letting setCameraFocus move the camera, you would call met.moveSprite using both your x and y velocities and then mte.moveCamera using your x velocity but 0 for your y velocity. 

I’ll look into adding some kind of reference point system to MTE for the next update, to make all this easier. 

@dyson122

Yes, that’s exactly wht I need. And you’re right what I do is to scroll the map with mte.goto () as it makes sense for this scrolling shooter I work on. 

So if you could make something like thatI, that would be kool. For now I’ll wait.

BTW: I have another idea for you… I don’t need collision between sprites and map so I use Corona’s default sprites. 

Now when I move my sprite to top or bottom of the screen it would be great to slide the map (with parallax ofcourse :wink: ) a little bit up and down accordinglyh and show outside of the main map… you see that in almost all 90’s scroll shooters :wink:

So?

TIA

You’ve piqued my interest now. What manner of scrolling shooter are you working on? When I think of scrolling shooter I think of an aircraft or spaceship moving from left to right (or bottom to top) blowing stuff up as it enters the right (or top) of the screen. 

I’m in the process of adding functionality which will more conveniently solve your parallax offset problem. I go into more detail in the main thread, but basically you’ll be able to define a rectangle on the map which the camera can’t leave. In your case the rectangle will be one pixel high, because you desire no vertical movement of the map layers. The camera will then follow this narrow rectangle back and forth sort of like a rail.

@dyson122

Great news.

When can we expect this in new features in new release?

The plan is to release it sometime next week. Messing with the movement functions always calls for a good deal of testing.

It’s coming along pretty nicely in it’s current incomplete state. You can specify whether you want the camera to move into the constrained area using an easing-over-time movement like inOutExpo, or you can have it snap to the nearest allowed position inside the constrained area in a single frame. 

Hi Dyson,

I am using setCameraFocus, is there any way that i could pause the camera for specific time and restart it. I am at end of my project this thing will finish of my project.

Thanks,

Kumar KS.

Hi Dyson,

I am using setCameraFocus, is there any way that i could pause the camera for specific time and restart it. I am at end of my project this thing will finish of my project.

Thanks,

Kumar KS.