Magistross's Recent Forum Activity

  • blackhornet However, he'll need a group of events per weapon type, and that's what he wanted to avoid with his function.

  • Maybe you could use a Dictionary along with the ship in a container (or if the ship is a unique instance, just a plain Dictionary).

    On collision with PowUpSpeed

    --- Call "WeaponLeveling" ("Speed")

    On function "WeaponLeveling"

    \_Dictionary Key Function.Param(0) & "XP" >= 100

    ---Set Dictionary Key Function.Param(0) & "XP" to Dictionary.Get(Function.Param(0) & "XP") - 100

    ---Set Dictionary Key Function.Param(0) & "Level" to Dictionary.Get(Function.Param(0) & "Level") + 1

    ...

    etc.

    That would simulate reference passing, and most likely work as you intended.

  • Tried encasing the Array.At() in int() functions ? Maybe that'll force the calculation on numbers.

  • I still can't grasp exactly your need. A function that check neighboring cells and return its "type" is dead easy to do, but obviously you want more. Maybe you could draw another diagram?

  • It's still tough to determine what you want exactly. Care to elaborate a bit more ?

  • It seems I misread his need, I stopped at the first sentence, while what he wants is to remove duplicate "words" from a string as explained further. It's definitely not the same thing. I fear using a single RegexReplace won't quite cut it. What could work is to use "lookaround" to create a match if a word doesn't appear more than once. Then you can concatenate all matches in a loop.

    Since Javascript only support lookahead, it will have the drawback of losing the original order in which words appear, only the last occurrence of a word will create a match. Only the first occurrence would have been matched if lookbehind was supported... that's too bad if original order is needed. For the sake of showcasing the power of Regex, here's how to do it :

    Matching pattern : (\b\w+\b)(?!.*\b\1\b)

    Flags : g

    capx

  • Since OP asked for a Regex, here's how to do it :

    Matching pattern : (?:(\w)(?:\1)*)

    Flags : g

    Substitution pattern : $1

    See the witchcraft in action in this capx.

    Note that the (\w) in the matching pattern can be changed to something else to accommodate for accentuated letters and other symbols. Replacing it by (.) will ensure that any character can only be found once consecutively, except for the newline character. (You'd have to use ([\s\S]) to include it.)

  • I changed the logic a bit, is it more like how you want this to be ?

    https://dl.dropboxusercontent.com/u/700 ... Timer.capx

  • How is your terrain data represented, is it an array, or a tilemap ?

  • Off the top of my head I'd say that you should create a function a receive a point (x,y), and it returns the state of that particular tile in the array. If tile is empty, and have obstacles to the left, top and right, then return 1... do so for all your combination, and then use that function whenever you need to test a particular tile.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I had a go at it. You indeed need a For Each (ordered) but only for picking the Object2 with the minimal Y coordinate.

    Objects stop flashing if the overlap cease to be, dunno if it's what you wanted but it made more sense to me that way !

    https://dl.dropboxusercontent.com/u/700 ... Timer.capx

  • striimix I believe that the tilemap would still be best especially if all tiles are the same, fewer draw calls would be issued. We should probably do a comparative test just to see if any difference would be noticeable.

    edit: Just did it, I can't profile on my current computer since I'm at work and don't have a license there... <img src="{SMILIES_PATH}/icon_redface.gif" alt=":oops:" title="Embarrassed"> but it does seem to run with a steadier and higher FPS. If anything, it's far less convoluted event-wise and much more easier to edit the level design with a tilemap !

    https://dl.dropboxusercontent.com/u/700 ... lemap.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