Fog of war using a Canvas ?

Not favoritedFavorited Favorited 0 favourites
  • 2 posts
From the Asset Store
Cue in the war drums and battle cadences with Total War Game Music Loops!
  • Hello Constructors !

    I'm making an RTS game and I'm working on the FOW (fog of war ).

    Using a Canvas and pasting a sprite on it with "Destination Out" works fine and looks good.

    However, when I resize the window, the canvas is reset and all the discovered areas of the map are black again.

    By searching on the net I've found out that by resizing the window, the event "on resize" will fired, causing a complete reset of the canvas.

    The question: is there any way to prevent this behavior, or at least to save the content of the canvas by the "on resize" event and then load that content again ?

    I'm aware that there are other methods for a fog of war ( for instance, a tiled background ), however, since I find using the canvas pretty straitforward, I would like to follow that path.

    Any help and suggestion would be greatly appreciated.

    Regards,

    Sergio

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • UPDATE:

    I've solved it by setting the canvas property "resolution mode" to "Fixed". This way it won't be reset by resizing the screen and the content will be preserved.

    Reading the manual accurately has helped a lot ;-)

Jump to:
Active Users
There are 0 visitors browsing this topic (0 users and 0 guests)