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

#1 2010-10-08 02:16:10

Guinea_Pig_Girl
Scratcher
Registered: 2010-08-25
Posts: 100+

How do I make a sprite spin without changing the direction?

Long title, I know.  big_smile  But what I want to know, is, the title. How do I make a sprite spin without changing the direction? I can't use the
[blocks]<turn cw(  )degrees>[/blocks]
blocks because that would change the direction. What I'm doing, is, making the Scratch Cat point towards the mouse pointer, until your mouse is down. Then...well, you'd understand better with a picture.  smile
My thoughts...why can't I get the BBcode for this image?!? oh well...
http://m.flickr.com/#/photos/tinsenpup/5061252923/
That's the link. I can't find the-oh! I just figured...oh, no I didn't. So yes, does anyone know how I can make the sprite spin without changing the direction?  I could use different costumes, but it wouldn't be very good quality. So, does anyone know how?  smile


http://img841.imageshack.us/img841/783/misstdd.png
Put this in your siggy if you miss The_Dancing_Donut!

Offline

 

#2 2010-10-08 02:23:16

Ace-Of-Diamonds
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: How do I make a sprite spin without changing the direction?

Well actually the rotating would have the same quality as many costumes since Scratch isn't vectored. But besides these two ways, there's no other way to do it. Why can't you use the rotate block? What does the direction changing have to do with it?


http://img841.imageshack.us/img841/9151/v4a.png

Offline

 

#3 2010-10-08 02:39:38

Guinea_Pig_Girl
Scratcher
Registered: 2010-08-25
Posts: 100+

Re: How do I make a sprite spin without changing the direction?

Ace-Of-Diamonds wrote:

Well actually the rotating would have the same quality as many costumes since Scratch isn't vectored. But besides these two ways, there's no other way to do it. Why can't you use the rotate block? What does the direction changing have to do with it?

I need the sprite to spin while moving in a straight line.  smile  Well, I don't need it, but it would be useful to have.  smile


http://img841.imageshack.us/img841/783/misstdd.png
Put this in your siggy if you miss The_Dancing_Donut!

Offline

 

#4 2010-10-08 06:42:33

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: How do I make a sprite spin without changing the direction?

If it isn't a 1s1s, how about making another sprite that moves in the straight line and add
[blocks]

<forever>
<go to[ the sprite

[/blocks]

to the Scratch cat.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#5 2010-10-08 07:13:34

mathematics
Scratcher
Registered: 2009-03-01
Posts: 1000+

Re: How do I make a sprite spin without changing the direction?

I have no idea how to do that...

Guinea_Pig_Girl wrote:

My thoughts...why can't I get the BBcode for this image?!? oh well...
http://m.flickr.com/#/photos/tinsenpup/5061252923/

That's because you have chosen "All Rights Reserved".

Offline

 

#6 2010-10-08 08:07:45

Guinea_Pig_Girl
Scratcher
Registered: 2010-08-25
Posts: 100+

Re: How do I make a sprite spin without changing the direction?

mathematics wrote:

I have no idea how to do that...

Guinea_Pig_Girl wrote:

My thoughts...why can't I get the BBcode for this image?!? oh well...
http://m.flickr.com/#/photos/tinsenpup/5061252923/

That's because you have chosen "All Rights Reserved".

I guess you're right, because it is my mother's account, not mine. I have Picasa set up now though. http://picasaweb.google.com/tinsenhockey/ScratchThings# That's the link, if you want to look at it.  smile


http://img841.imageshack.us/img841/783/misstdd.png
Put this in your siggy if you miss The_Dancing_Donut!

Offline

 

#7 2010-10-08 08:10:38

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: How do I make a sprite spin without changing the direction?

Make a variable and record your direction.
Move towards the mouse.
Point in the variable's direction.
Change the variable.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#8 2010-10-08 08:27:16

Ace-Of-Diamonds
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: How do I make a sprite spin without changing the direction?

You can make it rotating while you change the x or y. That would keep it in a straight line, and it wouldn't move towards the way you point towards but towards the direction you want it to go.


http://img841.imageshack.us/img841/9151/v4a.png

Offline

 

#9 2010-10-08 08:54:46

Guinea_Pig_Girl
Scratcher
Registered: 2010-08-25
Posts: 100+

Re: How do I make a sprite spin without changing the direction?

Hmmm. Combining Ace-of-Diamonds' idea and juststickman's idea might just work....
Oh! Didn't notice Hardman123's post. Yes, that would probably work too. I'll try all your ideas, and see what I get!  smile  Thanks for helping, everyone!


http://img841.imageshack.us/img841/783/misstdd.png
Put this in your siggy if you miss The_Dancing_Donut!

Offline

 

#10 2010-10-08 08:57:17

Ace-Of-Diamonds
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: How do I make a sprite spin without changing the direction?

Are you only going for up-down or left-right movement? If you're only doing that, just use change x/y. There's no need to create a variable for it if it's for 90 degree stuff.


http://img841.imageshack.us/img841/9151/v4a.png

Offline

 

#11 2010-10-08 09:02:47

Guinea_Pig_Girl
Scratcher
Registered: 2010-08-25
Posts: 100+

Re: How do I make a sprite spin without changing the direction?

Ace-Of-Diamonds wrote:

Are you only going for up-down or left-right movement? If you're only doing that, just use change x/y. There's no need to create a variable for it if it's for 90 degree stuff.

It points towards the mouse-pointer, so there's no fixed place it's going.  smile


http://img841.imageshack.us/img841/783/misstdd.png
Put this in your siggy if you miss The_Dancing_Donut!

Offline

 

#12 2010-10-08 09:13:51

Ace-Of-Diamonds
Scratcher
Registered: 2010-02-02
Posts: 500+

Re: How do I make a sprite spin without changing the direction?

Then you'll have to have a variable tracking the sprites rotation as well as the direction you want it to point in. Otherwise, it'll spin some, then spin back facing the mouse then start spinning again, only to face the mouse again after nearly a second. I'm not sure how this would play out in presentation mode. Why does the sprite need to spin?


http://img841.imageshack.us/img841/9151/v4a.png

Offline

 

#13 2010-10-08 09:26:46

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: How do I make a sprite spin without changing the direction?

Guinea_Pig_Girl wrote:

Ace-Of-Diamonds wrote:

Well actually the rotating would have the same quality as many costumes since Scratch isn't vectored. But besides these two ways, there's no other way to do it. Why can't you use the rotate block? What does the direction changing have to do with it?

I need the sprite to spin while moving in a straight line.  smile  Well, I don't need it, but it would be useful to have.  smile

Here's how to do that....have one sprite do the motion and another sprite do the spinning and also have it goto the location of the first sprite continuously.  The sprite doing the motion can be hidden or made transparent.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#14 2010-10-08 09:32:42

Guinea_Pig_Girl
Scratcher
Registered: 2010-08-25
Posts: 100+

Re: How do I make a sprite spin without changing the direction?

Ace-Of-Diamonds wrote:

Then you'll have to have a variable tracking the sprites rotation as well as the direction you want it to point in. Otherwise, it'll spin some, then spin back facing the mouse then start spinning again, only to face the mouse again after nearly a second. I'm not sure how this would play out in presentation mode. Why does the sprite need to spin?

Alright now you've got me confused. XD I better explain from the beginning. I think we're all a bit confused here.
If you have a look at the code, which I have a link to in my first post, the sprite points towards the mouse pointer until you click. Then it moves 10 steps until it reaches the edge. What I'd like to do, is have it spin while it moves 10 steps. There are many methods here, and I daresay at least one of them works.  smile  The script I have is:
[blocks]<when green flag clicked>
<repeat until><mouse down?>
<point towards( mouse-pointer
<end>
<repeat until><touching[ edge
<move( 10 )steps>
<end>
[/blocks]

I want it to spin while moving 10 steps. It's not required, just an extra effect. Anyway, nothing urgent anyway.  smile


http://img841.imageshack.us/img841/783/misstdd.png
Put this in your siggy if you miss The_Dancing_Donut!

Offline

 

#15 2010-10-08 09:34:10

Guinea_Pig_Girl
Scratcher
Registered: 2010-08-25
Posts: 100+

Re: How do I make a sprite spin without changing the direction?

Paddle2See wrote:

Guinea_Pig_Girl wrote:

Ace-Of-Diamonds wrote:

Well actually the rotating would have the same quality as many costumes since Scratch isn't vectored. But besides these two ways, there's no other way to do it. Why can't you use the rotate block? What does the direction changing have to do with it?

I need the sprite to spin while moving in a straight line.  smile  Well, I don't need it, but it would be useful to have.  smile

Here's how to do that....have one sprite do the motion and another sprite do the spinning and also have it goto the location of the first sprite continuously.  The sprite doing the motion can be hidden or made transparent.

What? Ohh! I did such a long post that you posted!! Well, it seems like that'd work, but I need to go to bed now, so I'll try it in the morining.  smile  Thanks for solving my problem everyone!  smile


http://img841.imageshack.us/img841/783/misstdd.png
Put this in your siggy if you miss The_Dancing_Donut!

Offline

 

#16 2010-10-08 11:30:17

scmb1
Scratch Team
Registered: 2009-03-19
Posts: 1000+

Re: How do I make a sprite spin without changing the direction?

Paddle idea is really great, but if you don't want an extra sprite for some reason, here's an alternative method:

http://oi51.tinypic.com/fkbfbm.jpg


http://i48.tinypic.com/2z5pqad.png

Offline

 

#17 2010-10-08 16:12:12

ScratchReallyROCKS
Scratcher
Registered: 2009-04-22
Posts: 1000+

Re: How do I make a sprite spin without changing the direction?

um, what about the "don't rotate" button next to the sprite thumbnail?


http://imageshack.us/a/img694/3806/sigmad.png

Offline

 

#18 2010-10-08 16:21:13

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How do I make a sprite spin without changing the direction?

ScratchReallyROCKS wrote:

um, what about the "don't rotate" button next to the sprite thumbnail?

This is by far the simplest solution if you don't want your sprite to ever rotate. If you're looking for a "cleaner" solution, scmb1's will work, although it is a bit more math-heavy. Paddle2See's is quite flexible, too, and does essentially the same thing with less scripting. Pick which one suits you best and go for it!

(I much prefer scmb1's solution: trigonometry is my thing.)

Offline

 

Board footer