R0J0hound's Recent Forum Activity

  • I’d say the more common use case is for the push out actions to work successfully no matter what. Being able to specify a give up distance seems to needlessly make things more complex. And really if I wanted to do that I’d rather do it manually from the starting position and the pushed out position.

    That said, I stopped using the push out actions after finding they weren’t as accurate as I would have liked. Construct likely leans on its very good collision detection functions, but probably does some kind of repeated move and overlap check. So limiting the distance sounds like a way to limit huge loops. Just a guess though.

    There are other good solutions for resolving collisions though. A common one is utilizing overlap checks and iteratively moving stuff. If you treat the object you’re pushing out as a circle you can utilize sdfs. Then there’s SAT, GJK, or MPR if you want more deluxe solutions.

  • Post how you’re doing it now and maybe someone can spot what’s amiss.

    Generally the logic would be, request the file with Ajax, use tokenat to get a word at a time, then you could compare the length of the word before adding it to a dictionary.

    Var data=“”
    Var word=“”
    
    Start of layout
    — Ajax: request file “dictionary.txt”
    
    Ajax: on request complete
    — set data to Ajax.lastdata
    — repeat tokencount(data, newline) times
    — — set word to tokenat(data, loopindex, newline)
    — — compare: len(word) <= 7
    — — — dictionary: add key word

    For thousands of words this will be slow but at least it’s only done once. You could then save the dictionary.asJson and just load that so you don’t have to parse the file every time. Or if it’s essential to just parse fast, don’t use tokenat, use find and mid instead.

  • There’s a system condition “pick overlapping point” that will do that. Or depending on the shape there may be a simple algorithm to check.

  • Here's my last idea. Useful for any number of variables.

    dropbox.com/scl/fi/60yypcux55y0cy0edb0ws/highestVar_randInstWhenTied.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Doesn’t seem to draw anything on safari iOS but the math looks fine.

    You don’t have to convert to radians because construct uses degrees and not radians for the trig functions.

    I see you are ensuring the angle values are in the 0-360 range. That’s only needed for displaying the angles, the math will work the same without it.

    You probably don’t have to find the min and max noise value every time. I’d run it once, write down those values and just input those in the variables. That would at least remove the startup pause.

    You can probably combine steps together to use less events if you wanted too.

  • Yeah I’d do something like your first example and I’d refactor it as I go. Any abstractions would come organically as they made sense to simplify things. Basically I figure it out as I go.

    The second example is less readable to me.

  • No. Events aren’t actually converted into JavaScript. They are converted into data that the construct runtime runs and keeps track of picking and all the other nuances of the event system.

  • In my experience most elegant and readable is less abstractions for me. A tree of conditions and some variables should be enough. But we all have our own styles of what we consider elegant code.

  • Hmm well the meat of it is to compare what was typed so far with the command.

    text = left(command, len(left))

    If that's true that could be shown as a guess.

    I don't want to deal with form objects or js so here's a way to do it with the keyboard and text object.

    dropbox.com/scl/fi/13ai14e9r80zmv1qdm2j2/rough_autocomplete.capx

    Probably can do it with a textbox too. Just replace the text objects with textboxes. Then do some CSS to make the main editbox have a transparent background so you can see the guess underneath.

    Probably could do better with parsing the commands for syntax errors and giving more advanced autocomplete per token.

  • Spine, Spriter and dragonbones? No editor in C2 (that's not really possible) but you can load stuff in that was created with those tools.

  • Plugin development is anarchy. I don't think there is any set opinion how it should be done. Even vanilla features don't adhere to a set standard. Things were just added and improved over time. So in the end you can just do things however you like I say.

  • Apart from using it with the ?: operator, I’ve used = for stuff like this:

    Say you want to convert a small list of color names to a color values you could do:

    rgba(100*(color="red"), 100*(color="green"), 100*(color="blue"), 100)

    Or if you happened to want to handle different colors or more of them:

    chooseIndex((color="red")*1+ (color="green")*2+ (color="blue")*3, rgba(0,0,0,100), rgba(100,0,0,100), rgba(0,100,0,100),rgba(0,0,100,100))

    Granted there are better ways if you wanted to handle lots of color names but this is handy and simpler for a few.