R0J0hound's Recent Forum Activity

  • If it keeps sliding you have friction set to 0. That’s what your screenshot shows anyways. Set it to a value between 0 to 1 so it will slow down.

  • The order of the actions matter. Set the angle first, then move forward.

  • You won't be able to make it perfect by using a wait. I mean you can calculate how long it will take to rotate with time=(360/sprite.count)/speed, but since things update at 60fps you'll be off by 1/60sec or so which will add up. Plus, wait makes it harder to track what your events will do, which can make it hard to find the reason things aren't working.

    Conceptually you just need to rotate it a set number of degrees and then stop. Maybe with an ease?

    At any rate here is one way. The arrow keys change the goal angle, then the actual angle changes toward that. It will robustly stop at the correct angle.

    uccd8ece4ecf80bbdb5450efc762.dl.dropboxusercontent.com/cd/0/get/Ch-6FtW4lWkcqNeBQ1ITgKRrdiFFbrexTjlikezq1WBBVmguWKWNk3YPQzHPZM_lI5ClHWL3B4iTeRijrht_CiAd3gN86u_qGbWo1LlwVqUQfok1BImPryK2KNprCEZQ9gAzq8PyGy0iiybTAAfFrLXT/file

    There may be a simpler way too, but this should be simple enough to understand so you can use it in your project and customize.

  • The idea is the pinned object is just a bit bigger to visually hide the gap. All interaction/collision would be with the object underneath.

  • Looks like you can do it by recursively picking each child and adding up all the child counts. Simpler enough if all the object types are the same from the looks of it but it would complicate things with differing types.

    Function descendentCount(uid)
    Sprite: Pick by uid: uid
    — local number count
    — set count to sprite.childCount
    — Repeat count times
    — sprite: pick “sprite” child loopindex
    — — add descendentCount(sprite.uid) to count
    — set return to count

    Or depending on how the js api lets you access children it may work better because it doesn’t care about object types.

    function descendentCount(obj)
    {
     let count = obj.children.length;
     for(let i=0; i<obj.children.length;i++) {
     count+=descendentCount(obj.children[i]);
     }
     return count;
    }
  • There’s nothing amiss. The physics engine has a thing called “slop” where it adds a slight gap between objects to make the simulation more robust. Anyways, this isn’t controllable in construct.

    A solution is to make the collision polygon slightly smaller so the gap isn’t visible. A more exact solution would be to have an a separate object pinned to the physics object. Just add 1 to the height and width.

    At least that’s an immediate solution based on what we can do.

  • The random(1) expression causes the “for each ordered” to loop over the instances in a random order. The loopindex is 1 when it’s on the second instance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Another way that is useful in some situations is:

    For each sprite ordered by random(1)

    — do stuff

    — compare: loopindex=1

    — — stop loop

  • The effect does the outline by shifting copies of the image in four directions. So the corners would look off.

    I may have remembered wrong. It may be 8 directions and the diagonals had sqrt(2) multiplied by it.

    Anyways, I haven’t touched in a long time. Not sure how to get more perfect results.

  • Looping over all the tiles should only be needed to be done once to get the count and update the edges.

    After that you can easily update the count as you add/remove tiles. You can also update the edges by only looking at the tiles around the tiles that changed.

    If a high amount of tiles change then you may not want to update the edges around each one. Instead you could just update the edges of all the tiles on screen.

    Outside of events, if you can do the update via JavaScript it would be way quicker with the loop. The trick is finding a way to accomplish it

  • I’m not sure how c3 does the tweening, but you can do it with an expression. First you have a variable t that will increase with a constant rate from 0 to 1. In the following it does it over 2 seconds. Then to do the ease/out you can use the cosp() expression. But there are other ways.

    Var global=0

    Var t=0

    Every tick

    — set t to min(1, t+dt/2)

    — set global to cosp(0, 100, t)

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound