Author Topic: problem with scrolling to different maps  (Read 2502 times)

Starlock

  • Full Member
  • ***
  • Posts: 113
    • View Profile
problem with scrolling to different maps
« 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.

Diarandor

  • Hero Member
  • *****
  • Posts: 1061
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: problem with scrolling to different maps
« Reply #1 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.
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Zeror

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
Re: problem with scrolling to different maps
« Reply #2 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.

Diarandor

  • Hero Member
  • *****
  • Posts: 1061
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: problem with scrolling to different maps
« Reply #3 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."
“If you make people think they're thinking, they'll love you. But if you really make them think, they'll hate you.”

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1185
    • View Profile
Re: problem with scrolling to different maps
« Reply #4 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.