R0J0hound's Recent Forum Activity

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

    Glad the idea works

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I agree with dop, there are pros and cons to making your own text input vs just using the editbox.

    To me, editboxes work well but you are limited how it can look, even with css. Making your own can go from fairly simple like dop’s example to trying to reproduce everything. Clipboard access is the tricky part in js.

    Another idea is to hide the editbox by setting the style opacity to 0. That would let you interact with the editbox but let you draw it as you wish. It’s just fiddly to make them match.

    As long as it works it should be fine. I’ve seem lots of games and software that don’t just use a normal os editbox and it’s seldom an annoyance.

  • The “trigger once” is throwing it off. Basically they all need to not be frame 1 before the event can run again.

    I’d do the logic under a “on frame changed” condition.