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

#1 2012-06-30 16:00:16

DoowNimajneb
New Scratcher
Registered: 2012-06-27
Posts: 65

Pointing in the same direction

I am making a carnival game involving a coin shooter and a coin. What I want to know is, How can I make the coin point at the mouse pointer at the same time as the coin shooter? Then I need it to stop when it leaves the coin shooter (How do I get the coin shooter to stop facing as well?) And also point again when it goes back into the shooter in the same game (not pressing the green flag). How can I get all of these to work?
Thanks,
DoowNimajneb

Offline

 

#2 2012-06-30 16:20:52

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: Pointing in the same direction

Coin:

when gf clicked
forever
 if <touching [shooter v]?>
  point towards [mouse-pointer v]
 end
end
Shooter:
when gf clicked
forever
 if <touching [coin v]?>
  point towards [mouse-pointer v]
 end
end


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#3 2012-07-01 10:16:14

SOScratch
Scratcher
Registered: 2010-02-01
Posts: 100+

Re: Pointing in the same direction

Put this script on your coin sprite:

when gf clicked
forever
if <touching [shooter v] ?>
point towards [mouse-pointer v]
end
if <not <touching [shooter v] ?> >
repeat until <touching [target v] ?> //change to name of target sprite
move (10) steps //change this amount to the travel speed you want
end
go to [shooter v]
end
end
And then add this to your shooter sprite:

when gf clicked
forever
if <touching [coin v] ?>
point towards [mouse-pointer v]
end
if <not <touching [coin v] ?> >
change x by (0)
change y by (0)
end
end
Then the whole thing should work fine.
Make sure on the coin sprite that in the "repeat until touching target" block, change the word target to the name of your sprite that is the target you have to shoot at.
Post help once more if there are multiple targets, then I know exactly what to do.

Hope it works!
ENJOY!!!

Last edited by SOScratch (2012-07-01 10:16:36)


-SOScratch
Scratch On!

Offline

 

#4 2012-07-01 12:14:48

DoowNimajneb
New Scratcher
Registered: 2012-06-27
Posts: 65

Re: Pointing in the same direction

In answer to SOSscratch's question, yes, I am shooting at multiple targets.

Offline

 

#5 2012-07-01 12:32:42

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Pointing in the same direction

point in direction ([direction v] of [coin shooter v])


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

Board footer