Discuss Scratch

HeathPitt
Scratcher
14 posts

How to calculate G-Forces in Scratch

Hello, and thanks for dedicating your time to this. I am currently working on a project where if you accelerate a car, the G-Force increases, and when you turn or brake, the G-Force also goes up. I have a basic idea about the formula, but cannot quite get it working. Could someone please help? Any help would be appreciated.

This is my basic formula:

when green flag clicked
set [Distance] to [0]
set [Average Acceleration] to [0]
set [G Force] to [0]
forever
set [G Force] to (([Average Acceleration]) / (32.175197))
set [Average Acceleration] to (([Distance]) / ([Time]))
set [Time] to (timer)
if <key [w] pressed?> then
repeat until <not <key [w] pressed?>>
change x by (-3)
change [Distance] by (2.5)
end
end
if <key [s] pressed?> then
repeat until <not <key [s] pressed?>>
change x by (3)
change [Distance] by (2.5)
end
end
Have a good day

Last edited by HeathPitt (Aug. 23, 2021 06:00:14)


griefercube
Scratcher
500+ posts

How to calculate G-Forces in Scratch

Put your g force thing inside both of the repeat until blocks?


sometimes, you just have to change a way of thinking to solve a problem. -griefercube
|other projectshow I made the banneranimated thumbnails?i’m on wiki!Cubey Mines|

Last edited by griefercube (32th Undecimber, XXXX)


https://turbowarp.org/563693837/editor (something i did a while back don’t worry it’s for the banner)

list of working bbcodes:

[color=]
[scratchblocks]
[url=]
[img]
[center]
[code]
[code=]
[list]
[quote]
[b]
[i]
[u]
[s]
[big]
[small]
[p]
[wiki]
[google]
griefercube
Scratcher
500+ posts

How to calculate G-Forces in Scratch

Hope that helped. I don’t know much about these stuff


sometimes, you just have to change a way of thinking to solve a problem. -griefercube
|other projectshow I made the banneranimated thumbnails?i’m on wiki!Cubey Mines|

Last edited by griefercube (32th Undecimber, XXXX)


https://turbowarp.org/563693837/editor (something i did a while back don’t worry it’s for the banner)

list of working bbcodes:

[color=]
[scratchblocks]
[url=]
[img]
[center]
[code]
[code=]
[list]
[quote]
[b]
[i]
[u]
[s]
[big]
[small]
[p]
[wiki]
[google]
HeathPitt
Scratcher
14 posts

How to calculate G-Forces in Scratch

griefercube wrote:

Hope that helped. I don’t know much about these stuff
Yeah. It's already in the forever loop so it won't change it. Plus, it won't decrease when it is stationary, so it would be unrealistic, wouldn't it?

HeathPitt
Scratcher
14 posts

How to calculate G-Forces in Scratch

Thanks for trying anyway. I love the scratch community. I've been on here for years, just on different accounts. I've seen Scratch go from 1.0 all the way up to 3.0 now.

Last edited by HeathPitt (Aug. 23, 2021 06:08:37)


Powered by DjangoBB