R0J0hound's Recent Forum Activity

  • There are always multiple ways to do something. Here's one way in addition to previous examples and such. My examples are meant to be something to fiddle with and maybe get some ideas how something could be done.

    It just converts a qarp curve to a polyline and lets you move some distance up and down the polyline.

    dropbox.com/s/m0pk8zvqoj08kr7/move_on_dashed_curve.capx

  • There are lots of ways to do curves, but for that particular one you could use a Bézier curve or an arc.

    Generally for most curves you can get a formula to get any position along it by t. But the speed will vary as you move along it, so the solution to that is to convert the curve to a polyline so you can move along it at a constant speed.

    Anyways here’s the simplest formula to move on a curve. A and C are the end points and B is a control point, and t changes from 0 to 1.

    X=qarp(ax,bx,cx,t)

    Y=qarp(ay,by,cy,t)

    Again if you want to move at a constant speed along the curve you’ll need to use the formula above to get a list of points along the curve then move between them in straight lines. Another way is called arc reparameterization which avoids the polyline but requires more math to get an integral we can evaluate numerically.

    A second idea in that specific curve is to just use the arc on a circle. You can derive the center and radius from three points on the circle and using this formula for the tree points. Then solve using algebra.

    (X-centerX)^2+(y-centerY)^2=radius^2

    Then you can get a point on the circle with

    X=radius*cos(a)+centerX

    Y=radius*sin(a)+centerY

    So to move along an arc you lerp between the angles from the center to the endpoints. That will be constant speed.

    I don’t have time to make an example but I’ve done something similar a lot so a forum search of my posts will give a fair amount of results.

    If that plug-in works for you I’d go for it as well. I have not tried it.

  • I dealt with that a bit when I made a spritefont generator. The text is drawn with the canvas api and that doesn’t provide a way to measure the visual bounding box of text. It gives the width enough to space text well but nothing about stuff that overhangs.

    Anyways, I just oversized it and centered the text to avoid the clipping.

    You could avoid the warping entirely but just adding new lines as needed. That way you could ensure there’s a buffer to the right.

  • That’s trickier. One quick way could be to use the line of sight behavior to see if a wall can be seen by the player and if it is move the wall to a layer above the shadows.

    Otherwise I’d give it more thought and do the shadows another way. Probably drawing them with the canvas plug-in.

  • Chat gpt created the question? That’s a new one. I thought people used it to get answers. Any particular reason you don’t just ask the question directly? I may just be confused though.

    Anyways, since construct is a 2d engine you can use the shadow caster behavior to do shadows. But since you write walls maybe you mean on a 3d shape? In which case it’s a pain to do since the engine isn’t built for it. But search the forum and you can find some complicated solutions of sorts.

  • Example:

    dropbox.com/s/wmra64o0xervngk/rotateAroundCenter.capx

    You can do it in the editor as well. Select the objects, press enter and then you can rotate them together.

  • Yes, I thought that’s what you were after and that’s why I posted it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here’s the documentation for accessing MIDI devices:

    developer.mozilla.org/en-US/docs/Web/API/Web_MIDI_API

    It shows how to do it and where it’s supported. However you’ll probably want to have a MIDI device first to test it or even attempt utilizing it.

    Playing MIDI files is different. You can already play audio in construct and change the pitch. Look at any example that has a piano.

  • It’s events. Make three variables names centerX, centerY and a. Set them to whatever you want. Then make an every tick event and add a set position and rotate action for those objects and use those expressions.

  • You can do this to rotate around any center.

    Var a, centerX, centerY
    
    Set position to (self.x-centerX)*cos(a)-(self.y-centerY)*sin(a)+centerX, (self.x-centerX)*sin(a)+(self.y-centerY)*cos(a)+centerY
    Rotate clockwise by a degrees
  • You probably could get pretty close with the physics behavior. Make a joint between the player and apply a torque to the sword. The only downside is you’ll want to do all the motion with the physics behavior since it doesn’t work with other behaviors.

  • In general most behaviors the motion is good enough, but seldom 100% precise. I think what happens is the moveto behavior discards the overshoot.

    Anyways, here's a way to do near perfect path motion so the object's stay spaced the same. They are transparent and next to each other so if it would show desync if it happens. Additionally you can toggle that disabled action to avoid even more numeric drift.

    The gist is it moves in direction of a waypoint, and when the waypoint is passed it carries over the extra motion when it moves toward the next node.

    dropbox.com/s/5bg83cgrpv9k8tn/node_path_follow2.capx

    Edit:

    And the idea can be taken further. This one supports any speed.

    dropbox.com/s/vow1i2x2rcteee6/node_path_follow3.capx