R0J0hound's Recent Forum Activity

  • It would be the same as for instance a "start of layout" condition. Any way you set it up is fine. no extra calculations are done and c2 just triggers them top down.

  • striimix

    Those functions are related to the chipmunk.js library's spacial partitioning scheme. It's nested because it's a tree structure and it would make sense that it would be called a lot as it would update as objects move. In my tests it's only taking about 5% of the total time and it's size is remaining constant (251 leaves for 251 objects), so that's not the culprit.

  • Attached is a exact way to do a rounded path like the op.

        * |*  *  *  *  *  *| *
     *    |                |    *
    *     |       o        |     *
    *     |                |     *
     *    |                |    *
        * |*  *  *  *  *  *| *
    
    |     |\               |
    +-----+ +--------------+
     radius       space[/code:15y1qd5m]
    
    You can think of each piece of the path like a lerp from one point to another.
    left side:
    x = center.x - space/2 + radius*cos(90+180*t)
    y = center.y + radius*sin(90+180*t)
    
    top:
    x = center.x + 0.5*space*lerp(-1,1, t)
    y = center.y - radius
    
    right side:
    x = center.x + space/2 + radius*cos(-90+180*t)
    y = center.y + radius*sin(-90+180*t)
    
    bottom:
    x = center.x + 0.5*space*lerp(1,-1, t)
    y = center.y + radius
    
    where t is a number from 0 to 1.
    
    Now all that needs to be done is depending on the distance traveled choose the correct equations and t value.
    We first start with the distance traveled:
    distance = speed * time
    
    Next we need to know the lengths of the pieces.
    The top and bottom are easy with a length of "space".
    The left and right can be found with the following equation:
    arc length = radius * (angle in radians)
    Which ends up as pi*radius for each.
    
    With the above the total length = 2*pi*radius+2*space
    
    To choose the correct equations we compare the distance traveled,
    
    0 to pi*radius is the left side.
    pi*radius to pi*radius+space is the top.
    pi*radius+space to 2*pi*radius+space is the right.
    2*pi*radius+space to 2*pi*radius+2*space is the bottom.
    
    Then we find a t (0..1) value for the side with:
    If left then t = distance/pi*radius
    If top then t = (distance-pi*radius)/space
    If right then t = (distance-pi*radius+space)/(pi*radius)
    If bottom then t = (distance-2*pi*radius+space)/space
    
    As a final step we want it to loop so we can use the % operator with the total length to do that.
    distance = (speed*time)%(2*pi*radius+2*space)
    
    If speed is negative then we need to do effectively this:
    ((a%b)+b)%b
    
    In the capx I used a function for that.
  • Ruskul

    From what I've found the js profiler indicates that hundreds of tiny js objects are accumulating over time. For some reason those object's aren't able to be gc'd, presumably because there's some reference to them still somehow. All I can get out of the profiler so far is the type of these objects (mainly array and code objects), but I haven't had any luck figuring out what they are exactly or where they came from. Also the slowdown is presumably due to the added load of the garbage collector to sort though those objects.

  • Dropbox is very stable. There's nothing you can do if the person who posts a link to a file removes it later. Any other file host could be used and there would be the same problem. I use dropbox for most of my uploaded capx files and I have no plans to transition to something else, since all the files all are still there.

    Also the capx upload feature of the forum wasn't always there, which explains why many older posts didn't utilize it.

  • The library to use depends on what file format you want to play. Taking that adpug link I posted and tweaking the js it uses a bit results in the attached capx. It uses the same method as my mod player capx'. All it does is play any file you specify. Any other features would require delving deep into the source to: A find if such a feature is possible and B. figuring out how to use it.

  • Very cool. Making a loader for a file format is always something fun to do.

  • Here's a general tutorial about that sort of thing:

    http://69.24.73.172/scirra/forum/viewto ... lit=3D+box

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The next step would be to make a plugin that runs the js code necessary to start playing sound. The js libraries usually have a working example that you'd mostly copy.

  • You can set the position and size of the video at any time with:

    windll.user32.SetWindowPos(fwnd, 0, x, y, width, height, 0x4)

    Here's all the nitty gritty about that function.

    https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

  • You could create multiple arrays and think of each array as a row. Then it can be irregular.

  • Lange

    You need to destroy fwnd instead of hwnd. hwnd is the game window.

    windll.user32.DestroyWindow(fwnd)

    I don't know if any other cleanup may be needed.