R0J0hound's Forum Posts

  • 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

  • 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.

  • I think what was mentioned was modular events. They had feature poll back in the day mentioning it, and more recently there was a blog post mentioning is as an idea. Using that to make plugins was also thrown around. I don’t think any of this is fleshed out though.

    Most plugins that interface with some third party JavaScript library would probably not benefit from it.

    You can already do somewhat modular events now but it’s very tied in to the project usually.

    If it ever becomes a thing I think it won’t be soon.

  • It’s only 4 ifs. You could get or make a plugin that runs some text as an expression, but that’s probably overkill. You could use the conditional expression to pack the ifs together to do everything in one event.

    Global number a=0

    Global text op=""

    Global number b=0

    Global number result=0

    Every 1 seconds

    — set a to int(random(100))

    — set op to mid("+-*/", int(random(4)), 1)

    — set b to int(random(100))

    — set result to 0

    — set result to (op="+")?a+b:result

    — set result to (op="-")?a-b:result

    — set result to (op="*")?a*b:result

    — set result to (op="/")?a/b:result

    — set text to a&op&b&"="&result

  • Offhand you can do the math directly to map x from a,b to c,d.

    X = c+(d-c)*(X-a)/(b-a)

    Or if you want to use some built in expressions you could do this.

    X = lerp(c, d, unlerp(a, b, x))

  • That looks cool and all but it’s not something I’ve wanted to do.

    The only optimization i do is simplifying and organizing events to be straightforward and easy to use as possible. Speed rarely is a concern to me. I’d rather things work right than have it work fast.

  • As far as I understand it, effects are handled basically the same way in c2 and c3. The only additional effect parameters you can add are numbers. You can’t pass additional textures to construct effects at this time.

    However it is possible to do it from a plugin’s drawgl function. Tell construct’s renderer to finish drawing, and then do any custom webgl you like. The pro of this is you can do anything. The cons are you have to deal with a fair amount of webgl and you’ll have to change the webgl state back when you’re done. The closest example I have is here, but it touches on more things than you’ll need.

    construct.net/en/forum/construct-3/how-do-i-8/how-do-i-get-this-example-to-w-140574

    It’s fairly low level but could be a useful starting point.

    Either way your effect is pretty cool.

  • I’d just use whatever is simplest and easiest to use for your game. I don’t know what the performance differences may be, but they are likely negligible. With card games most things are done with input or after a timer. These are one off things that even if done slow will have no impact whatsoever with FPS or cpu usage. At least nothing you’d notice.

    If you get pauses you can deal with that later.

  • Well, using the math in that link here is a curve through many points. It's basically a cubic bezier between each.

    dropbox.com/s/1fjnow11g4zn04b/curve_polyline.capx

    That's kind of stuck as one curve, so here's a tweak to make it work for multiple. Event's 9-12 need to be spaced out like that. After creating objects you need to wait till the next toplevel event to allow them to be pickable.

    dropbox.com/s/q7cd4whip7fsguq/curve_polyline_multi.capx

    To move along these curves you'd either have to save the cubic() parameters or just lerp along the generated points. A plus about the latter is you can make the speed constant.

    Here's a dump of other examples that either draw curves, and/or do motion along a curve.

    construct.net/en/forum/construct-2/general-discussion-17/follow-path-behavior-42924

    construct.net/en/forum/construct-2/how-do-i-18/smooth-movement-following-path-109114

    construct.net/en/forum/construct-2/how-do-i-18/an-extreme-slide-type-of-move-96270

  • Couldn’t you just compare the x position first?

    Player x < 800

    — set camera x to lerp( self.x, player.x, 0.01)

    Or I guess you could also add an else after that to lerp to the x boundary

    Else

    — set camera x to lerp(self.x, 800, 0.01)

    Or you could utilize the min() expression to keep it in the every tick. May not be as flexible later, and could be harder to read.

    Every tick

    — camera: set x to lerp(self.x, min(player.x, 800), 0.01)

    If you want a left boundary instead, use max() instead. If you have a left and right boundary, use clamp() instead:

    Lerp(self.x, clamp(player.x, 50, 800), 0.01)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This only considers three points. Doing multiple back to back are basically just independent.

    You’d probably want to do something like this to go through multiple points:

    stackoverflow.com/questions/1257168/how-do-i-create-a-bezier-curve-to-represent-a-smoothed-polyline

    Which is multiple cubic beziers placed one by one. It just sets the control points so the slope is the same from one to another. Another option are catmull-rom curves.