Solarus-Games English Forum

Solarus => Development => Topic started by: Starlock on August 19, 2015, 10:50:25 PM

Title: problem with scrolling to different maps
Post by: Starlock on August 19, 2015, 10:50:25 PM
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.
Title: Re: problem with scrolling to different maps
Post by: Diarandor on August 19, 2015, 11:13:23 PM
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.
Title: Re: problem with scrolling to different maps
Post by: Zeror on August 19, 2015, 11:31:39 PM
I was thinking if you couldn't do something with creating a world and use maps shifting with  location in its world coords.
Title: Re: problem with scrolling to different maps
Post by: Diarandor on August 19, 2015, 11:41:57 PM
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."
Title: Re: problem with scrolling to different maps
Post by: Christopho on August 20, 2015, 10:51:09 AM
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.