How do I calculate the y distance dragged.

Get help using Construct 2

Post » Sun Nov 27, 2016 8:09 am

Hi! Can anyone help me on this? I want to drag an object from a platform to a hight and calculate that high as the distance traveled when free falling from that hight to ground... I use a stopwatch for calculating the time and want to confirm the equation h=1/2gt^2
B
14
S
1
Posts: 66
Reputation: 771

Post » Sun Nov 27, 2016 8:12 am

on drag start save the current Y (tempY)
on drag drop calculate (tempY - current Y)
Image Image Image
B
42
S
22
G
15
Posts: 375
Reputation: 12,221

Post » Sun Nov 27, 2016 9:49 am

Thank you but i don't meen that exactly. The distance i find with this calculation is not the distanse travelled on free fall (y=1/2gt^2). As you see h is different from y. I want them to be equal when object hits ground. I include the .capx file to help.

https://drive.google.com/file/d/0Byb2YP ... sp=sharing
B
14
S
1
Posts: 66
Reputation: 771

Post » Sun Nov 27, 2016 11:30 am

Sorry, i don't have the needed plugin...
You have to be more specific with your idea to understand your problem...
Image Image Image
B
42
S
22
G
15
Posts: 375
Reputation: 12,221

Post » Sun Nov 27, 2016 4:05 pm

I have an object on object.Y = 400. I drag that object to object.Y = 50. The distance is 350 ( I don't change the object.X). Then I drop the object and let it do a free fall to object.Y = 400 again. Based on constant timer (every tick add dt to timer) I calculate the fall distance as y=(1/2)*10*timer*timer. How can I match this distances?
B
14
S
1
Posts: 66
Reputation: 771

Post » Sun Nov 27, 2016 5:39 pm

You are assuming you know the number that C2 actually uses for G. Doing an experiment to reverse engineer the number, comes up with a factor of 4.7 for your simulation. Also, your starting coordinate is not 470, the center of the sprite is 459, so that is your distance reference.
http://www.blackhornettechnologies.com/Construct2Stuff/freefall_BHT.capx
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Sun Nov 27, 2016 8:20 pm

Great!!! Thank you for your help!!!
B
14
S
1
Posts: 66
Reputation: 771


Return to How do I....?

Who is online

Users browsing this forum: blue visionary, namaewayukidesu and 9 guests