Been working hard over the last few days on a project that I came up with while simply experimenting with some stuff... and it became a little more than an experiment in the end...
Something so simple is frustrating me though... paralax scrolling.
So far I have made a few layers and adjusted the "scroll x rate" and "scroll y rate" and it seems to work fine on layers that are "above" my character, however if I change "scroll x/y rate" on layers which are "below" my characters layer, it... messes with my character.
Understand? No neither do I...
Example of the anomolae, in a practical situation:
- We have 3 layers, Layer 1,2,and 3.
- Player character is on layer 2, and can shoot bullets from a gun.
- Layer 3 is "on top" or "above" layer 2, and has some laterns in the "foreground" which scroll past the player as they walk along, moving in front of the charater. The scroll rate is adjusted to say, 150%.
- Layer 1 is behind layer 2 and has some trees and buildings which are supposed to move behind the player. The scroll rate is 80%
- The effect works perfectly fine (visually), until the player starts shooting his gun. When the characters X coordinate and/or Y coordinate are close to 0, everything seems fine, but as the player walks further along to the right (increasing X coordinate), the bullets seem to fire from a point in front of the player instead of from the players gun... the longer you walk along the further the point moves away from the player. I am using an "action point" on my character at the end of the gun.
- As soon as the scroll rate is set back to 100% on layer 1, the problem goes away but I loose the paralax on the "back" layer
Anyone else come across this? Am I doing something wrong (I think I am!) to make this happen? I would really like to have a paralaxed background... I could handle it if the foreground stuff wasn't working right, I just wouldn't use it... but having a nice background is more important to me.
Thanks in advance guys!