Discuss Scratch

Wrxth
Scratcher
11 posts

How to make something move in a circle without rotating it

hey im trying to make a game and i need help making my sprite move in a circle without rotation so it doesnt look wierd and i was wondering if anyone knows a NOT super hard i repeat NOT super hard way to do it because i want to understand how it works so i can remember it for when i use it next
thanks!

MookyE
Scratcher
100+ posts

How to make something move in a circle without rotating it

if you dont want it to rotate the costume, just set the rotation mode to {dont rotate} while making the circle
set rotation style [dont rotate v]
LittleHeroFish
Scratcher
100+ posts

How to make something move in a circle without rotating it

Wrxth wrote:

hey im trying to make a game and i need help making my sprite move in a circle without rotation so it doesnt look wierd and i was wondering if anyone knows a NOT super hard i repeat NOT super hard way to do it because i want to understand how it works so i can remember it for when i use it next
thanks!


if you don't want to use the rotation style, you could use a direction variable and move in that direction using trig
The_Imaginarium
Scratcher
1000+ posts

How to make something move in a circle without rotating it

probably the most intuitive way to rotate a sprite in a circle would be to

set [dir v] to [0]
forever
rotate // make sure to check the box that says "run without screen refresh"
end

define rotate
go to x:(x of midpoint :: #969696) y: (y of midpoint :: #969696)
point in direction (dir) // points in the current direction of rotation
move (radius :: #969696) steps // moves the radius
point in direction (90) // returns to the normal direction
change [dir v] by (speed :: #969696) // changes angle

You can replace the grey boxs with the desired values

One example would be:


set [dir v] to [0]
forever
rotate // make sure to check the box that says "run without screen refresh"
end

define rotate
go to x:(50) y: (50)
point in direction (dir) // points in the current direction of rotation
move (50) steps // moves the radius
point in direction (90) // returns to the normal direction
change [dir v] by (3 )// changes angle


I recommend playing around with it for a while to get comfortable with it.

Last edited by The_Imaginarium (Dec. 9, 2021 21:08:31)

Wrxth
Scratcher
11 posts

How to make something move in a circle without rotating it

i said without rotating the sprite i want it to orbit the center of the screen without rotating the sprite

edit: sorry i didnt see the thing that returns it to the normal direction ty

Last edited by Wrxth (Dec. 10, 2021 16:04:03)

Wrxth
Scratcher
11 posts

How to make something move in a circle without rotating it

ty guys ill try the dont rotate style

Last edited by Wrxth (Dec. 10, 2021 18:23:15)

joaolmkimbr
Scratcher
16 posts

How to make something move in a circle without rotating it

There's another way to do this with a little math that's a bit more complicated:

Set x to (RADIUS*Sin(ANGLE))
Set y to (RADIUS*Cos(ANGLE))

So one simple program that does it is:

Set angle to (0)
Forever {
Set x to (10*Sin(angle))
Set y to (10*Cos(angle))
Change (Angle) by 10
}
Rcoder510
Scratcher
37 posts

How to make something move in a circle without rotating it

This is the most easiest way I know.
Here is the script:
when green flag clicked
set rotation style [don't rotate v]
repeat (100)
turn cw ((360) / (100)) degrees
move (. . .) steps
end
I am not sure about the others, but if you want the whole program NOT to rotate the sprite, this will be the script you could use.
Wrxth
Scratcher
11 posts

How to make something move in a circle without rotating it

i said not comlicated or hard @joaolmkimbr
duckmanbonk
Scratcher
1 post

How to make something move in a circle without rotating it


define women

Last edited by duckmanbonk (Nov. 23, 2023 01:35:53)

ItBeJC
Scratcher
1000+ posts

How to make something move in a circle without rotating it

duckmanbonk wrote:

define women
Please don't necropost.
…but I'd be lying if I said I didn't smirk at that

Powered by DjangoBB