Magistross's Recent Forum Activity

  • I don't understand your gripes with how Construct handles this. If you delete an index on an axis, the remaining elements are automatically shifted on that particular axis...

  • I went ahead and changed the method to use RegEx instead of tokenization. It now works with nested data too. You'll notice I changed how the function is called, I now supply the input and one or more keys for the data to fetch. You can fetch "name" with a call like parse(input, "name") and it'll give you the data at the first occurence of the key "name", whatever its level of nesting... Or, you can call parse(input, "playerData", "name") and it'll give you the "name" of the first occurence of "playerData" in your input string.

    Here is the file.

  • From a pure parsing point of view you could use something like this. If C2 could use matching groups with regex, it would fall to only one line of code, but anyhow, this should do !

  • RamPackWobble The for each blue sprite on line 2 runs exactly ten times, once for each iteration of the outer loop. The picked instances list after a "Create object" get limited to that particular instance, so the blue sprite already on the layout never get picked for line 2.

    t4u What I meant is if you create multiple objects in a single event and you want to iterate through them afterwards, you're better off duplicating the creation event and doing the iteration on this one. It's hard to explain, so here's a picture. The "creation event" is a simple "start of layout" in this case.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You have 3 arrays, the one already on the layout, and the two newly created. As to why your variable equals 1, it's simple : Iteration only occurs on objects that are available on the top level condition. So using RamPackWobble suggestion should do the trick !

  • Plain is good enough, no need to encapsulate anything in an object. As you said, tokenizing make it so easy !

  • Your best bet is by tokenizing your data into a single string, then loop for each token to add elements to the list.

  • You can still reference arrays as you would reference objects. So depending on your need, you could "pass" an array to a function by using its UID.

    edit : Here's an example where it creates 10 randomized arrays at start, then permits you to get the sum of one of them using a function and a UID parameter.

  • Or just add another condition that goes like "Animation dead is not playing".

  • Although not recommanded, you could also use the Browser object ExecJS expression, but I guess it's okay for test games !

    Set color to Browser.ExecJS("parseInt('" & someHexValue & "', 16);")

    You can also wrap this in a function, like aruche did with his method.

    Anyhow, it seems that an official way of parsing hex values is lacking, and could be suggestion for a future feature ! <img src="smileys/smiley2.gif" border="0" align="middle" />

  • It's an iteration on the X axis only. So for each X (or monster in our case), check if its level (y = 1) is equal to the first function parameter (desired level). If it is, I add the current index to the list of candidates.

    I could have done a normal for loop, but since the array was set in such a manner, using the built in for each X axis was easier at that time.

  • I completed ArcadEd example with another function to retrieve the index of a random monster of the wanted level.

    You can then store that index in a local variable to get all the info you want on that monster !

    https://dl.dropboxusercontent.com/u/7004246/pickArray.capx

Magistross's avatar

Magistross

Member since 4 Jul, 2011

Twitter
Magistross has 14 followers

Trophy Case

  • 13-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies