R0J0hound's Forum Posts

  • The object property gives an id, and you can use one of the runtime methods to get the object class from the id. Object class is just the base of object type so you should be able to use the methods of either. From the object type you can use get image to get an animation interface where you can get the texture.

    This is based on looking through the sdk docs.

  • Probably the best way to debug it is to be very verbose about displaying the raw text every step of the way. Aka line by line, text before replace, text after replace, and the regex expression used.

    The issue is bbcodes and regex both have special character combinations and you have to be careful. Even posting about it on the forum is problematic since it uses a form of bbcode too.

    If it becomes too unwieldy using regex you could utilize your parser you’re using to assemble the text maybe?

    Anyways, good luck

  • I didn't notice it in the docs about bbcodes. But if you use

    \.[.

    it will give you a [ character and it won't become a bbcode. Example:

    [color=red]red[/color] Text is done with [color=red]red[/color]

    edit:

    Bbcodes get messed up on the form, so here's a screenshot of what i meant:

  • Well, if you modify that js snippet to add the event listener to the document instead of a textInput control then it will keep the tab key from jumping around the browser window.

    This is what I mean by what I said about letting you type with the tab key in a spritefont.

    dropbox.com/scl/fi/1392o042wut3fuzj6vik5/SpritefontTextInput.c3p

  • Ah. Well if you’re just getting the key pressed from the keyboard object you can forget about that JavaScript.

    Just add a tab character to the spritefont, set its width, and you’re good to go. You’ll probably have to type tab in something like notepad and copy/paste it over unless construct supports escaped characters like \t.

  • That’s an issue if you want to use [] and bbcode.

    You could utilize the bbcode for icons. Basically draw or copy the bracket graphics to a sprite and, and replace [] with [icon=0] and [icon=1]. That’s the simplest way I’d try.

    Second would be to maybe figuring out how to do it with html. Off hand it would just be a bunch of referencing developer docs.

    Placing the same text, just colored, over other text could work but in practice it’s a bit tricky depending on how you render text. For the text object and one line of text you can use the Text.TextWidth() expression to get the offset to place text after. Basically you’d split the line into three parts. The text before highlighting, the highlighted text, and the text after. The main complexity is textwidth won’t be updated till the text is drawn so you’ll have to wait a tick before positioning stuff. Also if there is any word wrapping things will be off.

    Spritefont is a bit better since you can get the width of individual characters without waiting a tick, but word warping is still an issue.

    Beyond that you could do text a character at a time and handle the word warping directly so you have full control of the positions and look of each character. The downside is it’s a slower with the loops and

    Instances per character.

  • With the text input object hitting tab jumps between edit controls. You’ll need a bit of JavaScript to change that.

    Give the textInput object an id of “edit” in the properties bar. Then run a script like this once to change it so that so tab does nothing.

    document.getElementById("edit").addEventListener("keydown", (e)=>{if(e.key=="Tab"){e.preventDefault()}});

    From that you can make it do something else such as place four spaces or something. The easiest way would be to call a c3 function from that js to do the text modification there. Construct’s docs have how to do that.

  • To fix use the physics behavior’s set stepping mode action to set it to frame rate independent. Then physics will run the same speed at 60fps or 144fps.

    The only benefit of the fixed stepping mode is the simulation is more consistent but the value is lost on any fps besides 60.

  • Oh, I think I see what’s up. Do you have three instances of TextM… ? I can’t see what the rest of the name is.

    Anyways when you set the text of the text object the action is run for all the picked instances. So if you have three instances the function would end up being called three times.

    As a minimal example of this, add a text object and add three instances of it, then add a second text object (text2) to display the result.

    Then with these events you’ll get text2=“testtesttest” much like in your project.

    Start of layout
    — Text: set text to function.parse()
    
    On function parse
    — text2: append “test” to text

    Hope that helps.

  • You showed what it does but not what the function looks like. That would make it so others can possibly spot what’s amiss.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It’s probably as simple as they didn’t think to add that when they made it. There’s a lot of things like that in construct.

  • I mean if you have a tilemap with 100x100 tiles and have an array of size 100,100,1 you can consider them related even though they aren’t. That would give you an array location for every tile.

    The array would have whatever value you put in it. As an example look at only one tile, what value would you want in that location, and how do you want that set? Once you have that you can do it for all the tiles by looping over all the tiles and doing the same logic for each.

    You could make a different array for each variable you want per tile, or make the size 100x100x4. I’d go with whatever was easier to understand and read.

  • 100 mb doesn’t sound too bad actually. If the default type is a 64bit number it would be 1000x1000x10x8 = ~80mb

    Js also stores the type per value, and typically resizable arrays are made to allocate a bit more memory to make resizing faster.

    Presumably you could use the binary object which uses typed arrays under the hood to be more memory efficient since they don’t resize and share the same type for all the values.

    Anyways, in regard to the op I’d still just use an array the same size as the tilemap. It’s the simplest solution.

  • I mean you can try it. Sounds like they’d fight each other.

  • They can’t be both simultaneously with the physics behavior. Since events run top down it will have framerate independent set.

    Unfortunately you can’t do what you’re after with the physics behavior. With a fixed step the simulation will be consistent yet the speed will vary with the frame rate, and the other setting makes the speed appear the same yet the simulation won’t be consistent.

    The underlying issue is in construct the events and behaviors run at the same rate as the screen refresh rate. We cannot limit the fps in construct either.

    A possible solution is to run the physics simulation at one rate, and interpolate the positions so it can be displayed at the screen refresh rate. It’s easier said than done though. You couldn’t utilize the physics behavior to do that, instead you’d need to use a physics library via JavaScript or roll your own physics with events. That is mainly so you can control when the physics is updated.

    The interpolation part will require you to have x,y,angle for the current frame and the next one for each object.

    Overall that’s all fairly low level. Construct isn’t currently designed to make something like that easy. General thought is to just use frame rate independent mode and just tolerate inconsistencies in the simulation. If you need more accurate simulation you’d need to do something else more complex unfortunately.