R0J0hound's Forum Posts

  • To test it out I made an example. I was trying to make the fluid stick to the walls and come down in globs.

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

    Disable event 4 to disable the sticky forces. You can also fiddle around with the spring forces to change the stickiness between the walls and other water. Unfortunately the wall stickiness only applies to one side the of wall sprites, so placing walls in the middle may not look right with the stickiness.

    In more complicated fashion here is another test. It does the fluid physics manually using a paper on sph particle fluids. I've wanted to try this for a bit, and while it's not really usable for most, I suppose this is as good a place as any to post it. If anything it's an amusing toy.

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

    It has a lot of variables you can tweak them to get differing fluid types, however the simulation can explode if you use more extreme values. The settings it currently uses were by trial and error. I haven't found any references on good presets for different fluids.

    And finally while I'm at it, here's another idea that I've tried before. The idea was to do fluids by just having spring forces pushing the particles apart. Not really successful, but for those who like to fiddle with capx's might find it amusing.

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

    It's a bit more stable if the G global is lowered.

    -cheers

  • The deceleration setting is likely changing the vector x back to 0 quickly. Which it is made to do. The solution would be to set the deceleration to 0 before setting vector x. Add a wait action then set the deceleration back up to let it move for a bit.

    ex.

    set deceleration to 0

    set vector x to 100

    wait 1.0 second

    set deceleration to 1000

    ^That will move the object 100 pixels over 1 second. You could make it only take half a second with:

    set deceleration to 0

    set vector x to 200

    wait 0.5 second

    set deceleration to 1000

    You can calculate the distance moved, vector x to use and time to use with this equation:

    distance = vectorX * time

    You just need to have two of the values and you can calculate the other by manipulating the equation.

  • The physics behavior would be the simplest way. Just use a bunch of circles. Do a search for liquid, fluid or water and you should find some examples, and even a way to make them look gelled together instead of being separate circles.

    To make it act like a thicker liquid like lava you could make an attraction force to nearby circles and walls.

  • It is still very accurate though. The error is at the 17th decimal place. The only inconvenience is making the number look cleaner when displaying it, which Aphrodite's equation will do.

  • On firefox I get 6fps moving and 50 standing. My pc is a dog.

  • Revisited and added collisions.

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

    examples25/spring_ground2.capx

    Not perfect, because speed can explode colliding with corners and objects can pass through walls if moving too fast, but it works.

  • Chigabooga

    The easiest way to do that working with physics would be to use the tilemap object.

    To make it look nicer you could used a blend effect with it to show better graphics instead of a plain color.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For the jelly look of the platforms you can use equations for springs to get a nice effect. Canvas or Paster would be needed if you want a more pleasing appearance,

    /examples25/spring_ground.capx

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

    Drag the points around.

    Collision response with a player will require more math for the collision response, but it basically boils down to checking the player's collision with the edges and pushing each other out just enough so they are no longer overlapping. There is a bit more to it but it would have to wait till I revisit this and push it further.

  • The problem with making a plugin is the need of a way to specify which edges are snappable. Unless all edges should be. So defining the edges that snap would be the nearly the same, you'd still need to specify the normal.

  • The normal is just the angle perpendicular to the edge facing out. For instance the slope (rise/run or change in y divided by the change in x) or the right edge is 2/1 and the norm slope is 1/-2. The calculation of angle from slope is angle(0,0,run,rise). Another way is to guess the angles, test and re adjust

  • The event 11 trick was so the pinned connector sprite's positions would be updated before moving.

    The reason for this is the game flow is like the following and we have to wait for the next frame for pin to run again.

    behaviors -> event sheet -> draw -> repeat.

    Wait 0 or with a very low time can be ready by the end of the event sheet, so wait with a higher value or "wait signal" worked. Although I agree it's not a very clean solution.

    The clean solution would be to do pin in events so I can update the pinned objects whenever I need.

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

    But sometimes it's easier to just make do with exiting behaviors.

  • Well, take for instance a box rotated 45 degrees. Then if you stretched it vertically relative to the screen you would get an elongated diamond. There isn't a way in C2 to stretch the box like that. Other than that the math is not bad.

  • codah

    The math for the angle was simpler than I thought, but I was messing around with it blind for a bit.

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

  • My idea would be to first have a sprite pinned to the center of snap-able each edge center of each shape. Let's call them "edge".

    Then when a shape is dropped pick the closest other edge that's closest to each of the shapes edges. Of the two pairs of edges only keep the closest. A little tedious to make events for but that would give you the two edges that would need to snap together.

    The snapping could be done by moving the dropped shape by the offset of the edges and orienting them based on the normals of the edges.

    I'm attempting to come up with an elegant event setup, so stand by for a capx.

  • spacedoubt

    You can do what you described like this,at least for the first part that is.

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

    The bounding box of a rotated triangle can be found by adding an image point at each corner of the triangle and then finding the min and max horizontally and vertically.

    And like you said you can make the bounding box only update after rotation. The only tricky part was positioning the bounding box while rotating, but there's a useful formula for that here:

    https://www.siggraph.org/education/mate ... 2drota.htm

    And while I was at it I added the ability to rotate around any point for little extra effort,

    The only aspect of that can't be done is resizing in relation to the screen, as that would introduce skewing, which C2 can't do. So you'd be limited to only resizing relative to the object.

    Edit:

    Here it is working with multiple objects. Shirt click to toggle selection.

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