R0J0's experiments

  • Hi,

    This will be a dump of various tests and examples that I haven't posted elsewhere. Enjoy.

    https://www.dropbox.com/s/29oqa2k7o1c6x ... .capx?dl=0

    A test to keep multiple moving sprites from overlapping each other or overlapping the walls. The wall collision resolution is done with the seperating axis theorem (SAT) which has the benefit of allowing the sprites to smoothly slide accross the walls. The motion is done with verlet intergration which when used with a way to push out of obsticles provides for decent boncing.

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

    A non-interactive 2d skier simulation. The slope is a randomly generated continuous curve of beizers. The skier has some manually evented physics so he smoothly goes down the slope and gets air on some hills. As a side note the only behaviour used is "scroll to".

  • Nice work <img src="smileys/smiley20.gif" border="0" align="middle" /> Great examples <img src="smileys/smiley32.gif" border="0" align="middle" />

  • I am watching something I cannot comprehend <img src="smileys/smiley19.gif" border="0" align="middle" />

    Edit: Haven't even noticed there are such things as local variables <img src="smileys/smiley1.gif" border="0" align="middle" />

  • R0J0hound

    I posted a "How do I" yesterday for something similar to your Verlet and Sat example so this is fantastic :D I have spent the last few days, trying to create something similar... I'm almost there now but with your cap file I might finally be able to crack it.

    I needed it for a sheep round up mini game as I didn't want the sheep to overlap, especially when pushed into the corner of the field.

    This couldn't have come at a better time... Cheers

  • Nice. I wish we had a forum for stuff like this, like the old "Your tutorials and example files". "Your Creations" and the tutorials section just aren't the same.

  • Amazing as always! <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Rojo, that unit separation method is really helpful.

    You are a champion.

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

    /examples20/rope_loop.capx

    An extension of my previous physics rope example. It now supports multiple ropes and rope loops. Also they are created around sprites placed in the editor for easier setup. A tip for anyone adding joints to newly created objects: you need to wait a tick so box2d updates the object's position and rotation.

  • Thought I'd add some info. for anyone trying to understand the pseudo gravity/velocity in the Ski Terrain example:

    vx = Increases going Downhill, Decreases going Uphill.

    vy = Increased Momentum = + (Moving Up Uphill)(Climb), Decreased Momentum = - (Moving Downhill)(Descent).

    g = pseudo gravity force

    ax = 0 when not moving/not on floor, Increases moving backwards up slope, Decreases moving forwards uphill.

    ay = Similar to VY, though stays above 0. That is, increases the further away from the valley you are (lowest part between hills).

    From this I gather:

    vx = Pseudo velocity on horizontal axis (x). Increases the faster you're approaching a climb, decreases as you slow down and begin moving backwards.

    vy = Similar to vx but increases the faster you fall towards the valley and decreases the slower you move up or down a slope.

    ax = Distance from valley on horizontal axis (x)

    ay = Distance from valley on vertical axis (y)

    Luckily, I fell into an inescapable valley and was able to monitor the variables ^^

    Let me know if I'm wrong about something!!

    ------

    @R0J0hound Thanks for sharing these!

    The Ski Terrain is very helpful for what I'm trying to do atm, but was wondering if you could help me to understand the events?

    I'd like to add user input to this so when the player holds a button down, the "gravity" increases(downwards force is applied). This would allow for greater speeds + air on lift-offs.

    I tried applying from 100-5000 force on the Y axis but had no luck.

  • TwinTails

    Close, vx and vy are the horizontal and vertical velocities and ax and ay are the horizontal and vertical accelerations. Also g is the acceleration for gravity. In event 10 the acceleration is used to change the velocity and the velocity is used to change the position. Of course the player only actually is moved up and down and the terrain is changed by the horizontal position.

    When the player is in the air ax is 0 and ay is g. But when the player is on the ground the acceleration's direction is changed to be along the slope.

    Here is the math behind the slope acceleration:

    http://www.physicsclassroom.com/class/vectors/u3l3e.cfm

    Increasing the acceleration would be one possible way to boost the player. Adding a event like this to the end of the event sheet will multiply the acceleration by 10 while spacebar is down.

    Key spacebar is down:

    --- player: set ax to self.ax*10

    --- player: set ay to self.ay*10

  • R0J0hound

    Thanks for clearing that up! It works great :)

    Now to add a sprite to it...

  • R0J0hound Hey, I tried to figure it out myself but having some troubles - could you outline the variables/events I have to change to make it work smoothly for a 1920 x 1080 layout please?

  • Here's a few other miscellaneous experiments, some old, some new.

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

    /examples28/boom.capx

    This is an attempt at a type of explosion. I was shooting for the look of a mortar explosion.

    No behaviors used. One interesting bit is I used a drag force on the particles that's based on their speed and size which allowed smaller particles to travel farther than the big ones which gave a nice effect.

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

    /examples28/parser.capx

    A simplish calculator that parses and evaluates a typed equation. It tells you what's wrong if the equation is invalid. I never cleaned it up so it has a lot of debug stuff in it.

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

    /examples28/event_physics3.capx

    An endeavor to implement physics for boxes without any behaviors. It's a constraint based solver based on some online guides. It's not perfect, but I learned a few things with it.

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

    /examples28/voxel_isosurface.capx

    This generates a voxel isosurface that you can rotate a bit for a 3d illusion. There's some commented out stuff for other shapes but I never updated it to work right with the latest changes of the capx. Left click destroys it.

  • Thanks R0J0hound. Nice update.

  • You are a beast.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)