DiegoM's Forum Posts

  • This is an easy to understand way of doing it.

    1) Create another array were you are going to do some temporary work.

    2) Load your real array into the temporary one using the Load action and the AsJSON expression

    3) Sort the temporary array using the Sort action. This sorts the values in ascending order.

    4) Now the first element of the temporary array is the one closest to 0, so search for the first element of the temporary array in the real array using the IndexOf action.

    That should get you the index of the lowest value in the real array.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think in this case the solution was a little bit strange because the problem was not what you usually use JSON for, which is getting the values for the keys you know about.

    The plugin is setup to easily access values rather than keys.

  • Fireche

    You are running into a subtlety.

    CurrentKey

    In a For each loop, a string of the current key name. If an array is being looped, the current key is a string of the current index, e.g. "0", "1"...

    Since your data is in an array, CurrentKey will have indexes to the array. What you need to do then is load what is at that path in the json into another JSON plugin instance and then loop through that. Because the new loop in on a json object, CurrentKey will have the key names as strings.

    dropbox.com/s/3zzdt1yjk9riwwr/ReadingJSON.c3p

    The example does just that. The only thing which is rather cryptic is the path you need to give to GetAsCompactString to extract a single item from the json array.

    For this example JSON, doing JSON.GetAsCompactString("array.0") gets you the first item as a string, which you can load into another JSON object using the Parse action.

    	{
    		"array": [
    			{"foo": "1"},
    			{"bar": "2"}
    		]
    	}
    

    An extra detail I noticed while puting the example together, it seems the path you need to give to GetAsCompactString has to be absolute.

  • I am not very familiar with the inner workings of the video plugin, so I can't say for sure. It seems that setting the playback time to seek to that position and then pausing the video in the same action so the video stays there... doesn't do what I would expect.

    It might be a limitation or maybe it's just a bug that can be fixed, I'll ask Ashley about it.

  • dropbox.com/s/nltil8lv1qck1ka/RecordVideoSprite.c3p

    I changed a couple of small things, and I think it is working how you want it to.

    The first was rounding the value of PlaybackTime to two decimal places, using roundToDp. This is to make sure to save values that will be able to be found out later on. PlaybackTime is not really guaranteed to always hit the same values each time you play the video.

    The second thing was to add a check before setting the position of the dot, so that it only changes, if something was found for the recorded playback time.

    construct.net/en/make-games/manuals/construct-3/plugin-reference/array

    IndexOf always return -1 if nothing was found.

  • I see, at the moment you can only use a timeline to control the position, size and opacity of a video instance. There is still no way to preview the contents of the video in the editor, using timelines or otherwise.

    We will consider this feature for the future.

  • That feature does not exist.

    Do you mean something like the audio tracks, but for video instead?

  • Please file an issue in our tracker, following the guidelines.

    github.com/Scirra/Construct-3-bugs/issues

    In this case the most important thing would be attaching an example project demonstrating the problem. I tried doing what you described myself in a new project, and it looks like it works as expected, so I am thinking there is something particular about your project which is not obvious.

    If you can't reproduce the problem in a minimal project and don't mind sharing your project, including it in your issue is the next best thing.

    If for some reason you can't share it on our public tracker, then you can send your project to me at diegozlr@construct.net and I will take a look.

  • Sounds like something C3 could handle no problem.

    A 50 x 50 pixels image at 32 bit depth should be around 10 Kilobytes (just tried it by creating one in Windows), which isn't a lot. 500 images of 10 kilobytes would be 5000 kilobytes, which is 5 megabytes, which is still a very small amount of memory.

    The total amount of memory taken shouldn't be a problem at all, as for the rendering...

    If you create an animation with 500 different frames, C3 ends up packing everything together into as few textures as possible.

    Just tried out doing that in the editor to see what would be generated, I created an animation with 500 frames, then right clicked on the project folder in the Project bar and selected Tool > View sprite sheets. C3 ends up creating 8 textures of 2048 x 2048 which will take up 32 megabytes in RAM, which isn't a lot.

    Since all the instances will be of the same object type, it means they will all use the same textures for rendering, so no memory overhead there. All the instances will use the same 32 megabytes of loaded image memory.

    Finally, 75 instances will not be a problem at all.

  • In the next beta cycle, a globe icon similar to this 🌍︎ will be used to denote global layers and overridden ones, instead of text.

    There will also be a new context menu option added in the Layers Bar to open the layout which holds an original global layer by right clicking on an overridden one.

  • Make sure you have given C3 permission to use the system clipboard

    support.google.com/chrome/answer/114662

    Under construct.net look for editor.construct.net and in there for the value of Clipboard

  • pikawilliam11

    I too thought that this might be related to Opera GX, so I tried it out... and didn't see any crash. So it might be something very specific to your setup.

    Also, when you take into account that Opera GX is built on Chromium, the open source project which also powers Chrome... it's even less likely that there could be a bug that happens in Opera GX but not in Chrome, because they are essentially the same browser with a different coat of paint.

    None of this is particularly helpful, but I thought to point it out.

  • I have heard from people that the ability to play audio from a timeline is reasonably in sync, but I don't know exactly how the feature is being used.

    Truth is that relying on the timeline play head and the audio that is playing to be in sync is not adviced, if you are looking for high accuracy that is. This is because the timeline basically just acts as a trigger to start playing a sound, after that the audio and the timeline continue doing their own thing separately and parity is not guaranteed.

    The audio tracks serve more as a visual aid to better control when audio will be triggered and as a general guidance on to how long the audio will be playing for, relative to the total timeline time.

    Having said that, you can run your own small tests with the feature and see if it will work for you.

  • The start page received a significant overhaul at the start of 2022.

    All of the example projects can now be found in the example browser which you can find by either clicking on the Browse Examples button in the Start page or through the main menu Menu -> View -> Example Browser