R0J0hound's Forum Posts

  • For using only 4 directions you need to round to the nearest 90 degrees like this.

    viewtopic.php?f=147&t=109106&p=798244&hilit=angle+round#p798244

    For stopping you need to check each grid spot in the direction of motion. Here I added 32 to the distance to move for each free spot and stop once I come to a spot that isn't free.

    The checking is accomplished with overlapping at offset in a loop. I used a little trig but you could just duplicate the loop 4 times depending on the direction and use (32,0) and such directly. One slight technical thing I used was scaling the object being swiped down before the check loop and and back up after. This is to overcome the fact that adjacent sprites will count as overlapping.

    https://www.dropbox.com/s/3sh6btc51vzss ... .capx?dl=0

  • Here's a way to see how far a object has rotated

  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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