[help]Can CanvasSnapshot save using localStorage?

0 favourites
  • 5 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • there comes with a issue about the CanvasSnapshot,

    e.g.

    first test:

    -on the start of layout -- system take snapshot of canvas

    -- LoacalStorage set item "snapshot" to CanvasSnapshot

    //-- wait 0 second

    -- check "snapshot" exists

    -on " sanpshot" exists -- text set text"Snapshot exists"

    -- sprite load image from LocalStorage.ItemValue

    then, text shows "Snapshot exists", but sprite load nothing...

    another way the same step:

    -on the start of layout -- system take snapshot of canvas

    -- LoacalStorage set item "snapshot" to CanvasSnapshot

    //-- wait 0 second

    -- check "snapshot" exists

    -on " sanpshot" exists -- text set text"Snapshot exists"

    -- sprite load image from CanvasSnapshot

    then, text shows "Snapshot exists", and sprite load the CanvasSnapshot

    so does the localstorage cannot save the CanvasSnapshot?

    how can i take the CanvasSnapshot then save it or load it?

    looking forward to your replies, thanks!

  • don't wait in the same event to check for item exists, it'll probably take more than 1 tick.

    Add another event,

    • localstorage - On Item Set "snapshot"

    text set text"Snapshot exists"

    -- sprite load image from LocalStorage.ItemValue

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • don't wait in the same event to check for item exists, it'll probably take more than 1 tick.

    Add another event,

    - localstorage - On Item Set "snapshot"

    text set text"Snapshot exists"

    -- sprite load image from LocalStorage.ItemValue

    thanks your reply,

    i had been commented the "wait event",

    and i add your advised events but doesn't work...

  • Here try this

    http://headbangames.com/localstorage.capx

    OMG, i forgot the condition event " on canvas snapshot " and set localstorage value directly.

    now it works!

    thanks a lot !!!

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