R0J0hound's Recent Forum Activity

  • socialpilgrim

    As rex said you could use the asjson expression to load the image into a array for faster comparison than using rgbAt().

    Here's an example with three examples:

    https://www.dropbox.com/s/5c5ei994g3fjt ... .capx?dl=1

    /examples30/imageCompare.capx

    Since it's for a drawing competition I find that just comparing the alpha gives a more meaningful percentage. Just checking all the pixels like with your links gives a 90% similarity to a blank canvas.

    Anyways I implemented three methods in the capx.

    The first follows the examples in your links and gives a percentage and rms number. I guess rms could be used as a way to compare.

    The second only looks at the colored areas of both images and gives a pretty good measurement.

    The last one finds the bounds of both drawings and compares both as if they were the same size. This allows a small box to match a big one.

  • neverk

    There's a fix for that here:

    I haven't put the fix in the plugin link yet.

  • JoaoCesar

    If you want to distort the paster's texture itself you'll need a second paster object to draw to.

  • I've found a spring works better than a pivot joint in situations where you want to drag the object around. I think I had a example in the first few pages of the plugin.

    Other things you could try:

    *set a max force for the joint. By default a force up to infinity can be exerted on the objects to make the joints match. By setting it lower it would make the joint more relaxed and keep it from pulling into another object.

    *increase the iterations of the simulation. This is a performance trade off. The higher the iterations the simulation will get closer to converging on a perfect solution. Personally I never mess with it, instead I do other things like above.

  • Best I know those are local points relative to the top left of the unrotated and unscaled object. It could be center too, you'd just have to test it. Worst case it would be relative to the hotspot.

    Just a thought, I haven't looked at your code but it might be enough to just call update_bbox() after changing the hotspot.

  • For doing it in event 2 of your pic...

    the object would be numwagon2

    The first expression would be: numwagon2.animationframe=numwagon.animationframe|numwagon2.animationframe=numwagon3.animationframe

    The comparison would be "="

    and the second expression would be 1

  • You could use a system->"pick by comparison"

    with an expression like:

    numwagon.animationframe=numwagon2.animationframe | numwagon.animationframe=numwagon3.animationframe[/code:3klcw15a]
  • You can also draw a distorted texture with the paster plugin:

    I've used it for 3d here:

  • You may try looking in this plugin here:

    In it there's an action to move the origin around and the collision polygon is updated. Maybe that could be a reference.

  • Saitama

    For me the error is "Cannot read property 'c2obj' of undefined".

    Looking at your event, when you create the joint you set "Object2 UID" to 2.

    The wire does have a uid of 2 but it doesn't have the chipmunk behavior. You can only create joints between objects with the chipmunk behavior.

    In my example I used -1 for "object2 uid". That means just connect to a fixed location on the layout. The wire in my example didn't have the physics behavior either, it was just for a visual.

  • All the instances of a sprite share the same animation images. The current frame of an instance just references which image of that sprite object is used. So when you load a image from a url it replaces the shared image.

    In other words say your sprite is named "sprite" and it has three animation frames.

    Sprite object:

    frame 1

    frame 2

    frame 3

    Next you have four instances, all which use frame 1.

    sprite instance 1 -> frame 1

    sprite instance 2 -> frame 1

    sprite instance 3 -> frame 1

    sprite instance 4 -> frame 1

    So now if you use the "load image from url" action the instance's image isn't replaced (instances only reference images), instead the "sprite" type's image is replaced.

    You can't add a frame on the fly with the sprite object. You could just set each instance to use a different frame, but yeah you do need to add them at edittime.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The problem is getting a good function name from all the actions and conditions, since they are mostly just sentences and there isn't any real consistency. I guess the function names from the runtime could be used, but I imagine some plugins could have some names completely different from the action/condition. Construct Classic allowed python scripting which allowed you to do this to an extent, but you couldn't do the same thing as with events.

    Beyond that point the idea of a typed scripting version of events was proposed before and one argument against it was needing to deal with the syntax and typos of such a language, which is a task in and of itself. Kind of a different beast to what C2 does already.

    You could unofficially do this already though, by generating event xml files. But it is a lot of work as I see it.

    It has the same issue as trying to convert a capx file to say c++ source code: It's simple on a very small scale, but to support everything, fix bugs and support changes as C2 updates it becomes a ridiculous task.