Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make my sprite move based on this graph formula?
- ThunderNox
-
Scratcher
53 posts
How do I make my sprite move based on this graph formula?
Hello, I need help with a new project I'm working on. I want to make a sprite to move like this:
https://ibb.co/4JZ8YsH
The function is this: y = abs(cos(x))*10
https://ibb.co/4JZ8YsH
The function is this: y = abs(cos(x))*10
- TheAnomalousPseudo
-
Scratcher
1000+ posts
How do I make my sprite move based on this graph formula?
Try putting the coordinates of the graph for one period into a list and have it go to those coordinates whenever you need it to be moving.
- nyankatpro
-
Scratcher
500+ posts
How do I make my sprite move based on this graph formula?
Try this:
set x to (-240)
repeat (480)
set y to (([abs v] of ([cos v] of (x position)))*(10))
change x by (1)
end
- Theo_1er
-
Scratcher
500+ posts
How do I make my sprite move based on this graph formula?
I suggest to scale because cosine has a max value of 1 and a period of 360°.
set y to ((100) * ([abs v] of ([cos v] of ((4) * (x position)))))
- Discussion Forums
- » Help with Scripts
-
» How do I make my sprite move based on this graph formula?
