May 6

Map Handling Take 3 – Hover Over Borders (AS3)

Well, at the risk of sensory overload today – it’s my blog after all – I decided to post one more version of my map handler. This one adds in the classic mouse hover scroll effect at the edges of the map. I did try to make it a bit more usable, though, by calculating the distance from the edge of the map and accelerating the movement appropriately. So, the closer to the edge you are, the faster the map scrolls. So, to recap, you can use the following methods to move:

  1. A, S, D and W
  2. Click the location on the map preview where you want to zoom
  3. Click and drag the viewport preview to quickly pan the map
  4. Hover over the edges of the map itself to scroll

Obviously, for a released title, I would want to replace the cursor icons with arrows upon the hover scrolling and other cleanup things as well, but just toying with concepts right now.

Thoughts?

2 comments

2 Comments so far

  1. Mark Johnson May 6th, 2009 6:55 pm

    Looking great Garth!

    Justin Gerard and I where working on a tile based strategy game a while back and could use a solution like this. Haven’t had time to work on it recently but here’s what we were working on if you’re interested:

    http://www.portlandstudios.com/tiledemo/ – click the tanks to move

    http://www.portlandstudios.com/tiledemo/MapSlab.html – an attempt to render realistic looking terrain (click to add trees, space > click to add craters)

    We should team up on a game sometime!

  2. Oleg December 22nd, 2009 12:35 pm

    Hi!
    It’s great !
    But I see some mistake.
    When you target MouseOver in PreviewMap (y=-10) marker (rectangle) move up, it`s like in GeneralMap navigation.

    Sorry for my English.

Leave a comment