ParallaxBackground could benefit from a simple preview feature #5494
Bropocalypse
started this conversation in
Editor
Replies: 1 comment 4 replies
-
Have you tried enabling View > Preview Canvas Scale at the top of the 2D editor viewport? |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Parallax scrolling is a useful feature to have, but despite the fact that it's ostensibly a visuals-oriented feature, there's not a clear way to simultaneously preview its implementation and also make tweaks to the placement of things in it. Currently, the only way to make adjustments is to run your project (with, at minimum, a camera controller system on top of the parallax background you're working on) to even see it, and then make guesses based on what you see at runtime to move those background elements around. This can be a problem if you want to depict background elements in specific places via ParallaxLayers and are making a level that's of notable size(larger levels are where parallax effects really shine). To me this feels like being unable to see if elements in a tileset line up until runtime.
I tried to implement a preview function for myself. My approach was a toggleable function on a Camera2D to offset ParallaxLayers relative to its position in order to attempt to see what things would look like when the camera was viewing that portion of the scene. In principle, it functioned, but it had some problems that I don't believe I'm capable of resolving.
For one, the algorithm used to determine motion scaling in the ParallaxLayers isn't clear. The closest I was able to get in mimicking it was an interpolation between base position and camera position, but that turned out not to be very accurate. I tried to reverse engineer the source code but couldn't quite grok what was going on in the related files. (As a side note, I think this should be a feature because it would feel unreasonable to ask others to reverse-engineer the source code to write a tool script to nudge graphics around to see if they'll line up later on.)
Another issue was that the only way I could figure out to display the offsets to the ParallaxLayers was to modify their positions directly while storing their old data in a dict and putting it back when I was done, which meant manually shutting it off before playing the scene. If I lose track of whether the preview toggle is activated, I run the risk of creating bogus data in my backgrounds that I'll need to correct.
I feel that a simple in-editor feature like this, based on position of Camera2D, allowing users to simultaneously view and fine-tune the visuals of their sidescroller(or whatever) would be perfectly at-home in the 2D environment, and would be of use to everyone who intends to use ParallaxBackground.
Beta Was this translation helpful? Give feedback.
All reactions