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

#1 2012-04-21 14:13:32

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Advanced Problem: Moving with a circle

Hey guys, I've been working on a project, but I've run into a block, and I don't know what to do.  I have a circle in the bottom of the screen that rotates, and I want to have something that is attached to it and moves when the larger circle rotates.  Any ideas?
NOTE: I don't want anyone to say that I should make it be the same sprite, because thats not what I want to do.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#2 2012-04-21 14:19:58

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: Advanced Problem: Moving with a circle

Your problem is rather vague, what do you want it for? and why can't it be one sprite?
What I'd do is have the smaller circle with and odd sprite centre (so that its centre is the centre of the other circle) and just have it rotate


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#3 2012-04-21 14:32:14

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Advanced Problem: Moving with a circle

I'm making a game based around this.  I'm going to have a lot of interact-able elements so it can't be just one sprite, and the problem with the odd sprite center, is that its just so hard to position that properly.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#4 2012-04-21 14:33:04

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Advanced Problem: Moving with a circle

Just set the center of rotation of the object you want to rotate when the other rotates to where you want on the circle. Then:

when gf clicked
forever
    point in direction ( [direction] of [sprite circle] )
end


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#5 2012-04-21 14:38:53

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Advanced Problem: Moving with a circle

I want the same thing as this:
http://scratch.mit.edu/projects/gbear605/2485855
However, that makes it be part of the same sprite, and I don't want that.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#6 2012-04-21 14:38:56

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Advanced Problem: Moving with a circle

If you're still having trouble, I've made a test project here.


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#7 2012-04-21 14:42:29

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Advanced Problem: Moving with a circle

pi3 wrote:

If you're still having trouble, I've made a test project here.

That is in a way what I want, but I don't want to have to change the center of rotation.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#8 2012-04-21 14:45:38

pi3
Scratcher
Registered: 2011-12-31
Posts: 500+

Re: Advanced Problem: Moving with a circle

gbear605 wrote:

pi3 wrote:

If you're still having trouble, I've made a test project here.

That is in a way what I want, but I don't want to have to change the center of rotation.

Why not? It's not that hard, and it's pretty quick.


http://i44.tinypic.com/ofdhc4.jpgThanks FreshStudios!

Offline

 

#9 2012-04-21 14:49:42

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Advanced Problem: Moving with a circle

pi3 wrote:

gbear605 wrote:

pi3 wrote:

If you're still having trouble, I've made a test project here.

That is in a way what I want, but I don't want to have to change the center of rotation.

Why not? It's not that hard, and it's pretty quick.

Its because I'm gonna be making any number of them, so it would take too long, also, I just think thats unprofessional, AND I just think it would be cool to figure it out.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#10 2012-04-21 15:10:11

gbear605
Scratcher
Registered: 2008-03-06
Posts: 1000+

Re: Advanced Problem: Moving with a circle

Bumpity Bumpity Bumpity Boo XD

Anyways, I'm guessing that the solution to my problem has to do with trig.


Yeah, I'm mostly inactive.  I check in once in a while though.  If you want to contact me, I have a contact form at my website, http://escratch.org

Offline

 

#11 2012-04-21 17:17:34

BetaSmozzick
Scratcher
Registered: 2012-02-25
Posts: 51

Re: Advanced Problem: Moving with a circle

Ah, I get it now. I forgot about the movement factor. The code below looks roughly right for it

EDIT: Thoguh since your circle is presumably further down the screen you'll need to add a - 50 bit the the y value to make it correct. 50 is only a rough value, mind.

Last edited by BetaSmozzick (2012-04-21 17:30:33)

Offline

 

#12 2012-04-21 17:22:17

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Advanced Problem: Moving with a circle

Maybe something like this Gbear:

when gf clicked
forever
go to x: (([sin v] of ([direction v] of [circle v])) * (50)) y: (([cos v] of ([direction v] of [circle v])) * (50))


http://i.imgur.com/WBkM2QQ.png

Offline

 

Board footer