R0J0hound's Forum Posts

  • I apologize I looked at it again and I misspoke, it should have been event 12.

    https://dl.dropboxusercontent.com/u/542 ... inFix.capx

  • SgtConti

    Can you provide more details or a capx where it occurs? I don't get an error when using two sprites. Although tiledBg does seem to have an issue when the hotspot is top-left.

    I've been on a break from coding for a bit, but I should be resuming soon.

  • In the example i did before its just another floodfill. It's started by picking the top row gems, then a flood fill is done and anything that's not picked is not connected.

  • Agreed it's better using the physics because it does a lot for you, but it never hurts to lean something new.

    The formula that correlates velocity to angular velocity is:

    displacement x velocity = angular_velocity

    Where "displacement" is a vector from the pivot to the point of collision and "x" is a vector cross product. "w" will be in radians/sec so we'll need to convert it to degrees/sec by multiplying by 180/pi.

    (displacement x velocity)*180/pi = angular_velocity

    So to finish it up the displacement vector can be calculated with:

    dispX = collisionX - pivotX

    dispY = collisionY - pivotY

    Also a 2d vector cross product can be defined as:

    v1 x v2 = v1x*v2y - v1y*v2x

    So them combining those you get a lovely formula like this:

    ((collisionX - pivotX)*vy - (collisionY - pivotY)*vx)*180/pi = angular_velocity

    "vx" and "vy" are the x and y components of velocity. Depending on the behavior used you can also get vx and vy from speed and angle_of_motion:

    vx = speed * cos(angle_of_motion)

    vy = speed * sin(angle_of_motion)

    So to use the formula you could make a collision event when a bullet collides with sprite, and use the bullet's position for collisionX and collisionY.

    Now all we have is a way to convert linear motion to angular but it's not enough for it to look realistic. For that you'll need to use momentum and kinetic energy to calculate a collision response. There's info on it elsewhere but the formulas get kind of lengthy and really it's one of the main reasons it's much easier to use an existing physics engine.

  • Joannesalfa

    You need to reset "picked" and "visited" to false every time before doing the floodfill. Doing it in event 13 works.

  • I have it check if the bounding quads overlap since there's no need to paste if the object won't show. I assumed that disabling collisions wouldn't affect it. Since that doesn't seem to be the case then it will have to wait till I have time to find a fix.

    Cheers

  • Hi,

    Late reply but the main difference between this and the tiledbg is tiledbg repeats the texture and this plug does not. It works with a single drawimage call with a sub rectangle, nothing fancy.

  • Hi,

    This worked only with a very early version of c2, and even then it didn't too much other that convert over layouts with sprites, tiledbg and text objects as I recall. It didn't do events, however I was able to convert some of the events in an unreleased version. To get it working with c2 now I'd have to reexamine the capx file format, update my capreader python lib to yield decoded events from cap files more easily, and add a table to help conversions from one event to another.

    The main issue is that c2 doesn't have some features of cc and some things work differently. I was initially waiting for more feature parity to update but I may not since this is something that will take a lot of tedious work for little benefit. However for the most part cc events are like c2 events so it's simple enough to as a user make events like the other.

    I may eventually update the capreader library some more. It provides a way to access the contents of caps which could be useful for making another exporter or IDE for cc. But then again it may be simpler still to start from scratch...

    Anyways to sumerize: an update is unlikely however you can manually convert over most projects.

    -cheers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think you'll probably need to consider more than just the one closest wall. One works good like you said for outward angles, but for inward corners you could use the average of the two wall's angles as the angle to push out. Or you could pick the two walls in order of closeness and push out of of each one at a time. Of course with that you'd need to make your own "push out" events.

  • I found a formula for it called the Box-Muller transform, and it looks like this:

    NormalRandom = mean + sqrt(std_deviation * -2 * ln(1 - random(1))) * cos(360 * (1-random(1)))

    Works pretty good in tests:

    https://dl.dropboxusercontent.com/u/542 ... andom.capx

    Edit:

    didn't look at your link till now.

  • R0J0hound

    I assume there will be an option to change Mass at runtime ?

    yep

  • The only workaround is to use an array "for each element" to set the text on your own editbox.

  • Yes, "else" is bugged in some cases in CC, but "or" is worse.

  • Doc Ai

    You could use the Paster plugin so the object count doesn't increase.

    https://dl.dropboxusercontent.com/u/542 ... aster.capx

    Also it appears you need to use str(E_xdistance) when setting the text instead of E_xdistance. Would be a good topic for a bug report.

  • Uploaded beta #2.

    + Got circle and polygon collisions working. However concave polys are currently just converted into convex hulls.

    + It works now if the origin is off center.

    + Added joint I forgot (rotary limit joint).

    There were a couple issues that came up that took longer to work around than expected. As a side effect body sleeping may not be possible now, but we'll see.

    newt

    Don't need to teach a guy that can roundhouse kick his keyboard and get millions of lines of error free code.

    granpa

    Thanks.

    Joannesalfa

    SgtConti

    I'm not really going for speed, but function. But it could be interesting to benchmark when it's done*.

    SgtConi, changing the collision shape at runtime is more along the lines of changing the collision type. ex. None,Box,Circle or Poly. Changing the points of the collision polygon is another deal, which could prove tricky since chipmunk2d only works with convex polygons.