Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Trying to figure out how to convert this code into scratch code
- No-Sider
-
Scratcher
100+ posts
Trying to figure out how to convert this code into scratch code
This code specifically

If it helps, heres the videos it came from
https://www.youtube.com/watch?v=v3zT3Z5apaM&t=7s&ab_channel=Matt%27sRamblings
https://www.youtube.com/watch?v=rTsXO6Zicls&t=3s&ab_channel=Matt%27sRamblings
The things I am having MOST trouble with is dealing with the vectors, (vel & wishdir)
I believe I know what to do for dot product of vel and wish dir, but I am NOT sure what to do for the last line
Does anyone know what it means “wishdir * addspeed”. I dont know what wish dir is suppose to represent,
coords, a value, idk

If it helps, heres the videos it came from
https://www.youtube.com/watch?v=v3zT3Z5apaM&t=7s&ab_channel=Matt%27sRamblings
https://www.youtube.com/watch?v=rTsXO6Zicls&t=3s&ab_channel=Matt%27sRamblings
The things I am having MOST trouble with is dealing with the vectors, (vel & wishdir)
I believe I know what to do for dot product of vel and wish dir, but I am NOT sure what to do for the last line
Does anyone know what it means “wishdir * addspeed”. I dont know what wish dir is suppose to represent,
coords, a value, idk
- NeonG4
-
Scratcher
1000+ posts
Trying to figure out how to convert this code into scratch code
snipwishdir is the average of the keypresses.
If I press the up arrow, wishdir is 0. Likewise, if I press the right and down keys, wishdir is 135. https://youtu.be/v3zT3Z5apaM?t=73
- No-Sider
-
Scratcher
100+ posts
Trying to figure out how to convert this code into scratch code
double snip
But, hypothetically, if we pressed down and right and wishdir = 135, wouldnt multiplying it to addspeed in the last line add a huge value to vel (being well over the thosands)? This code is suppose to give a speed boost, but it doesnt increase speed THAT much.
- NeonG4
-
Scratcher
1000+ posts
Trying to figure out how to convert this code into scratch code
Try it out! If it does give a large speed boost, then something isn't right.double snip
But, hypothetically, if we pressed down and right and wishdir = 135, wouldnt multiplying it to addspeed in the last line add a huge value to vel (being well over the thosands)? This code is suppose to give a speed boost, but it doesnt increase speed THAT much.
- No-Sider
-
Scratcher
100+ posts
Trying to figure out how to convert this code into scratch code
TRIPLE SNIP
I have tried to remake this code before coming to the forums, and doing a bit more research, some other document talking about strafe movement, wishdir can be as low as a value of ~ 0.0321 to be multiplied to addspeed. So yeah, a value of 135 WOULD be too large unfortunately.
But even with that small value mentioned above, I still cant seem to get past the problem that this code gets called upon every frame, so regardless of wishdir value, the vel value just snowballs into a HUGE number.
- NeonG4
-
Scratcher
1000+ posts
Trying to figure out how to convert this code into scratch code
quad snipIt might be a percentage of the whole. Idk, I'll do some research.
- Discussion Forums
- » Help with Scripts
-
» Trying to figure out how to convert this code into scratch code

