R0J0hound's Recent Forum Activity

  • You want to detect a collision without a collision? Any reason you can’t enable the collision?

  • On disk or on a server it’s considered a file such as png.

    Once the file is loaded and decoded into an array of pixels in memory it’s an image.

    To render the image it needs to be copied over to video memory which is a texture.

    In webgl for example you’d first create an html image object from the png then a webgl texture object from the image.

    If you delve into webgl you can get pixels back into an image. Basically render the texture to a framebuffer and call getpixels to get an array of the pixels. Then create an html canvas of the same size, get an image buffer from that and copy the array of pixels to that. Finally canvas.imageUrl will give a data url (aka base64 version of a png) that you can load into an image or download. That’s basically how taking a screenshot works.

  • The sdk manual says nothing about getting a texture’s image.

    Take all my suggestions with a grain of salt. I can only go by what I find in the manual. When actually making a plugin you have the other tool of using console.log with whatever object you’re curious about and then you can then browse that object from the browsers debug console. That would let you confirm the things the manual lists as well as show anything not mentioned.

  • At edit time and at runtime there are sdk functions where you specify how the object is drawn in your plugin.

  • If you got the texture then it’s just a matter of using it in the render function I suppose.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.