R0J0hound's Recent Forum Activity

  • You do not have permission to view this post

  • You do not have permission to view this post

  • You do not have permission to view this post

  • Here's a mess of previous topics. There are probably more.

    construct.net/en/forum/construct-3/how-do-i-8/math-result-text-line-145507

    construct.net/en/forum/construct-3/how-do-i-8/create-programming-language-138650

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

    Specific to what you're going for here's this:

    More functions and expressions can be added in the "namelookup" function.

    ucd4a3848c21864afcfb4f97253a.dl.dropboxusercontent.com/cd/0/get/Ch5eRLe3Iq9oGG6sryfJZpPPSeZJ6W0nsCxeC6QiJjmw6zTvbKCd7SL1XQSkHA765zFjtHF-E_lFtihLtJVIvicDeNnAD1HGzjK6xxzUOI3eI04VMuqddpcgGLBfKs2RmTnHRQKXIZJHCb8Bupq8hxLR/file

    It won't allow invalid syntax but the error messages need work.

    Anyways, the simplest would be to do a few string replaces and running the expression with the browser's execjs expression. However this isn't forgiving if there are syntax errors and can be a problem if some arbitrary js is run.

  • In the layout editor it only takes hex numbers. In events you use decimal numbers but you can use the set bit expression.

  • You do not have permission to view this post

  • Hi,

    Sorry for the late reply.

    Probably the simplest is to use a 32 character binary number of 1's and 0's. Each digit is a layer that you can make the object be in or not in.

    For example:

    1110 1010 1010 1111 1000 0100 1100 1011

    Then to input it into the layers property you need to first convert it to hex using google, or windows calculator.

    Here's one possible converter:

    convertbinary.com/binary-to-hexadecimal

    That binary number turns into this:

    EAAF84CB

  • Hi,

    For whatever motion you want to trace the future path of you’ll need a way to manually advance the object. Behaviors do that automatically every frame, but don’t give manual control to advance multiple frames.

    Logic overview would be:

    1. Save position and velocity

    2. Loop 100 times

    3. — move object a bit

    4. — handle collisions and bounces.

    5. — plot point

    6. Restore objects pos and vel

    Number 3 is pretty easy with an object affected by gravity.

    Add gravity/60 to Vy

    Set position to x+vx/60, y+vy/60

    Number 4, the collision detection and response is a topic of its own. Usually back up the object out of the wall, figure out the angle of the wall and do a bounce calculation.

    Anyways, that’s what you could do in any Game creation software.

    You may be able to do a hybrid approach with constructs features.

  • I wouldn’t mind at all.

  • For a fairly straightforward way of getting the collision point you can take all the points of one object’s collision polygon, and see if they overlap the other object. Then do the same for the second object with the first. Then, for all the points that do overlap just average the positions together to get a collision point.

    There are more robust ways, but it should work in most cases. One case where it would fail is if the objects are severely overlapping and no points overlap, just edges.

    For the impact sound it basically boils down to:

    Velocity_after - velocity_before

    Maybe Every tick save the old velocity to some variables. Then on the collision, after stopping or bouncing the object, subtract the velocities to get the impulse.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here’s some pseudo code to do the bounce. The only trig has to do with the collision normal. The normal is perpendicular to the angle of the platform. So if you know the angle of the surface it’s enough to subtract 90 to get a perpendicular angle. Then to make the math look cleaner we can convert that angle to a vector.

    Anyways here’s the math.

    Nx,ny is the normal vector and can be calculated with:

    nx= cos(plat.angle-90)

    ny=sin(plat.angle-90)

    Next we calculate the velocity along the normal’s direction. Here vn is that velocity, and vx, vy is the x and y velocity of the object. We are utilizing a vector dot product to get the velocity along the normal’s direction.

    vn=vx*nx+vy*ny

    So far so good. Next is to do the bounce by changing the velocity.

    You only need to do the bounce if the object is going toward the platform.

    Then the bounce is done by taking the velocity along the normal, converting it back to a vector by multiplying it by the normal, and finally subtracting that twice from the velocity. If you subtracted just once, then it would just stop motion in the direction of the normal.

    if(vn >0)

    vx = vx -2*vn*nx

    vy = vy -2*vn*ny

  • megatronx

    The hexadecimal digits each are four bits. So you can use them for four layers. See the key here, but you can find it elsewhere as hexidecimal to binary. In total you can have 32 layers or 8 hexadecimal digits. In the layout editor it's convenient to use hex to set the layers. In the event editor you can do it too, or you can take an existing mask and modify it with construct's bitset expression.

    0 0000
    1 0001
    2 0010
    3 0011
    4 0100
    5 0101
    6 0110
    7 0111
    8 1000
    9 1001
    A 1010
    B 1011
    C 1100
    D 1101
    E 1110
    F 1111
R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 156 followers

Connect with R0J0hound