How do I get my game to remember an image change?

0 favourites
  • 13 posts
From the Asset Store
Try to remember the sequence of moving pumpkins. Reproduce it according to your memory.
  • In my game the user is able to change the look of a sprite by uploading an image using the filechooser object.

    I was wondering if there was a way of saving this change so that the next time the user runs the game the sprite keeps it's new appearance?

    I've tried the save game action but that doesn't seem to work?

    Many thanks,

    Matt

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Still struggling with this, does anyone have any ideas?

  • I think you need to use local storage, Matt. It should be relatively easy to do. Let us know how it goes! Btw, are you from Texas? I have a friend names Matt Daly. :)

  • Thanks for the suggestion, I have made an attempt at getting this to work using local storage but am still having no luck

    Please see this download link for my attempt:

    https://www.dropbox.com/s/a8zexej38kcdss7/Permanent_image_change.c3p?dl=0

    If anyone would be willing to take a look and point me in the right direction I'd really appreciate it!

    No i'm not from Texas, I'm from Manchester UK. Your friend must be an impostor!

  • :)

    It has been a while since I poked around with local storage, but I remember that you have to check to see if locally stored variables exist before you try to read and write those variables.

    This tutorial was very helpful:

    javajdk.net/tutorial/localstorage-in-construct-2

    This event sheet diagram is from that article:

    As the author of that tutorial explains:

    "The key to understanding this event sheet is that Construct 2 LocalStorage is asynchronous. Every LocalStorage action has a matching event that you can use as a condition. Every request to LocalStorage generates an event rather than giving you an answer right away. Remember LocalStorage always says, “I’ll get back to you.” It never gives you something exactly when you ask for it, though it is typically so fast your users won’t notice the difference."

    I struggled with other local storage tutorials but something about this person's explanations made sense to me.

    Best of luck. Please let us know if you solve the problem, Matt from Manchester!

  • Thanks again for taking the time to help with this...

    I've worked through the tutorial and feel I have a better understanding of local storage now. Thing is, am I right in thinking that local storage can only store numbers or strings? Will it work for storing an image file too? That's what I need...

    Matt

  • Sorry to keep banging on about this but I still haven't found a solution :(

    Over on the Construct 2 forum (where I wrongly posted this topic to begin with) dop2000 kindly suggested:

    You can use two Pode's addons - ExtractImage and InjectImage, download them here:

    github.com/Pseudopode/construct2_plugins_behaviors

    Extract image from sprite as Base64 string, save it to local storage. Next time you need it - get it from local storage and inject into the sprite."

    Is there a similar plugin that would work for Construct 3 that anyone could recommend?

    Many thanks,

    Matt

  • Can I bump this topic again?

    To clarify, I want the user to be able to change the appearance of a sprite by uploading an image file saved on their device and for this change to be saved so that the next time they play the game, the image change is retained.

    Many thanks,

    Matt

  • Apologies for bringing this up again!

    I still cannot figure this out, is it even possible?

    Sadly without this function i'm going to have to give up on my project :(

    If someone would be able to devote any time to solving this problem I would be extremely grateful. If necessary, I'd be willing to reimburse someone for their time spent figuring this out.

    Many thanks,

    Matt

  • If I understand well, you are trying to save an image in order to get when the user get back right?

    Then, load the image into a sprite, then you should convert the image into a string, save the string in a local save storage or in a server, and then, retrieve the image from the string when you need it.

    I remembered that there is a plugin for it (looks like this plugin is for C2, maybe someone else did it for C3, you have to look)

    construct.net/en/forum/extending-construct-2/addons-29/behavior-extract-sprite-to-bas-46034

    Another way to do it using PHP:

    construct.net/en/forum/construct-2/how-do-i-18/save-snapshot-on-server-70172

  • Thank you Ribis for looking at this for me.

    I've tried to find a plugin for C3 that will extract an image into base64 format but don't think one has been created yet.

    Think I may recreate the project in C2 so that I can use the plugin you have referenced...

    Thanks again,

    Matt

  • I've tried to find a plugin for C3 that will extract an image into base64 format but don't think one has been created yet.

    Matt

    maybe it works

    https://drive.google.com/file/d/1XjNObMYl-fHmO4pZYM9cYCIdMROAEQ9S/view

  • Hey Eren, I've just done a little test using your plugin and it seems to work great!

    Thank you so much for sharing it, I'm looking forward to adding this to my project.

    Matt

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