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

#1 2010-07-19 23:22:32

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Move Towards Sprite?

How would I go about making a sprite move towards another sprite?


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#2 2010-07-19 23:33:15

Digimath
Scratcher
Registered: 2007-07-07
Posts: 100+

Re: Move Towards Sprite?

<point towards( OtherSprint)
<move(  10 )steps>

You can see an example in my Pirates vs Ninja game.


I've updated my text adventure game.
Colossal Cave 150http://scratch.mit.edu/static/projects/Digimath/3003787_sm.png

Offline

 

#3 2010-07-19 23:37:45

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Move Towards Sprite?

Digimath wrote:

<point towards( OtherSprint)
<move(  10 )steps>

You can see an example in my Pirates vs Ninja game.

Well, I mean more of moving towards it without changing the direction.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#4 2010-07-20 07:03:10

Dazachi
Retired Community Moderator
Registered: 2009-09-12
Posts: 1000+

Re: Move Towards Sprite?

Then it might get harder. The only way I can think of is with stamping. Do you want to go that far?


Dazachi, Retired Community Moderator
May also know me as OJACheung.

Offline

 

#5 2010-07-20 07:31:49

iCode-747
Scratcher
Registered: 2009-11-21
Posts: 1000+

Re: Move Towards Sprite?

Well, trig would work... Else, just use the glide block.


-End Transmission-

Offline

 

#6 2010-07-20 07:33:52

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: Move Towards Sprite?

Can't you can the type of way the direction symbol is. one of them is full rotate(top), Side Rotate(middle),and no rotate(bottom).It's right left of the sprite data when the sprite is selected.Switch to no rotate, then use digimath's code.

Offline

 

#7 2010-07-20 09:05:15

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

Re: Move Towards Sprite?

laser100 wrote:

Can't you can the type of way the direction symbol is. one of them is full rotate(top), Side Rotate(middle),and no rotate(bottom).It's right left of the sprite data when the sprite is selected.Switch to no rotate, then use digimath's code.

Yes, this is one idea. When you select the sprite, at the top where it says the sprite's name and it show's a small icon of the sprite with a line from the center of the sprite outwards, to the left of it, there are three buttons. Normally the sprite is the top one, with the clockwise symbol - so it can turn freely. But if you change it to the bottom button, than it won't won't appear to change direction, but if you for example, change the direction, and make it move some steps, than it will move in it's hidden direction.

One other option if you don't want to do that though, is to record the sprite's direction in a variable, point towards the other sprite, move towards it, and then change to the sprite's original direction.

If this is confusing, just tell me so I can make a project to demonstrate  smile


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

Offline

 

#8 2010-07-20 10:41:18

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Move Towards Sprite?

Lucario621 wrote:

laser100 wrote:

Can't you can the type of way the direction symbol is. one of them is full rotate(top), Side Rotate(middle),and no rotate(bottom).It's right left of the sprite data when the sprite is selected.Switch to no rotate, then use digimath's code.

Yes, this is one idea. When you select the sprite, at the top where it says the sprite's name and it show's a small icon of the sprite with a line from the center of the sprite outwards, to the left of it, there are three buttons. Normally the sprite is the top one, with the clockwise symbol - so it can turn freely. But if you change it to the bottom button, than it won't won't appear to change direction, but if you for example, change the direction, and make it move some steps, than it will move in it's hidden direction.

One other option if you don't want to do that though, is to record the sprite's direction in a variable, point towards the other sprite, move towards it, and then change to the sprite's original direction.

If this is confusing, just tell me so I can make a project to demonstrate  smile

I see. Maybe I'll try that. Thanks  smile


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

Board footer