problem with scrolling to different maps

Started by Starlock, August 19, 2015, 10:50:25 PM

Previous topic - Next topic
I'm trying to have the player be able to scroll between different maps but on one map it works fine but on the other the character wont appear going one way and appears on the wrong map the other way.

      ------------
     |       |        |
     |  1   |    3  |
     |       |------|
     |       |    2   |
      ------------

When going from 3 to 1 or 1 to 3 it works fine but when going from 2 to 1 the character appears at the top of 1 instead of near the middle/bottom and when going from 1 to 2 the player wont even appear. I've tried changing locations but it doesnt seem to be doing any good.

I suppose you have chosen "side of the map" as the destination, in the map editor. If you use this type of destination with maps of different size, you may get problems like this. (In your case, the engine is sending the hero to a point with the same y-coordinate, which is measured from the top of the map, of the new map.)

To do what you want, you can either send the hero to a destination entity (place it where you want the hero to appear and choose it instead of "side of the map" in the editor), or use separator entities in a big map that contains the three rooms.
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

I was thinking if you couldn't do something with creating a world and use maps shifting with  location in its world coords.

It should be possible. Check this,
http://www.solarus-games.org/doc/latest/lua_api_map.html#lua_api_map_get_location
where it says "The engine uses this information to implement scrolling between two adjacent maps."
"If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you."

Yes, setting the appropriate location of each map is the solution here. The y coordinate of map 2 should be equal to the height of map 3.