Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[Sugarcube 2] Creating a dymanic map for a game

edited February 2017 in Help! with 2.0
Hello

Twine 2.011 - Sugarcube 2.12.1
I'm helping teachers to create an exploration game about a school in the late XIXth century. A card of the schoolyard is required in that story.
But I had like to make it dynamic : only the parts corresponding to the visited passages should be displayed. Any idea or code snippet for making such a map ?
Thanks a lot for any advice.

Comments

  • edited February 2017
    Is the map a single image or is it composed of multiple images, one for each location/passage?


    If it's the former. You could set up overlays for each location which hide parts of the map image. From there you'd probably want to enable/disable the overlays in a postrender task.

    Alternatively, you could set the image as the background of a <canvas> element and use its API to draw the overlays directly.


    If it's the latter. You could simply do something like the following:
    <<if hasVisited("classroom")>>…classroom image…<<else>>…blank image or equivalent…<</if>>
    
    You'd do that for each location, though you'd need to be careful about whitespace elsewise your overall map will have unsightly gaps.
  • edited February 2017
    Thanks for that tip. I will now try to code it... I think I will try both options, to see wich is the simplest to use.
  • Good luck. Let us know if you have more questions. :smile:
Sign In or Register to comment.