Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with swinging
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
https://scratch.mit.edu/projects/323440300/editor/
In this project, I need to do a sort of swinging script for the arms of the player, so when the player walks, the arms swing back and forth.
In this project, I need to do a sort of swinging script for the arms of the player, so when the player walks, the arms swing back and forth.
- DD-8861
- Scratcher
100+ posts
Help with swinging
The swinging script you have is pretty good, just know that the sine of a number will always be between -1 and 1. So in your script, the arms direction will always be between 89 and 91 degrees. So they are moving, just so small motion that you can barely see it. To fix this, add in some multiplier to make the swing more noticable.
(((10) * ([sin v] of ((timer) * (700)))) + (90))//I just took your original script and put in a 10*
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
This is perfect! Thank you, I've implemented the code but the arms move abnormally, is there any way to make the arms look more natural? (Eg. left arm forward and right arm back and vice versa).
- Rocket-Flier
- Scratcher
100+ posts
Help with swinging
To make one arm move forward and the other backwards change the script in one of the arms to:
((((10) * ([sin v] of ((timer) * (700)))) * (-1)) + (90))This will reverse the motion.
This is my signature. It appears underneath everything I post.
An evil kumquat tried to eat my siggy! Good thing I have a potato siggy defender.
OH NO!!! I forgot to restock on cat block repellent.
It looks like you found some invisible text!
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
ah perfect, tysm, is there any way for the arms to not snap back into position in my script? thanks in advance.
- Rocket-Flier
- Scratcher
100+ posts
Help with swinging
I realized that you can also do this instead: To make one arm move forward and the other backwards change the script in one of the arms to:((((10) * ([sin v] of ((timer) * (700)))) * (-1)) + (90))This will reverse the motion.
(((-10) * ([sin v] of ((timer) * (700)))) + (90))
This is my signature. It appears underneath everything I post.
An evil kumquat tried to eat my siggy! Good thing I have a potato siggy defender.
OH NO!!! I forgot to restock on cat block repellent.
It looks like you found some invisible text!
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
I've just implemented that too and it sorta doesn't look right, any suggestions? (This is the most advanced code ive done in a long time xD)I realized that you can also do this instead: To make one arm move forward and the other backwards change the script in one of the arms to:((((10) * ([sin v] of ((timer) * (700)))) * (-1)) + (90))This will reverse the motion.(((-10) * ([sin v] of ((timer) * (700)))) + (90))
- Rocket-Flier
- Scratcher
100+ posts
Help with swinging
Try changing both of the scripts in only one of the sprites.
This is my signature. It appears underneath everything I post.
An evil kumquat tried to eat my siggy! Good thing I have a potato siggy defender.
OH NO!!! I forgot to restock on cat block repellent.
It looks like you found some invisible text!
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
wdym? could you give a little more detail please?
- Rocket-Flier
- Scratcher
100+ posts
Help with swinging
Keep all of the tens positive in the right arm's script and make them negative in the left arm's script.
This is my signature. It appears underneath everything I post.
An evil kumquat tried to eat my siggy! Good thing I have a potato siggy defender.
OH NO!!! I forgot to restock on cat block repellent.
It looks like you found some invisible text!
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
makes it look weird again now Keep all of the tens positive in the right arm's script and make them negative in the left arm's script.
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
Nvm I've gotten used to it, I like it, tysm!
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
I've found a problem, the avatar's head and arms sink ever so slightly each bounce. pls send help
- deck26
- Scratcher
1000+ posts
Help with swinging
You created another topic and I've responded there - best not to confuse things with duplicate topics. guys?
- GingieDoesCoding
- Scratcher
100+ posts
Help with swinging
sorry, I thought this thread was closed or somethingYou created another topic and I've responded there - best not to confuse things with duplicate topics. guys?
- codeman1044
- Scratcher
1000+ posts
Help with swinging
You can close this thread if you want. There should be a Close topic button beneath the text box in the bottom left of the page. Once you close the topic, it cannot be reopened (unless it's reopened by the ST) and cannot be posted on.
This is my signature, which shows up every time I post and is automatic. To make a signature of your own, locate the “Change your signature” option in the bottom left of the Discussion Home.
I am nothing if not consistently inconsistent.
Snap! is a website that offers block coding like Scratch, but also offers the creation of your own blocks and writing JavaScript functions. The adventurous should consider checking it out!
Potentially useful tutorials and topic coverage
If you want to see a new tutorial added to this, feel free to leave a suggestion on my profile.
- nightslasherXD30
- Scratcher
1 post
Help with swinging
hi um i need help with a swinging script i dont know how to do it ive looke up every thing how do i do it
- Discussion Forums
- » Help with Scripts
- » Help with swinging