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

#1 2012-07-16 01:33:48

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

Coin - Stop Folowing Me!

Just need to know for a small adjustment in my project, how do I get my coin to stop pointing towards the mouse pointer when its left the coin shooter.
So far I've got for the coin:
Forever if <touching (shooter 1)>
point towards (mouse-pointer|)
And for the shooter:
Forever if <touching (Coin 1)>
point towards (mouse-pointer|)

How can I get the coin to stop pointing towards the mouse pointer (and the shooter if possible) to stop pointing towards me when they aren't touching each other. (Think they keep pointing even when not touching because of 'forever if' block?)

Offline

 

#2 2012-07-16 01:45:45

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

Re: Coin - Stop Folowing Me!

Please Help! This has to be in later today!

Offline

 

#3 2012-07-16 03:30:57

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

Re: Coin - Stop Folowing Me!

bump

Offline

 

#4 2012-07-16 03:55:27

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

Re: Coin - Stop Folowing Me!

I'll help!  big_smile  Just gimme a sec to type it up.

EDIT: Noes, school. I'll do it afterwards.

Last edited by SciTecCf (2012-07-16 03:58:34)


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

Offline

 

#5 2012-07-16 04:40:19

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Coin - Stop Folowing Me!

DoowNimajneb, in future, please keep questions about a single project on one thread rather than creating a new one for every question you have!

(It might also help not to leave the project to the last minute, though I do that too, I'm not gonna berate you.)

you're using forever if rather than forever and if, that's the problem here. You put:

forever if <touching [shooter1 v]?>
point towards [mouse-pointer v]
end
 
 
forever if <touching [coin1 v]?>
point towards [mouse-pointer v]
end
What you're after is this:
forever
if <touching [shooter1 v]?>
point towards [mouse-pointer v]
end
end
 
 
forever
if <touching [coin1 v]?>
point towards [mouse-pointer v]
end
end
The forever if block will repeat its contents for ever if the statement is true the first time it checks. Since your coin starts out touching the cannon it will always point towards it. By putting a if statement inside a forever statement, you can get it to check forever and respond appropriately.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#6 2012-07-16 05:00:06

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Coin - Stop Folowing Me!

But wait,you can't stack forever blocks  tongue


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#7 2012-07-16 05:30:28

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

Re: Coin - Stop Folowing Me!

sparks wrote:

DoowNimajneb, in future, please keep questions about a single project on one thread rather than creating a new one for every question you have!

(It might also help not to leave the project to the last minute, though I do that too, I'm not gonna berate you.)

you're using forever if rather than forever and if, that's the problem here. You put:

forever if <touching [shooter1 v]?>
point towards [mouse-pointer v]
end
 
 
forever if <touching [coin1 v]?>
point towards [mouse-pointer v]
end
What you're after is this:
forever
if <touching [shooter1 v]?>
point towards [mouse-pointer v]
end
end
 
 
forever
if <touching [coin1 v]?>
point towards [mouse-pointer v]
end
end
The forever if block will repeat its contents for ever if the statement is true the first time it checks. Since your coin starts out touching the cannon it will always point towards it. By putting a if statement inside a forever statement, you can get it to check forever and respond appropriately.

I'm afraid you're wrong for once, sparks.
The forever if and the forever - if work exactly in the same way!
If in doubt, try

forever if <key [space v] pressed?>
move (1) steps
end
and
forever
if <key [space v] pressed?>
move (1) steps
end
end
They do the same thing and stop when you don't press space!

Offline

 

#8 2012-07-16 06:01:05

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

Re: Coin - Stop Folowing Me!

You, my friend, should do this:

COIN:

when gf clicked
forever
 point in direction ([direction v] of [cannon v])
end
when i receive [fire v]
repeat until <touching [edge v]?> //If it has hit something...
 move (4) steps
end
CANNON:
when gf clicked
forever
 wait until <not <mouse down?>>
 repeat until <mouse down?>
  point towards [mouse-pointer v]
 end
 broadcast [fire v] and wait
end

Last edited by SciTecCf (2012-07-16 06:01:44)


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

Offline

 

#9 2012-07-16 16:56:10

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

Re: Coin - Stop Folowing Me!

Hi SciTef, how do you set it to point in the direction of wherever the cannon is pointing?

Offline

 

#10 2012-07-16 17:29:31

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Coin - Stop Folowing Me!

You can find the [direction v] of [sprite v] block in the sensing section.  By default, the variable that shows up is [x position v] but you can select others (including any variables you've created that are local to that sprite). 

point in direction ([direction v] of [cannon v])

Last edited by amcerbu (2012-07-16 17:30:49)

Offline

 

#11 2012-07-17 17:30:32

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

Re: Coin - Stop Folowing Me!

Now for some reason, the coin isn't even pointing in the same direction as the coin shooter even when I want it to! Please Help! I will post this glitchy project if I have to, just please help me!

Offline

 

#12 2012-07-17 17:43:21

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Coin - Stop Folowing Me!

It's always easier to diagnose a problem if we can take a look at the project.

Offline

 

#13 2012-07-17 17:45:21

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

Re: Coin - Stop Folowing Me!

Ok, I'll post it under the name: Roll 'em in - Teaser

Offline

 

#14 2012-07-17 17:50:29

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

Re: Coin - Stop Folowing Me!

sorry, I just realised, I'll have to do it tomorrow, but I can do it at 6' O 'clock but then I'll need an answer for my problem the same day as this project is due in on thursday...

Offline

 

#15 2012-07-18 02:53:23

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

Re: Coin - Stop Folowing Me!

Right, just posted, should be online in under 1/4 of an hour... Please help solve my glitches! I named the project: Roll 'em in - Teaser

Offline

 

#16 2012-07-18 12:05:02

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

Re: Coin - Stop Folowing Me!

please help my project

Offline

 

Board footer