R0J0hound's Forum Posts

  • This topic here shows a way to bend text:

    construct.net/en/forum/construct-3/general-discussion-7/text-follow-curved-path-157571

    It divers the text up to make an object per character and uses the .textWidth expression to get the size. Then just places them along a path using cubic() as I recall.

    An alternative way could be to utilize a distort mesh instead.

  • Guess I can’t play mkv files from my phone. Anyways, will look later in the week if I get on my pc.

    I’m going to stick with the 0-1 for color values I think. You can divide values in the range 0-255 by 255 as a easy conversion.

    Depending on the shadow issue you can improve it by adjusting the shadow bias or using a bigger shadow map size. But I’ll see better when I get to watching the file.

  • You can make a parser to do it. There are many ways to do that depending on what you want to do.

    Fist step is to get a list of tokens (numbers and +- or ^)

    A simple way to do that is with a series of replaces so what you end up with is a list of tokens divided by spaces.

    Then you can loop over them and make that substitution with something like this:

    var text = "2^3+4^6
    
    Set text to replace(text, “ “, “”)
    Set text to replace(text, “+”, “ + “)
    Set text to replace(text, “-“, “ - “)
    Set text to replace(text, “^”, “ ^ “)
    
    var output= ""
    var i=0
    var n=tokencount(text, " ")
    
    while i<n
    -- add 1 to i
    -- if tokenat(text,i," ")="^"
    -- -- add "pow("&tokenat(text,i-1," ") &","&tokenat(text,i+1," ")&")" to output
    -- -- add 2 to i
    -- else
    -- -- add tokenat(text,i-1," ") to output
  • mOOnpunk

    Looks like the function isn’t being called. In c3 JavaScript stuff is scoped differently I think. You probably can fix it by putting that js function in the global scope another way. Maybe a js block?

  • Oh cool. Glad you got it working.

    Actually none of those expressions are Euler angles. That’s the 3x3 orientation matrix. So you could use orientzx, orientzy, orientzz to get a vector of the direction of being faced.

    I work on this in spurts and ray casting has been a request for a while that I’d like to add. Shaders are a cool idea too. But there’s a lot more to it behind the scenes that needs to change and I’d need to settle on a good design.

    I find when making plugins it’s hard to change features without breaking existing capx. But anyways

  • It will take me a day or two to fiddle with it. I’ve never used q3d.

    With this plugin the Euler angles are just xyz ordered. For any other ordering I just opted to just do it with some additional rotate actions instead of picking an order.

    Also what may make it different is how I specified the axis’ to match the layout. X to the right, y down and z up toward the screen.

    Most other 3D have z be negative toward the screen. But anyways changing that would be a breaking change.

    Anyways. All that seems to be needed is to rotate so the camera so it’s oriented with the ground down. Found that with some trial and error.

    The turning is done by rotating around y, and looking up and down with x.

    In my example I used the mouse position to drive the rotation. But you could just use variables.

  • megatronx

    There are probably multiple ways but this works:

    set orient to (-90,0,0)

    rotate xrot by axis (0,1,0)

    rotate yrot by axis (1,0,0)

    I found it by trial and error. by default the camera looks into the screen. we rotate by -90 so it's looking up. Then from that viewpoint we can rotate left and right, and finally we rotate again for up and down.

    dropbox.com/s/wl243pmfbgepftq/rojo3d_fps.capx

  • Funky Koval

    Oh my apologies. I thought I had replied. I like those ideas. Need to change up a few things to get that stuff to work. Have been taking a break from working on this, and looking for excuses not to be on the computer, but I have been doing tests applicable to this elsewhere. Just need to crack this open again.

    megatronix

    -

    Relto is the object I’d you are setting an object relative to. But in what way it is relative depends on if you are setting the position, orientation or scale.

    As an example say you set the position to x,y,z relto:”obj2”. It will set the position to obj2 and then, using obj2’s orientation, it will move x units to the right, y units down, and z units forward.

    -

    There are no particles but you can do it manually.

    -

    Animating the textures is just a matter of changing the texture of an object every frame or however often as you want it to change.

    -

    Setting the texture rectangle let’s you only display a portion of a texture.

    If (0,0,1,1) uses the whole texture

    Then (0,0,0.5,0.5) would only be the top left quarter of the texture. Can be useful for packed sprite sheets.

    -

    The create verts and save it as a mesh is to just make any mesh you want. Just lets you do it with events instead of loading a pre made obj file.

    -

    I’ve never compared this with other libraries. It may or may not be faster. It does less than three.js but it coexists on the same canvas as construct as opposed to being a separate layered canvas or a canvas that is copied to a texture every frame. I’m sure the performance will change as the feature set changes.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, I guess I should have clarified in the other topic. You probably need to look at some actual JavaScript regex documentation.

    This one covers the flags about 2/3 of the way down the page.

    developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

  • You could utilize tokenat with a loop and “.” As the divider. Then just rebuild the text a token at a time adding the “.” In between. Except when loopindex=2, you can add a “!” Instead.

    Otherwise there may be some regex incantation, but you have to dig into the docs for that.

  • calminthenight thanks!

    mOOnpunk Hey that's pretty cool looking.

    After trying out a few ideas I think the first step would be to decide on what data format you will be using first. Whether Array, Dictionary, json or even some contrived text format you make a parser for.

    The next step would be to manually make passages with the data format you chose.

    Then you'd have something kind of game that uses the data.

    Anyways, I like custom text formats so I wrote a parser. I wanted to be able to put the text links anywhere inside the text so a parser was useful.

    Had to do manual word wrapping since I made it so you can put clickable text anywhere. Also had to use some js because the .textWidth expression is delayed a tick so it's basically worthless.

    dropbox.com/s/47kmt431q7o3wcv/dialog_parser.capx

    I probably got carried away with the parsing. There may be simpler ways, but a least by parsing it's possible to extend it to have some scripting more like twine.

    Anyways, I never got to the visual editor portion. Maybe i'll try that later.

  • I concur you could make your own editor with construct to write blocks of text and drag them around. You could then export it into any format you like.

    You could also make the editor in the game you're making and utilize local storage for fast iterating instead of having to export and import the file every time you make changes. You'd just need to export and import the file before exporting your game since local storage isn't carried over.

    Guess the basic structure of the data you'd need is: the name of the passage, the text of the passage, and a list of the branching options (text and passage to link to). Personally i'd do it all as plain text like this and parse it. But if you make your own editor you can visualize the links between passages, and check it to make sure all the linked passages actually exist and there were no typos.

    #start
    You decide to start to learn to make games, 
    so you open up this cool new software.
    {continue... |next}
    
    #next
    You plug away at learning the software for a few minutes, 
    but then discover it uses math!
    What do you do?
    {Yeet the pc out the window. |yeet}
    {scream!! |scream}
    {faint in despair. |faint}
    
    #yeet
    Losing no time you slam the window open, 
    and with fire in your eyes you yank that 
    mathematical devil device from your desk, 
    and toss it out the window with all your 
    might out into the abyss!!!
    {Peace at last...|end}
    
    #scream
    Noooooooooooooooooooooooooooooooooooooooooooooooooooooooo!!!!!!!!
    {...and you pass out. |faint}
    
    #faint
    You wake up on the floor, unaware of how much 
    time has passed. You also don't recall 
    what you were doing...
    {...continue|start}
    
    #end
    Thank you for playing.
    {care to try again? |start}

    Just typed like that or even written linearly in json or what have you probably can become unruly pretty quick, but then I'd want an editor to help with that.

    You could add some scripting to it by going the parsing route so it could be more lke twine with variables and conditions. It just depends on what you want for your game.

  • It was a specific shape. each action has an angle and distance to specify the lines that make up the shape. For example a triangle can be made up of three lines: red,blue and green.

    That said, it can be made generic but in c2 I can't access the collision polygon so I'd use imagepoints instead. As long as the points make up a convex shape and points are placed clockwise. Although the winding order can be worked around.

    edit:

    Here you go:

    dropbox.com/s/xp1tprnefmdwf0b/convex_clamping_generic_with_imagepoints.capx

    Just as long as it's a convex shape and the origin is within that shape. CW or CCW doesn't matter.

  • Cool. Glad it was useful.

  • So if I'm looking at that right looks like you have the origin of the wave at the front so you're doing something like this?:

    on wave collides with ship
    -- create explosion at (wave.x, wave.y)
    -- destroy wave

    The main idea i have is you can clamp the explosion position to the shape of the ship. This is simpler when the shape is simple.

    Since the ship isn't rotating is you can clamp the position that you create the wave to the bounding box of the ship. Anyways that works well for unrotated box shapes, so the ship from the right could still have floating hits.

    on wave collides with ship
    -- create explosion at (clamp(wave.x,ship.bboxleft,ship.bboxright), clamp(wave.y, ship.bboxtop, ship.bboxbottom))
    -- destroy wave

    If you want to clamp to a rotated box it would be this as long as the ship's origin is centered.

    on wave collides with ship
    -- create explosion at (wave.x-ship.x, wave.y-ship.y)
    -- set explosion position to (self.x*cos(ship.angle)+self.y*sin(ship.angle), self.x*cos(ship.angle+90)+self.y*sin(ship.angle+90)
    -- set explosion position to (clamp(self.x, -ship.width/2, ship.width/2), clamp(self.y, -ship.height/2, ship.height/2))
    -- set explosion position to (self.x*cos(ship.angle)+self.y*cos(ship.angle+90)+ship.x, self.x*sin(ship.angle)+self.y*sin(ship.angle+90)+ship.y)
    -- destroy wave

    Similarly you can clamp to a circle shape. Here a circle with radius 100.

    on wave collides with ship
    -- create explosion at (angle(ship.x,ship.y,wave.x,wave.y), min(100, distance(ship.x,ship.y,wave.x,wave.y)))
    -- set explosion position to ( ship.x+self.y*cos(self.x), ship.y+self.y*sin(self.x))
    -- destroy wave

    Or even any convex shape. Although that can take more thought. Here is a triangle.

    on wave collides with ship
    -- create explosion at (wave.x, wave.y)
    -- explosion: move -max(0, (self.x-ship.x)*cos(180)+(self.y-ship.y)*sin(180)-50) pixels at angle: 180
    -- explosion: move -max(0, (self.x-ship.x)*cos(-60)+(self.y-ship.y)*sin(-60)-50) pixels at angle: -60
    -- explosion: move -max(0, (self.x-ship.x)*cos(60)+(self.y-ship.y)*sin(60)-50) pixels at angle: 60
    -- destroy wave

    And here's another way to do the rotated rectangle:

    on wave collides with ship
    -- create explosion at (wave.x, wave.y)
    -- explosion: move -max(0, (self.x-ship.x)*cos(ship.angle)+(self.y-ship.y)*sin(ship.angle)-ship.width/2) pixels at angle: ship.angle
    -- explosion: move -max(0, (self.x-ship.x)*cos(ship.angle+90)+(self.y-ship.y)*sin(ship.angle+90)-ship.height/2) pixels at angle: ship.angle+90
    -- explosion: move -max(0, (self.x-ship.x)*cos(ship.angle+180)+(self.y-ship.y)*sin(ship.angle+180)-ship.width/2) pixels at angle: ship.angle+180
    -- explosion: move -max(0, (self.x-ship.x)*cos(ship.angle-90)+(self.y-ship.y)*sin(ship.angle-90)-ship.height/2) pixels at angle: ship.angle-90
    -- destroy wave

    Sometimes you can have complex shapes be made up of multiple simpler ones. It just depends on what you're after.

    Anyways, just an idea.

    Edit:

    here's an example:

    dropbox.com/s/xcg99crdntoa3lf/convex_clamping.capx