Open lucde opened 1 year ago
We are creating a background in MapView.cs, method CreateBackground().
If you'd like to modify it, after this line:
var sr = backgroundObject.AddComponent<SpriteRenderer>();
You can do something like:
sr.sortingOrder = 1000;
If the fog of war just covers one side of the map, you could make it move with DOTween when the player moves to the next node. That would be in MapPlayerTracker.cs, method SendPlayerToNode().
thanks for the quick answer ! i ll try that ! So it would be :
Yeah, that's one way of doing this. But... if your fog of war covers one side of the screen entirely, you can create it beforehand and just keep it in the scene, add a reference to it in MapPlayerTracker. When the game starts, you can place it appropriately where the player is. Then you can move it when the player moves. This allows you to skip the step 1 "make the sprite renderer in the Mapview".
that s right. it would be just a bit tricky for the change of the game orientation. like top to bottom, left to right
Yes, but typically people do not include all the orientations into their game. If you won't include multiple orientations, you can just make one version for your orientation and forget about the other ones.
now i just need to make sure that the left side of the mask will always be located just at the right of the first attainable node not depending on the device size/resolution
Hi ! Instead of a fog of war, i will create a cloud sprite on a layer before the nodes so that it hides the locked nodes (nodes that are after the next attainables one or the nodes on other paths). the added sprites would disappear along with the player progress. For that i will need the local coordinates of the generated nodes to add the new sprite layer ? is coding in Mapview script the better way to do that ? I have some hard time understanding where the "local coordinates" of the nodes are stored. Thanks !
edit : I suppose it is here so i could add my sprites on these :
protected void CreateNodes(IEnumerable<Node> nodes)
{
foreach (var node in nodes)
{
var mapNode = CreateMapNode(node);
MapNodes.Add(mapNode);
}
}
protected virtual MapNode CreateMapNode(Node node)
{
var mapNodeObject = Instantiate(nodePrefab, mapParent.transform);
var mapNode = mapNodeObject.GetComponent<MapNode>();
var blueprint = GetBlueprint(node.blueprintName);
mapNode.SetUp(node, blueprint);
mapNode.transform.localPosition = node.position;
return mapNode;
}
Hello ! First of all, thank you for sharing your hard work ! I am not super strong at coding especially in C# ! :) I am tryning to implement a fog of war system that would hide the nodes after the next attainable ones. I already coded something in the mapplayertracker + mapmanager to get the coordinates of the next attaible nodes each time the player moves. So basically i would like my sprite to translate with the player progress. I think that i have to work in the Mapview script to add the sprite. But i don t understand how to modify the generated objects. For example, the background, i tested to make it appear in the front plan but i couldn t with the script. It works when i manually change the layer order during the run, but it is not what i want. If i understand this i think i can create my foreground but right now i can't...
Thanks !