R0J0hound's Forum Posts

  • Well, all parallax is is this:

    (Originalx-scrollx)*0.6+scrollx

    And the same with y

    Z scaling is basically

    X = f*originalx/z

    Where f is the focal length. I don’t know what value construct uses for that.

    There’s a bit more to it than that and usually they tie in the camera distance and relate it to the focal length. Also the perspective is around the center of the screen so we have:

    X = cameraZ*(originalx-screenCenterX)/(z+cameraZ) + screenCenterX

    Y is basically the same. Width and height are slightly simpler:

    Width = cameraZ*originalWidth/(z+cameraZ)

    As written, when the z of an object is unchanged then the position and size won’t change. Negative z is bigger and positive z is smaller. If that’s opposite then just make cameraZ negative. Smaller cameraZ values make more sever perspective and higher make less sever.

    I haven’t investigated but cameraZ may be something simple like 500, or if C3 has a way to change it, then use that value.

    Anyhoo I guess with all the above we can calculate the simulated z or scale of a certain parallax.

    And looks like you assumption is correct. The scale is equal to the parallax.

    On a side note if you wanted to do the parallax with z instead of a parallex layer you can do this:

    Z = cameraZ/parallexX -cameraZ

  • There’s this old topic that may be relevant. It has a way to do 2d physics for pool. It improves on the collisions by finding collisions when the balls just touch instead of counting the first time it overlaps as a collision. My method was slow at converging on a solution at times.

    construct.net/en/forum/construct-2/general-discussion-17/approaching-pool-ball-movement-56649

    It can be made more precise by just calculating when two balls hit. I think the above moves the balls as normal and once any of them overlap all the balls are moved back a bit at a time till they are just not overlapping, and then doing the bounce calculation.

  • Perhaps it doesn’t work anymore. I don’t really know. Maybe just draw with white for erasing.

  • Just the same idea. Possible example in 3 actions.

    Sprite: set blend mode to destination out

    Paster : paste sprite

    Sprite: set blend mode to normal

  • I get lost with equations pretty easy. So let’s start over.

    If you have 4 points: A, B, C, D

    You can make a curve through it where it ends on points A and D and the control points are B and C, but they won’t be on the curve.

    So something like this to get the points to to draw the curve along.

    Repeat 10 times

    — set x to cubic(ax,bx,cx,dx, loopindex/10)

    — set y to cubic(ay,by,cy,dy, loopindex/10

  • No, you have it right.

    The first and fourth parameters are the end points, and the 2nd and third are the control points.

    The last parameter is a number 0 through 1. We do the curve by using cubic() for x an y and setting the last to various values between 0 and 1. So for example 0, 0.2, 0.4, 0.6, 0.8, and 1 to make the curve from 5 lines.

  • inkfalcon

    Nope.

  • That curve is an arc. You could do it with:

    Repeat 10 times

    — set a to lerp(90,270, loopindex/10)

    — create point at centerx + radius*cos(a), centery+radius*sin(a)

    Or do the curve with multiple curves.

  • Im only focusing on doing an editor via as modular as possible events. Basically a small amount of objects to do the interface, a chunk of events using those objects (this is the guts that doesn’t need to be understood), and lastly simple events to tie in with project specific stuff.

    I’m unable to comment on the viability of other ideas such as doing it from a plugin or actually changing the construct editor.

  • Being able to draw paths for objects to follow would be cool. It’s the ultimate in “no programming required” to get things to move about. I’ve lost interest in making feature requests though. I’m more a try to make it myself now sort of guy, since I’m not very patient.

    The existing solutions of using sprites to mark the path can look messy pretty quick. That’s kind of a creative use. My thought is there’s always the in game editor solution. Then you could do whatever you want once you get past the boilerplate stuff.

    All the paths and vector shapes are just data and you can already do rendering of them utilizing sprites or the canvas plugin. It’s lower level than just throwing a svg at it but filled polygons will get you mostly there.

    The hard part is getting it to work with constructs collision system. Probably by utilizing a bunch of hidden sprites. Or you could make your own independent collision system. Decisions decisions.

  • I'd just use a variable. For example you could call it "hidden". Here's a possible implementation. You could use a boolean instead as well. You can also reduce it to just two events if need be.

    On key pressed

    -- sprite: set hidden to 1-self.hidden

    Sprite: hidden = 0

    -- set opacity to self.opacity - 50*dt

    Sprite: hidden = 1

    -- set opacity to self.opacity + 50*dt

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Switch a and b in the formula. I made a mistake writing it down.

  • Global number a=0

    Global number b=0

    Function “n”

    — set a to min(function.param(0), function.param(1))

    — set b to max(function.param(0), function.param(1))

    — set return value to a+10-(5-b)*(6-b)/2

    For the same range of numbers you have at least.

  • You could just build a text string and evaluate it with the browser plugin

    Set result to browser.execjs(“2+5/3”)

    Or you could make your own parser to interpret an equation. One possible example here:

    construct.net/en/forum/construct-2/your-construct-2-creations-23/r0j0s-experiments-69314

    You could do something simpler though since you already have the numbers and operators separate.