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

#1 2011-07-18 10:30:26

Mulan15262
Scratcher
Registered: 2010-07-14
Posts: 3

"Move Towards" block NEEDED

I am trying to make an interplanetary golfing game (like gravitee, only better).

I was doing good until I found that there wasn't a "Move Towards" block.

This is how it should work:

Move {insert number here} steps towards {insert a sprite here}.
OR
Move to {insert a sprite here}.
OR
Move to edge of {insert sprite here}.
OR
Move{insert number here} steps towards edge of {insert sprite here}.

I would really appreciate it if you would add those 4 blocks.

Offline

 

#2 2011-07-18 11:37:41

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: "Move Towards" block NEEDED

This is pretty simple to do already.  wink

Code:

When green flag clicked
forever
    point towards {sprite name here}
    move {whatever} steps

You can modify that fairly easily to do whatever it is you need it to do. (For example, you might only have it repeat that a few times.)


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#3 2011-07-18 15:58:59

Mulan15262
Scratcher
Registered: 2010-07-14
Posts: 3

Re: "Move Towards" block NEEDED

I need to use the direction for something else, however. So your idea won't work.

But thanks for trying.

Offline

 

#4 2011-07-18 16:12:17

Harakou
Community Moderator
Registered: 2009-10-11
Posts: 1000+

Re: "Move Towards" block NEEDED

Oh, I see. The movement needs to be independent of direction. You can pull that off with some trigonometry, but it could be tricky given Scratch's odd direction system.


http://www.blocks.scratchr.org/API.php?action=random&return=image&link1=http://i.imgur.com/OZn2RD3.png&link2=http://i.imgur.com/duzaGTB.png&link3=http://i.imgur.com/CrDGvvZ.png&link4=http://i.imgur.com/POEpQyZ.png&link5=http://i.imgur.com/ZKJF8ac.png

Offline

 

#5 2011-07-27 10:49:17

Mulan15262
Scratcher
Registered: 2010-07-14
Posts: 3

Re: "Move Towards" block NEEDED

Bump.

Offline

 

#6 2011-07-27 15:21:09

woofwoof301
Scratcher
Registered: 2008-06-01
Posts: 100+

Re: "Move Towards" block NEEDED

Seeing that you rejected Harakou's suggestion, the only thing I can think of right now is the <glide(  )secs to x sad  personx )y sad  persony

Offline

 

#7 2011-07-27 16:34:02

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: "Move Towards" block NEEDED

Make a ghost sprite and do what harakou said?

A ghost sprite is on that is hidden, and is used for the movement of the original sprite.

Put harakous suggestion on the ghost sprite, and tell the golf ball to forever got to ghost sprite.

Offline

 

#8 2011-07-28 07:58:43

EdnaC
Scratcher
Registered: 2007-08-28
Posts: 100+

Re: "Move Towards" block NEEDED

Harakou wrote:

Oh, I see. The movement needs to be independent of direction. You can pull that off with some trigonometry, but it could be tricky given Scratch's odd direction system.

Trig works fine in Scratch.  Since trig functions repeat at 180 degree intervals, the "odd direction system" doesn't cause an issue - though I do agree that it's ODD to not use the convention that every textbook uses.  I can only assume that there is good reason.

Here's a projectile motion project that uses a guide sprite to do "accurate" projectile motion without trig.

Offline

 

#9 2011-07-29 10:27:35

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: "Move Towards" block NEEDED

Mulan15262 wrote:

Move to {insert a sprite here}.

Ever heard of the <go to[  sprite  block?

Offline

 

#10 2011-07-29 12:49:49

Death_Wish
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: "Move Towards" block NEEDED

Greenatic wrote:

Mulan15262 wrote:

Move to {insert a sprite here}.

Ever heard of the <go to[  sprite  block?

Wouldn't it be Glide to?  tongue
But yeah, your best bet would be a ghost sprite, and

Glide () seconds to (ghostspritename)

And have the ghost do
Forever
Glide (1) seconds to x position (Pick random (-238) to (240) y position pick random (175) to (-181)
Or from wherever you want, that's the whole screen.


With a straight flush.
http://4.bp.blogspot.com/-FlUhnzmIROE/TgtpjdJl4tI/AAAAAAAABCM/W19pvFTZFaU/s1600/save_the_world.png http://blocsonic.com/images/special/rip-stevejobs.jpg

Offline

 

#11 2011-07-29 13:01:31

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: "Move Towards" block NEEDED

OK, here's what I think:
Block #1:  I just made a block that does this.
Block #2:  This block already exists; | go to {   v} |
Block #3:  I might be able to script this.
Block #4:  I don't think this is really necessary, considering that it is very similar to Block #1.

Offline

 

#12 2011-07-29 14:55:29

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: "Move Towards" block NEEDED

Wait, I have a question about Block 3.  Did you mean for it to go *on* the edge of a sprite, or for it to *touch* the edge of a sprite?

Offline

 

#13 2011-08-11 03:49:47

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: "Move Towards" block NEEDED

woofwoof301 wrote:

Seeing that you rejected Harakou's suggestion, the only thing I can think of right now is the <glide(  )secs to x sad  personx )y sad  persony

actually glide glitches if the sprite tries to move as well.

grr.. you forgot the

Code:

[/blocks]

tag so now my text goes all bold!

Last edited by joefarebrother (2011-08-11 03:50:31)


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#14 2011-08-11 04:55:31

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: "Move Towards" block NEEDED

joefarebrother wrote:

woofwoof301 wrote:

Seeing that you rejected Harakou's suggestion, the only thing I can think of right now is the <glide(  )secs to x sad  personx )y sad  persony

actually glide glitches if the sprite tries to move as well.

grr.. you forgot the

Code:

[/blocks]

tag so now my text goes all bold![/blocks]

Ever thought of putting it in yourself?  tongue

Offline

 

Board footer