Discuss Scratch

X-15
Scratcher
51 posts

Great arc scipt

One of my first difficulty when I first started scratch was getting a proper arc script and I experimented with many unsuccessful attempts. Recently I have noticed lot of good projects that struggle with a basic arc script or the physics are a bit off. I will show you a simple and effective way to do it. You can use this script without permission, but a link to this page would be nice. You can customize this script to suit your projects needs like using arrow keys to control force ect…

when I receive [shoot]
set [force] to <distance to [mouse pointer]>
set [Xspeed] to (([sin] of (direction)) * (force))
set [Yspeed] to (([cos] of (direction)) * (force))
repeat until <<touching [ wall] ?> or <touching [ object] >>
change [Yspeed] by (-1)
change x by (Xspeed)
change y by (Yspeed)
end

if you also want it to have proper rotation (for example an arrow) add this script in the loop.

point in direction ([atan] of ((Xspeed) / (Yspeed)))
if <[Yspeed] < [0]> then
turn cw (180) degrees
end
Here is a project I made to demonstrate Bow physics , Hope it helps!
pastelistic
Scratcher
500+ posts

Great arc scipt

Thank you, that's very helpful
Dogtor
Scratcher
12 posts

Great arc scipt

Oh, well that helps! I tried making an arrow script and even with a gigantic amount of power, it just fell! Thanks!
SuperFunnyStuff
Scratcher
2 posts

Great arc scipt

Thanks! I will use this in my upcoming project, Cannonball! I'll make sure to give credit to you, of course!
Capsulateflyer8
Scratcher
9 posts

Great arc scipt

thanks alot!

define (thank you)
set [ THANKS ALOT] to [1000022425845 ]
SuperFunnyStuff
Scratcher
2 posts

Great arc scipt

when [people helping mev] > (999)
say [OMGOMGOMMGM!!!!!1!!!!!!!!!1 THX!]
Alice74Love
Scratcher
2 posts

Great arc scipt

X-15 wrote:

Cool!

when I receive [shoot]
set [force] to <distance to [mouse pointer v]>
set [Xspeed] to (([sin v] of (direction)) * (force))
set [Yspeed] to (([cos v] of (direction)) * (force))
repeat until <<touching [ wall v] ?> or <touching [ object v] >>
change [Yspeed] by (-1)
change x by (Xspeed)
change y by (Yspeed)
end

if you also want it to have proper rotation (for example an arrow) add this script in the loop.

point in direction ([atan] of ((Xspeed) / (Yspeed)))
if <[Yspeed] < [0]> then
turn cw (180) degrees
end
Here is a project I made to demonstrate Bow physics , Hope it helps!
LangfordH01
Scratcher
3 posts

Great arc scipt

(me) say [you awesome!! thanks so much!!!] for (83857345874395734584759857923485) years
Capsulateflyer8
Scratcher
9 posts

Great arc scipt

say [Beat that LangfordH01] for (479165846598356713571) millenniums
Light_11
Scratcher
2 posts

Great arc scipt

THANK YOU SO MUCH!!!THATS HOW HAPPY!
Phanthomphax
Scratcher
73 posts

Great arc scipt

Great
TurtlesGo
Scratcher
1 post

Great arc scipt

noahScript
Scratcher
27 posts

Great arc scipt

thanks!
noahScript
Scratcher
27 posts

Great arc scipt

THX
Ajpuff5
Scratcher
14 posts

Great arc scipt

when green flag clicked
say [cool]
Mr_Twenty_7
Scratcher
2 posts

Great arc scipt

I've been trying to figure out a good arc script, thank you so much! I'm going to be studying this script and the math behind it.
teaparty05
Scratcher
2 posts

Great arc scipt

when green flag clicked
forever

if <key [left arrow] pressed?> then
change x by (-10)
end
if <key [ right arrow] pressed?> then
change x by (10)
end
end
forever

play sound [xylo2]
end
Allie016
Scratcher
7 posts

Great arc scipt

I've been trying to do an arching game, for like, forever. This is so helpful! Thank you
Capsulateflyer8
Scratcher
9 posts

Great arc scipt

Capsulateflyer8
Scratcher
9 posts

Great arc scipt

when green flag clicked
set [ THNX] to [320714305443979561085614751459 ]

Powered by DjangoBB