 1. ## Adjusting Layer Position To Account for Coefficient

A problem I thought I'd just tackle "later on" and now it is later on...

I have three layers behind the "main player" layer that scroll at different coefficients to create a parallax effect. The issue here is, then when I place objects in those layers, their "actual" position is different than what it is perceived to be when positioned in the frame editor because obviously, this object is already scrolling at a different rate.

To combat this, as a test on one of the layers, I manually observed how many pixels an object moved once the coefficient was set and then created an event to manually change the and Y positions of the layer - this works, but it's not ideal, as I'm hard-coding each change.

My question is, can anyone figure out the maths to create a formula to apply this change? Say, if my coefficient is set to 0.6, how can I figure out how much to adjust the layer by at frame start?  Reply With Quote

2. I generally calculate the position I need to move an object to based on its coefficient. For example, if I have an object that I want to appear at x1000 and y950 in-game, but the layer scrolls at 0.50 on both coefficients, I multiple each coordinate by the coefficient. So, 1000 x 0.50 =500 and 950 x 0.50 =475. So I then move that object to x500 and y475 on the parallaxing layer and it generally gets me where I need to be, depending on the coefficient.  Reply With Quote

3. If it's an object created at runtime, I usually just create the object at the x/y coordinates you want them to be at on a layer with the normal 1.0x/1.0y coefficients, then move them to the correct layer  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•