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

#1 2013-05-04 10:49:39

cord_thundertree
Scratcher
Registered: 2011-05-29
Posts: 26

help with moving objects across the screen

I need help making so I can click on sprites, and the sprite that I clicked on will trigger another sprite to come towards it so I can make the sprite that touches it, cause the sprite that I clicked on to explode,  and then restart again. please help.

Offline

 

#2 2013-05-04 13:56:50

joshuaho
Scratcher
Registered: 2012-08-20
Posts: 100+

Re: help with moving objects across the screen

cord_thundertree wrote:

I need help making so I can click on sprites, and the sprite that I clicked on will trigger another sprite to come towards it so I can make the sprite that touches it, cause the sprite that I clicked on to explode,  and then restart again. please help.

YOu can do this:

First, let's say that you clicked on a sprite:

when
sprite1
clicked
when that sprite is clicked
broadcast
out
send a message telling the others to appear
forever
if
touching sprite 2
switch to costume
explosion
switches to explosion costume
wait
1
secs
hide
disappears
wait
1
secs

Then for the other sprite:

when I receive
out
show
repeat
1
if
distance to
sprite 2
10
if the distance is more than ten
point towards
sprite 1
point towards sprite
move
5
steps
move 5 steps toward that sprite

Last edited by joshuaho (2013-05-04 13:58:05)


Did you know that you can go to space and see Mars by clicking here?

Offline

 

#3 2013-05-04 14:26:02

7734f
Scratcher
Registered: 2010-12-23
Posts: 500+

Re: help with moving objects across the screen

joshuaho wrote:

cord_thundertree wrote:

I need help making so I can click on sprites, and the sprite that I clicked on will trigger another sprite to come towards it so I can make the sprite that touches it, cause the sprite that I clicked on to explode,  and then restart again. please help.

You can do this:

First, let's say that you clicked on a sprite:

when
sprite1
clicked
when that sprite is clicked
broadcast
out
send a message telling the others to appear
forever
if
touching
sprite 2
?
switch to costume
explosion
switches to explosion costume
wait
1
secs
hide
disappears
wait
1
secs

Then for the other sprite:

When I receive
out
show
repeat
1
if
distance to
sprite 2
>
10
if the distance is more than ten
point towards
sprite 1
point towards sprite
move
5
steps
move 5 steps toward that sprite

Fixed  smile

With respects,
~7734f

Last edited by 7734f (2013-05-04 14:26:27)


http://internetometer.com/image/38992.png   http://i37.tinypic.com/2qixx6c.png

Offline

 

Board footer