• Hello,

    I'm trying to make a scrolling map window which mostly is working great.

    I've tried to add zoom functions but can't work out how to do the maths that calculates how the x and y should change with the scale of the image? Anyone any ideas?

    Here's my code so far, it's bodged from the scrolling textbox. I assume it's the speed element that's not working. I'm trying a bit of trial and error on the values.

    The next stage is going to be limiting the image so it doesn't get smaller than the mask or is not scrolled too far either direction so the edge shows. I assume this is going to be through an 'if' statement but if anyone has any ideas it would be much appriciated!

  • Fixed the first bit. aligned centre did the trick.

    No this didn't work unless the map is centred, if it's been moved x,y still needs to be adjusted during the zoom. Anyone any ideas?

    Anyone any ideas how to limit the movement of the image if the edge is reached? i.e. adjusted for scale?

    How about dragging the image, anyone know how to do that?

    Edited once, last by viewinz (July 28, 2009 at 6:04 AM).

  • I played around a bit and haven't come up with a solution. I can say that the scale function looks to work from where you've defined the edge of the plugin... i.e. edge=center - scales from the center equidistance all around... edge=leftbottom - scale + causes the image to get larger up and to the right. (hope I got that right *smile* )

    I've got another idea I'll test out and let you know.

    edit:
    OK, my other idea didn't work at all. For reference, I tried setting the "map_image" as the child to another plugin (map_scaler)... and then scaled the "map_scaler" to see how the map_image looked... and it didn't work.

    While there may be some mathematical solution... I think the best solution will be an updated "map" plugin that enables you to load your own image as a map. This has been brought up before but I'm not sure where it stands on the list of things to implement.

  • Cheers Graydon,

    I think in that case I'll just take the zoom buttons out unless anyone can come up with anything better? ..Klaus?

    I saw from another post you commented on dragging the map might be more complicated than I thought.

    I'm trying now to limit the extend of the map. Something like an if statement should work I think.

    Thanks lots for your help tho.

  • I'm trying to limit the tween by stopping the image when it reaches the edge. It works sometimes if the image is right on the edge, but not if you scroll past it.

    Code
    if(plugin[map_image].x LT 0,tween(plugin[map_image].x, 640, distance(400,0.7), linear),null)

    Is this code in the right direction?

  • Tried this which is a bit better -

    Code
    <plugin name="map_scrollleft" url="dirbutton.png" keep="true" parent="map" zorder="73" align="leftbottom" x="24" y="24" rotate="+180" crop="0|0|19|19" onovercrop="0|19|19|19" ondowncrop="0|38|19|19" ondown="if(plugin[map_image].x LT 0,tween(plugin[map_image].x, 1100, distance(400,0.7), linear));if(plugin[map_image].x GT 0,stoptween(plugin[map_image].x))" onup="stoptween(plugin[map_image].x);"/>

    It works if you are past the edge, stop and scroll again, but not if keep scrolling. I presume I need a listener or something to check the value whilst scrolling, but I'm not sure how to do this.

    EDIT: Fixed by changing destination value.

    Edited once, last by viewinz (July 29, 2009 at 5:29 AM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!