R0J0's experiments

Show us your completed creations made in Construct 2

Post » Tue Nov 26, 2013 6:26 pm

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".
Last edited by R0J0hound on Mon Apr 03, 2017 9:09 pm, edited 1 time in total.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Tue Nov 26, 2013 7:18 pm

Nice work Great examples
B
49
S
15
G
6
Posts: 534
Reputation: 7,195

Post » Tue Nov 26, 2013 7:24 pm

I am watching something I cannot comprehend

Edit: Haven't even noticed there are such things as local variables Katala2013-11-26 19:30:06
B
34
S
9
G
3
Posts: 517
Reputation: 5,226

Post » Tue Nov 26, 2013 8:37 pm

@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

B
8
S
3
G
1
Posts: 34
Reputation: 1,395

Post » Tue Nov 26, 2013 8:51 pm

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.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Tue Nov 26, 2013 10:08 pm

Amazing as always!
B
123
S
43
G
41
Posts: 846
Reputation: 28,204

Post » Wed Nov 27, 2013 8:49 pm

Thanks Rojo, that unit separation method is really helpful.

You are a champion. GenkiGenga2013-11-27 20:49:45
ImageImage
B
118
S
23
G
7
Posts: 1,070
Reputation: 12,964

Post » Wed Dec 04, 2013 9:14 pm

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.
Last edited by R0J0hound on Tue Jul 18, 2017 8:28 pm, edited 1 time in total.
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Sun Dec 08, 2013 6:59 pm

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.TwinTails2013-12-08 19:01:42
B
25
S
6
G
3
Posts: 197
Reputation: 3,355

Post » Mon Dec 09, 2013 5:34 am

@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*10R0J0hound2013-12-09 05:37:29
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Next

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 5 guests