silverua / slay-the-spire-map-in-unity

Implementation of the Slay the Spire Map in Unity3d
MIT License
288 stars 68 forks source link

Center Map #5

Closed newcreativegamer closed 4 years ago

newcreativegamer commented 4 years ago

Hi,

Not sure if you wanted to add this as a feature, but I changed a line to allow the map to always be centred on the screen. MapView.cs, line 264. Might be worth adding it in as an option? Anyway, thought I'd send it on!

From: firstParent.transform.localPosition += new Vector3(offset, -bossNode.transform.position.y, 0);

To: firstParent.transform.position = new Vector3(-span/2, -bossNode.transform.position.y, 0);

Thanks, Alan.

silverua commented 4 years ago

Thanks for posting this!

It does work for the case that we discussed in another issue if you want to fit the entire map onto the screen horizontally and not scroll it at all (https://github.com/silverua/slay-the-spire-map-in-unity/issues/4#issuecomment-619378791) but it breaks a couple of things in the original project with scrolling, so I'm not including it just yet.

One thing that I have not done for the scrolling scenario - re-positioning the map to focus on the node where the player is when it loads instead of always starting in a predefined position. Gotta find some time and add this.

newcreativegamer commented 4 years ago

Cool! Looking forward to seeing the next iterations :)