Pages: 1
Topic closed
How would I go about making a sprite revolve around a different sprite so that the first sprite is closer to the mouse?
Offline
If sprite 1 is revolving around sprite 2, and distance is the distance between them, than do this in sprite 1:
[blocks]
<go to[ sprite2
<point towards( mouse
<move( distance )steps>
[/blocks]
There are more complex formulas, but I don't feel like going into them right now.
Last edited by floppy_gunk (2011-02-13 01:02:04)
Offline
Give me a second; I have a script similar to this, I just need to tweak it.
Offline
Well call me the most confused person alive. I can make a sprite revolve so it goes directly away from the mouse, but not towards.
http://scratch.mit.edu/projects/Kileymeister_test/1594416
When I try to make it go the other way it glitches out and the sprite flies everywhere.
???
EDIT: Wait, I think I have it. Gimme another minute, please.
Last edited by Kileymeister (2011-02-13 12:05:22)
Offline
Whoa, that script is confusing . Oh well.
I was thinking I could do something with sin and cosin but I always get one as output from them. I guess that's what they're supposed to do, anyways, though.
Offline
Wait, I have it! Sorta.
http://scratch.mit.edu/projects/Kileymeister_test/1594435
Only one glitch where when you mouse your mouse under the center sprite that doesn't move, your sprite goes the other way. The end result is the same but it takes the long route around.
Last edited by Kileymeister (2011-02-13 12:09:25)
Offline
Kileymeister wrote:
Wait, I have it! Sorta.
http://scratch.mit.edu/projects/Kileymeister_test/1594435
Only one glitch where when you mouse your mouse under the center sprite that doesn't move, your sprite goes the other way. The end result is the same but it takes the long route around.
Agh, wish I could understand the script D: . Oh well, thanks .
Offline
Sunrise-Moon wrote:
Kileymeister wrote:
Wait, I have it! Sorta.
http://scratch.mit.edu/projects/Kileymeister_test/1594435
Only one glitch where when you mouse your mouse under the center sprite that doesn't move, your sprite goes the other way. The end result is the same but it takes the long route around.Agh, wish I could understand the script D: . Oh well, thanks
.
Just import it, then you don't need to know! (That came out a little meanly, sorry)
Oh, and wherever it says [x positon] of [Sprite 2], change the [Sprite 2] to the sprite you want it to revolve around.
Last edited by Kileymeister_test (2011-02-13 12:18:32)
Offline
Kileymeister_test wrote:
Sunrise-Moon wrote:
Kileymeister wrote:
Wait, I have it! Sorta.
http://scratch.mit.edu/projects/Kileymeister_test/1594435
Only one glitch where when you mouse your mouse under the center sprite that doesn't move, your sprite goes the other way. The end result is the same but it takes the long route around.Agh, wish I could understand the script D: . Oh well, thanks
.
Just import it, then you don't need to know!
(That came out a little meanly, sorry)
Oh, and wherever it says [x positon] of [Sprite 2], change the [Sprite 2] to the sprite you want it to revolve around.
Alright, thanks
Offline
<when green flag clicked>
<forever>
<go to[ Sprite1 ]>
<point towards( Mouse pointer )>
<move( 100 )steps>
<clear>
<stamp>
<end>
Offline
colorfusion wrote:
<when green flag clicked>
<forever>
<go to[ Sprite1 ]>
<point towards( Mouse pointer )>
<move( 100 )steps>
<clear>
<stamp>
<end>[/blocks]
Close, but that would make it point, not rotate, right?
Last edited by Kileymeister (2011-02-13 13:19:24)
Offline
Kileymeister wrote:
colorfusion wrote:
<when green flag clicked>
<forever>
<go to[ Sprite1 ]>
<point towards( Mouse pointer )>
<move( 100 )steps>
<clear>
<stamp>
<end>[/blocks]Close, but that would make it point, not rotate, right?
It would stay exactly 100 pixels away from the centre sprite closest to the mouse.
Like there's an circle with a radius of 100 around the center sprite that the moving sprite must stay on, but it trys to stay closest to the mouse.
I just realised floppy said this before, but this will make it less flashy.
Last edited by colorfusion (2011-02-13 16:18:13)
Offline
colorfusion wrote:
Kileymeister wrote:
colorfusion wrote:
<when green flag clicked>
<forever>
<go to[ Sprite1 ]>
<point towards( Mouse pointer )>
<move( 100 )steps>
<clear>
<stamp>
<end>[/blocks]Close, but that would make it point, not rotate, right?
It would stay exactly 100 pixels away from the centre sprite closest to the mouse.
Like there's an circle with a radius of 100 around the center sprite that the moving sprite must stay on, but it trys to stay closest to the mouse.
I just realised floppy said this before, but this will make it less flashy.
Yes, but what I'm saying is it won't rotate, it will just immediately be where it needs to be in one frame, instead of slowly moving towards where it should be.
Offline
Kileymeister wrote:
colorfusion wrote:
Kileymeister wrote:
Close, but that would make it point, not rotate, right?It would stay exactly 100 pixels away from the centre sprite closest to the mouse.
Like there's an circle with a radius of 100 around the center sprite that the moving sprite must stay on, but it trys to stay closest to the mouse.
I just realised floppy said this before, but this will make it less flashy.Yes, but what I'm saying is it won't rotate, it will just immediately be where it needs to be in one frame, instead of slowly moving towards where it should be.
Actually, I described it incorrectly- I meant more of what colorfusion did (sorry). Still, I have one problem with colorfusion's- it clears the stage. What I'm looking to do requires the stage to be stamped and it can't be cleared. Could someone make something that looks exactly like colorfusion's but doesn't use stamp or clear?
Offline
Sunrise-Moon wrote:
Kileymeister wrote:
colorfusion wrote:
It would stay exactly 100 pixels away from the centre sprite closest to the mouse.
Like there's an circle with a radius of 100 around the center sprite that the moving sprite must stay on, but it trys to stay closest to the mouse.
I just realised floppy said this before, but this will make it less flashy.Yes, but what I'm saying is it won't rotate, it will just immediately be where it needs to be in one frame, instead of slowly moving towards where it should be.
Actually, I described it incorrectly- I meant more of what colorfusion did (sorry). Still, I have one problem with colorfusion's- it clears the stage. What I'm looking to do requires the stage to be stamped and it can't be cleared. Could someone make something that looks exactly like colorfusion's but doesn't use stamp or clear?
![]()
Darn.
CURSE YOU, SIMPLICITY MAN!!!! *evil fist-shaking*
Just get rid of the stamp and clear and it should work the same.
Last edited by Kileymeister (2011-02-13 17:08:32)
Offline
Kileymeister wrote:
Sunrise-Moon wrote:
Kileymeister wrote:
Yes, but what I'm saying is it won't rotate, it will just immediately be where it needs to be in one frame, instead of slowly moving towards where it should be.Actually, I described it incorrectly- I meant more of what colorfusion did (sorry). Still, I have one problem with colorfusion's- it clears the stage. What I'm looking to do requires the stage to be stamped and it can't be cleared. Could someone make something that looks exactly like colorfusion's but doesn't use stamp or clear?
![]()
Darn.
CURSE YOU, SIMPLICITY MAN!!!! *evil fist-shaking*
Just get rid of the stamp and clear and it should work the same.
xD sorry. Works . Thanks!
Offline
Topic closed
Pages: 1