R0J0hound's Recent Forum Activity

  • Cape/cloth physics is much like rope physics. Basically it’s made of a bunch of point that have velocity and fall with gravity. Then you keep track of the distances between pairs of points, and move them closer toward each other if they are too far away.

    Anyways one way is to use the physics behavior and connect them together with joints.

    Another is to use event based physics. Look up rope or cloth physics for examples.

    In c2 you have a third party plugin like paster to distort the image. Or you can just fake it with sprites.

    As far as the simulation itself you’ll just have to tune parameters. Maybe more air resistance or less gravity. A more elaborate sim might do the physics in 3D, or limit not only the distance between points but the bending angle. Also another idea is to make the air drag depend on the angle of the parts of the cape, probably a lift/drag model like planes use. Finally adding collisions with the player or with other parts of the cloth itself could look cool. It just depends how deep you want to go.

  • A lot of browsers have an option to disable webgl2 so you can utilize that for easy testing on your system.

    To make the export use just webgl1 you can edit the runtime after exporting. Just look for .getContext(“webgl2”) and remove the 2.

  • Yea, I’m pretty sure that was where the NaNs come from.

    Glad the idea works

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • With 3D the mouse plugin and probably touch will give you a point on the 3D ground plane. This isn’t always useful though.

    Typically you’d want to add a 2d layer and grab the mouse/touch from that so you get standard 2d values.

  • It’s system->compare two values

    With loopindex as the first value and 1 as the second.

  • I’ve found wait 0 is more like, run at the end of the event sheet.

    You can test that with something like:

    Var prev=0
    Every tick
    — set prev to tickcount
    — wait 0
    — subtract tickcount from prev
    
    Compare: prev =0
    — set text to “same tick”
    Else
    — set text to “another tick”

    And yes, wait should pass the selected object list to when it’s done.

  • Interesting. So the on timer event is more a fake trigger since it picks all the done triggers at once. I think I’ve seen that before but honestly I seldom use that behavior.

    Anyways, the on timer and on game pad press are more exemptions to the rule than consistent with what most other things do.

    I guess the manual could be more explicit about it but I’d wager it’s more an oversight than anything.

    I think I found out about those things with some tests when helping someone debug something that wasn’t working correctly. It’s mostly a subtlety that’s not always an issue.

  • Besides using browser.log() you can use sprite.pickedcount to see how many objects are picked.

    In general I assume most triggers just have the one relevant object picked at a time. “On created” for example will be run for each object you created. So no for each needed in triggers.

    Ultimately the plugin/behavior could be made to pick multiple instances at once but I can’t think of any examples. Are there any that don’t stick to the standard?

    Triggers are like functions, they will be jumped to. But there is something called a fake trigger that’s used sometimes that looks like a trigger but is run in place.

    “Keyboard: On key pressed” is a trigger.

    “Gamepad: on button pressed” is a fake trigger, which is the same as:

    Game pad: button down

    Trigger once.

  • If the tile size is 32x32 you can do it with the following. Basically the horizontal distance plus the vertical one. It’s called Manhattan distance after the city.

    int(abs(Player.x-goal.x)/32)+int(abs(player.y-goal.y)/32)

  • For the view, you just need to change the 3D camera angle. But if I pick this up again at a later date it can be made to have a different sloped ground and direction of gravity to make change the view of the dice.

    To have two dice? Hmm... right now it’s not very modular. One way would be to clone all the object types and make the cloned instance have the same values in the instance variables. Then duplicating all the events and using the replace object feature to make the duplicated events use the cloned objects.

    Even then the two dice won’t interact with each other without further collision code.

    In general I just need to revisit this eventually and make it more modular.

  • Nice to know C3 added that expression to the keyboard.

    Looking at my example again it can be simplified a bit by replacing:

    int(tokenat(widths, Function.Call("find",c),","))

    with:

    SpriteFont.CharacterWidth(c)

    I completely missed that. Will update the example shortly.

    Edit:

    example updated.

  • I skimmed that blog article. It certainly in an in depth list, but most of what we are doing here is just enough to do what we want. We aren't intending to make a comprehensive editbox.

    dop2000

    I like that example. Very console like. I noticed you have the same issue as I got where you can't type a "?". Anyways, the solution I came up with was to add an event listener in js that calls a construct function with "e.key" which is what key was typed taking into account shift and capslock. At least in C2 the keyboard object wasn't enough to get that.

    document.addEventListener('keydown', (e)=>{c2_callFunction('keyDown',[e.key]);});

    Here are some tests. The first hides the textbox by setting the css opacity to 0, and draws the text with the text object.

    dropbox.com/s/5xygyt0uo5zyz96/hidden_input_form.capx

    Here's another test that uses spritefonts with variable widths. It supports single line text and lets you type with any character in the spritefont. Clicking sets the cursor position and you can remove charters with delete and backspace.

    dropbox.com/s/4vww2hr0an2cdws/spritefont_input.capx

    Taking the idea further to support highlighting, ctrl moving between words, copy/paste, double click selecting words, and multi lines just require a bit more work but seems possible.

    Issues i encountered were the needing to get the keyboard input with js as mentioned above, and find() was case-insensitive, so I had to make a case sensitive one with a function.

    Here's how the spritefont was generated:

    construct.net/en/forum/game-development/tools-and-resources-27/spritefont-generator-168408