On Tue, Jun 07, 2011 at 01:19:27PM +1200, Ralph Versteegen wrote: > On 7 June 2011 12:04, James Paige <b...@hamsterrepublic.com> wrote: > > On Tue, Jun 07, 2011 at 11:39:51AM +1200, Ralph Versteegen wrote: > >> On 7 June 2011 07:45, James Paige <b...@hamsterrepublic.com> wrote: > >> > On Mon, Jun 06, 2011 at 03:23:26PM -0400, Mike Willis wrote: > >> >> So I don't know how to reply on those archives, but here is the crux > >> >> of > >> >> the parallax problem I think: > >> >> > >> >> You want the x coordinate of the top left of the screen to be the > >> >> dividing > >> >> factor, NOT the tiles. In other words, you don't want > >> >> (parallax 'map' final tile x-coord) == 1/3 * (real map final tile > >> >> x-coord) > >> > > >> > I haven't used tile coordinates for anything. pixel coordinates only. > >> > > >> >> You want > >> >> (parallax 'map' final pixel x-coord -- screen pixel size) == 1/3 * > >> >> (real > >> >> map final pixel x-coord -- screen pixel size) > >> >> > >> >> Then the script would work as intended, I think...? > >> >> > >> >> Alternatively, you want to work out the actual ratio of sizes RATIO > >> >> as > >> >> follows: > >> >> RATIO:= (parallax 'map' final pixel x-coord -- screen pixel size) / > >> >> (real > >> >> map final pixel x-coord -- screen pixel size) > >> >> > >> >> and then use this RATIO in your script instead of 1/3 > >> > >> This all looks correct. And to be honest it hadn't occurred to me that > >> the screen size matters (it applies only for one of the two types of > >> parallax layers). > >> > >> But if fact you don't really need to worry about correcting for the > >> size of the screen, you just need to draw a large enough corner of the > >> map layer (a bit more than a third). > > > > Yeah, I realized I could just add 6 rows and 10 columns to my background > > layer to make this work the easy way, but I really wanted to figure out > > how to make it work when the background layer is exactly 1/3 the size of > > the map. > > > >> I imagine that the real reason that your script isn't working is that > >> the map root slice is placed at (-camera x, -camera y) relative to the > >> screen, so to get the map layer to display at (camera x/3, camera > >> y/3), you actually need to place it at offset (camera x * 2/3, camera > >> y * 2/3) relative to the map root. > > > > Yes, absolutely right. > > > > I actually should have posted the version of that script where I was > > doing: camera pixel x -- camera pixel x / 3 > > > > That is as close as I got to making it work right :) > > > > --- > > James > > So, is the problem solved now?
Well, solved in the sense that I can add six more rows and 10 more columns to my background layer and it will look okay, but I still really want to understand the math needed to make the parallax work with the 1/3 size layer, since that is the same math that will be required when parallax scrolling is a built-in feature on different-sized map layers in the future. --- James _______________________________________________ Ohrrpgce mailing list ohrrpgce@lists.motherhamster.org http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org