R0J0hound's Recent Forum Activity

  • megatronx

    I have no input on that other than yes you can access values in an array immediately after you set them.

    Maybe your logic just isn’t correct for what you’re doing. It could be helpful to output what’s going on at each step to debug things. Or maybe simplify the data you’re using to be able to analyze what’s it’s doing better.

    As is I can’t make sense of it. Arrays are useful but i find code using them often unreadable

  • I guess this topic kind of turned into a catch all for questions.

    megamente br

    To use paster you just move it wherever you want, then pasting other objects onto it will draw then in place onto the paster object. That’s basically it.

    megatronx

    I appreciate it, but it’s merely in the idea phase since I don’t code a whole lot. Unfortunately when/if I make it it would be smaller scoped than that.

  • For steps of 10 you can do this when setting the angle:

    set angle to round(Self.currentAngle/10)*10

    But really with your image this is the correct rounding:

    round(Self.currentAngle/(45/9))*45/9

  • I was able to test mine as working so I now see what you had amiss.

    You had:

    (Vx / 10)* (Vy + sqrt(((Vy * Vy) + (2 * 10 * Y0Height)))) - X0

    But it needs to be this. 500 instead of 10, and you don't subtract x0.

    (Vx / 500)* (Vy + sqrt(((Vy * Vy) + (2 * 500 * Y0Height))))

    That will the calculated be approximately the actual. It will be off since the floor is hit a bit early.

  • You could delay it a frame with something like this pseudocode. Beyond that I guess you'd have to implement the platform behavior from scratch so you can actually know when a collision occurs.

    bool overlap = false;
    bool futureOverlap = false
    
    onTick(){
     if futureOverlap==true && overlap==false
     then doStuff()
     
     overlap = futureOverlap
     futureOverlap = obj.isOverlappingSolidAtOffset(obj.vx*dt, obj.vy*dt)
    }
  • One way to do an undo is to make a save of the game state before you move. It's the same kind of problem as saving your game, you probably can utilize construct's save features for that. Another way is to just save the changes of each move. Could be a bit trickier though.

    Hints would be done in the same way as a real player finds a move. Basically come up with a way to check all possible moves.

  • Messed with your example briefly but no luck. Do note, that the gravity value you should use in the equations needs to be 50x the gravity value that the physics behavior uses.

    Anyways you could try it with the bullet behavior instead in case the physics behavior is throwing it off.

    I mean your logic seems sound. There’s probably something I didn’t notice that’s throwing it off. If it helps this is what I come up with when working out the math. I haven’t tested it though.

    Var g=500
    Var x0=0
    Var rangeCalc=0
    Var rangeActual=0
    
    Start of layout 
    — ball: set position to (0, 400)
    — ball: set velocity to (100,-100)
    — set x0 to ball.x
    — set rangeCalc to (-vy + sqrt(vy*vy + 2*g*(480-ball.y)))*vx/g
    
    On ball collides with ground
    — set rangeActual to ball.x-x0
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess the use of the trig functions look obscure. If it helps this is the formula I’m using that uses trig. All it does is rotate an xy point around 0,0 by some angle.

    NewX =x*cos(a)-y*sin(a)

    NewY =x*sin(a)+y*cos(a)

    The cool thing about it is you can rotate other ways too such as xz, just replace the y with z in the formulas.

    This is all I’m using that equation for:

    // make a circle

    Vector(radius1, 0, 0)

    RotateXY(b)

    //Then rotate the circle in an arc to make the rings.

    Move(-radius1, 0, 0)

    RotateXZ(a)

    The equation I used is just all that combined and simplified. All the equations I ever use in my examples are like that, a combination of simple steps combined and simplified.

  • You can do a lot with mesh distorts. Here's a way to generate an arch mesh. There's just no end faces although those could be added.

    dropbox.com/scl/fi/5a23jevq10r3kqzapd7a9/arch_3dmesh.c3p

    In a similar fashion it's possible to take any polyline and revolve it around an axis, or extrude it along a path to make a 3d shape from one distort mesh. So spheres, cylinders, cones, torii, screws, ... etc, could be made. Actually with some creativity you can make all kinds of 3d shapes with distort meshes.

  • Probably check the browser's console to see if there are any errors. If that's good you could do some smaller tests with the array scripting api to see what works and what is not doing what you expect.

  • To be able to load a json string into the array object it needs to be in a specific format. You can see that format with array.asJSON.

    Something like this should work in converting your json string into a 1d construct array json.

    function convert(in){
     in = JSON.parse(in);
     let out = {c2array:true,size:[0,1,1],data:[]};
     for(let i=0; i<in.length; i++){
     out.data.push([[in[i].x]], [[in[i].y]]);
     out.size[0]+=2;
     }
     return JSON.stringify(out);
    }

    Then after loading that into the array object you can access the xy of the nth point with:

    X=array.at(n*2)

    Y=array.at(n*2+1)

  • This would set obj2 from obj1:

    Obj2: set y to lerp(1250,410, unlerp(310,-1800,obj1.y))

    And this would set obj1 from obj2:

    Obj1: set y to lerp(310,-1800, unlerp(1250,410,obj2.y))

    You’d only use one of those at a time. Say when you’re moving one you’d update the other.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound