DiegoM's Recent Forum Activity

  • In C3 redo is Ctrl + Y, no other shortcut.

    As far as I am aware Ctrl + Shift + Z to redo is an old convention that used to be popular, but no longer.

    Of course, Windows being old and with impressive retro compatibility, would support it. Newer software, not so much.

    construct.net/en/make-games/manuals/construct-3/interface/keyboard-shortcuts

  • I'd like to point out I haven't forgotten about this feature request. I has come up a few times in the past, but I haven't been able to get to it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • We don't have a method to include the regular icons C3 uses everywhere else in dropdown lists, we can only use text in each item. So in the case of dropdowns I decided to use an emogi, which is the next best thing.

    This is the real emogi 🌍 being used, notice the colour. I found that you can force the rendering of the monochrome variant, which is this one 🌍︎. (You might not be seeing any difference depending on how you are viewing this post)

    The problem with that is that is that it doesn't seem to work in OSX, I imagine it's the same in iOS.

    Windows shows the monochrome variant, so it's something.

    I'll have to try generating the emogi in a different way, maybe OSX and iOS only show it in a very specific way.

  • Use the Browser plugin.

    The QueryString expression returns the whole query string and the QueryParam expression can return the value of a given parameter in the query string.

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

  • Try placing an image point in the opposite end of the sprite you are using as a line, and then use that position to place the following line.

  • Currently the MoveTo behaviour does not support curved paths.

  • Browsers block cross origin requests by default. So unless your game is hosted in the same domain as the API, any requests will be blocked. The easiest thing to do is add this header in the response the server gives for the resource.

    Access-Control-Allow-Origin: *
    

    That will let the client know that the server is allowing requests from ANY origin.

    If you want to be more specific, you can use the URL of the domain your game is hosted in.

    For example:

    Access-Control-Allow-Origin: https://my.game
    

    Using a URL instead of a * means that the server only allows request from that URL.

    developer.mozilla.org/en-US/docs/Web/HTTP/CORS

  • Have you tried requesting your data from your database as it exists now and then arrange it in the client as you need it? It looks like the example is doing pretty much what you described, all you need to do now is fill in the array with your own data.

    Instead of using the Load action to fill up the array from a file, you can use the Set XY action of an array to tell in which coordinates each value should go.

    To follow the format of the example dop2000 gave, you would use 3 actions to set all the values for each player.

    Set XY (0, 0, 1900)

    Set XY (0, 1, "Sam")

    Set XY (0, 2, 1)

    Those actions will set all the values in the first column...

    Set XY (1, 0, 120)

    Set XY (1, 1, "Pete")

    Set XY (1, 2, 2)

    Those actions will set all the values in the second column... and so on.

    Once the array has been filled up, the rest of the example should work just fine.

  • If you have any browser extensions, try disabling them one at a time and reload your project each time. Occasionally extensions can cause problems.

  • 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.

  • 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.

DiegoM's avatar

DiegoM

Member since 24 Apr, 2015

Twitter
DiegoM has 1,380,404 followers

Trophy Case

  • 9-Year Club
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies

Blogs