This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-02-25 18:09:14

MaryLeeH
New Scratcher
Registered: 2013-02-25
Posts: 3

Need balls to rotate around x 0, y 0

I am trying to make a series of sprites circle the screen in a constant circle

The idea is that the image of 'me' is part of a rotating back ground to give the impression of 'juggling'. I want to put several sprites on the screen that go around x 0, y 0 at a gentle, constant rotation counter-clockwise.

Any ideas for me to use would be great!

Thank you!

Offline

 

#2 2013-02-25 18:20:24

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Need balls to rotate around x 0, y 0

I wish I could simplify it, but you can use this engine:  http://scratch.mit.edu/projects/Kileyme … est/872439

Which is designed to make sprites rotate around specified points on the stage.  I would elaborate, but I'm short on time, I hope the notes in the project can clear it up.


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#3 2013-02-25 21:27:31

piguillaud
Scratcher
Registered: 2010-06-19
Posts: 100+

Re: Need balls to rotate around x 0, y 0

use trig! or put the sprite center in the middle

Offline

 

#4 2013-02-27 17:08:25

bob6
Scratcher
Registered: 2010-07-01
Posts: 100+

Re: Need balls to rotate around x 0, y 0

Let me define some variables first.
direction: the number of degrees the ball is relative to the point it is spinning around. For example, having the ball directly right to the rotation point is 0 degrees, having it on top is 90 degrees, and so on.
distance: the distance of the ball from the rotation point.
xVal: the x value of the rotation point
yVal: the y value of the rotation point

when gf clicked
set [direction v] to (0)
set [distance v] to (50)
set [xVal v] to (50)
set [yVal v] to (50)
forever
   go to x: ((xVal)+((distance)*([cos v] of (direction)))) y: ((yVal)+((distance)*([sin v] of (direction)))) 
   change [direction v] by (1)
This will make your sprite rotate in a circle of radius 50 pixels around the coordinate (50, 50). Change values as necessary.


http://i46.tinypic.com/3148ksz.gif

Offline

 

#5 2013-03-05 17:27:02

MaryLeeH
New Scratcher
Registered: 2013-02-25
Posts: 3

Re: Need balls to rotate around x 0, y 0

Wow. Thank you all!

Offline

 

Board footer