Change Image From Url on a different Layout

0 favourites
  • 9 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • Hello Guys,

    in my loading screen, I load the data of a Player. After that I want to change Sprites wit LoadImageFromUrl. This Sprites are on a different Layout and cause of that I cant change them....

    Changing Images on the same Layout is no problem.

    I could load them on the right Layout but this is not what I want. I want that the Player loads one time his data and his items.

    Because many Objects have over 20 styles it is also not nice to give them a animation frame and set the step to his style.

    Is there any way to do that ?

    Thanks ;)

  • Yes, I had a similar delima recently. What I did was create a dictionary to store the values that I wanted set in the other layouts. The dictionary content also became the foundation of my save system. JSON is pretty simple to understand.

    1. Create a dictionary object (this is a global object)

    2. Create what I call a "validate button"

    -Create text box called validate

    -Create event "On left click of object 'textbox validate' download DictionaryasJSON AND set textbox value to DictionaryasJSON

    3. Launch your game and click on the 'validate' object and download the JSON file. This will provide you with a template for adding values by hand instead of having to push them all initially.

    4. Find the JSON file and put in all your keys and values (you will need to set it to open with notepad)

    5. Save the JSON notepad text file and in construct2 right click on the "Files" folder on the project list typically on the right hand side and select "Import files" then select the JSON file you just modified. (from now on you can doubleclick the JSON file in the project to modify it and blow the other one away.

    6. Set your "on layout load" to set the dictionary to the contents of the JSON file (this is to initially populate it, these values will remain as long as the game is running as it is stored in RAM)

    7. Now you can use the Dictionary Set key and Dictionary.Get to call upon values like to set and start the name of an animation stored in it.

    Let me know if I need to be a little more clear and I will capx it for you.

  • Wow that?s much big thanks, a capx would be amazing.

    I think I got it, but my problem is that the user need to load on every Layout again some seconds the right images, and that is not what I want. I want that he just needs to download all the files once.

  • Push question ist still open

  • Really nobody got this problem before ?

  • Last Push, if no one answers I surrender and let the users load on every single layout.

  • I will put a capx together

    will take me a little while to strip it down so that only this function exists

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok here is the capx I put together showing Dictionaries and JSON:

    The dictionary can be used to store the names of animation names as a globally accessed value.

    Hope this helps

  • Thanks for this awesome .capx, but I have a different problem. I need to load on Layout 1 all images, this means also custoum player specific images that are placed on e.g Layout 7. With your .capx I can load the ImageUrls and load the Images, than the player is on Layout 7. But this also means he needs to wait again some seconds to load the right files.

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