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

#1 2012-10-17 09:24:19

Xeronimo
New Scratcher
Registered: 2012-10-17
Posts: 5

Touching not working!?

I've got two sprites: sprite1 and sprite2

The script of sprite2 says:
"when green flag clicked
repeat until touching sprite1
do something"

So sprite2 does this something but when sprite1 touches it then sprite2 simply continues as if nothing had happened. Why!? Shouldn't it exit from the repeat loop at that point??

Thanks a lot!

Offline

 

#2 2012-10-17 09:27:23

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Touching not working!?

Try adding a "forever" loop.


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#3 2012-10-17 12:44:32

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: Touching not working!?

Are either of the sprites hidden?

Offline

 

#4 2012-10-17 14:02:58

Daeica
New Scratcher
Registered: 2012-10-17
Posts: 3

Re: Touching not working!?

I'm having the same problem. I've been looking around but i can't seem to find the solution.

Here's a sample of the script (Hoping that I've done it correctly!)

when gf clicked
repeat forever
  glide [1.3] secs to x:[188] y:[-150]
  wait [0] secs
  glide [1.3] secs to x:[188] y:[-150]
end
    if [touching [Magic ball]]
      switch to costume [Dragon hit]
      say [ARGH!] for [1] secs
      switch to costume [Dragon norm]
end

Offline

 

#5 2012-10-17 14:10:22

Daeica
New Scratcher
Registered: 2012-10-17
Posts: 3

Re: Touching not working!?

I noticed there's a couple of mistakes, mainly the glide paramiters are the same, and that the "Repeat forever" does not encapsulate everything. That's purely a noob mistake, first time poster & user, they are however displayed correctly in Scratch  smile

No edit-post so double post!

Offline

 

#6 2012-10-17 14:53:05

Xeronimo
New Scratcher
Registered: 2012-10-17
Posts: 5

Re: Touching not working!?

mythbusteranimator wrote:

Try adding a "forever" loop.

Where? In front of the 'repeat until'?

Offline

 

#7 2012-10-17 14:56:17

Willpower
Scratcher
Registered: 2012-01-26
Posts: 1000+

Re: Touching not working!?

Xeronimo wrote:

mythbusteranimator wrote:

Try adding a "forever" loop.

Where? In front of the 'repeat until'?

Yes, I think that would work...


http://i49.tinypic.com/e84kdj.png

Offline

 

#8 2012-10-17 14:58:46

Xeronimo
New Scratcher
Registered: 2012-10-17
Posts: 5

Re: Touching not working!?

Gravitation wrote:

Are either of the sprites hidden?

I can't check right now but I don't think so ... I surely can see them during the running of the program. But the one sprite simply go above (or under) the other and nothing happens ... although the sprite name selected in the 'touching' drop down is the correct one. It worked though at some point before (but I changed a lot in the program in the mean time) but I don't see what would prevent the 'touch' event from being executed ...

Offline

 

#9 2012-10-17 15:06:38

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: Touching not working!?

Daeica wrote:

I'm having the same problem. I've been looking around but i can't seem to find the solution.

Here's a sample of the script (Hoping that I've done it correctly!)

when gf clicked
forever
  glide [1.3] secs to x:[188] y:[-150]
  wait [0] secs
  glide [1.3] secs to x:[188] y:[-150]
    if <touching [Magic ball v]>
      switch to costume [Dragon hit]
      say [ARGH!] for [1] secs
      switch to costume [Dragon norm]
end
end

fixed


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#10 2012-10-17 15:33:48

Daeica
New Scratcher
Registered: 2012-10-17
Posts: 3

Re: Touching not working!?

dvd4 wrote:

Daeica wrote:

I'm having the same problem. I've been looking around but i can't seem to find the solution.

Here's a sample of the script (Hoping that I've done it correctly!)

when gf clicked
forever
  glide [1.3] secs to x:[188] y:[-150]
  wait [0] secs
  glide [1.3] secs to x:[188] y:[-150]
    if <touching [Magic ball v]>
      switch to costume [Dragon hit]
      say [ARGH!] for [1] secs
      switch to costume [Dragon norm]
end
end

fixed

Right, that yes, but I'm in the same boat as OP. While I have the script set to be "hit", no hitting is detected when the two sprites connect.

I added a double measure for both sprites, so they would trigger the same end-result when connecting, but that hasn't helped.

Offline

 

#11 2012-10-17 16:43:06

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: Touching not working!?

Daeica wrote:

I'm having the same problem. I've been looking around but i can't seem to find the solution.

Here's a sample of the script (Hoping that I've done it correctly!)

when gf clicked
forever
  glide [1.3] secs to x:[188] y:[-150]
  wait [0] secs
  glide [1.3] secs to x:[188] y:[-150]
     if <touching [Magic ball v]?>
      switch to costume [Dragon hit v]
      say [ARGH!] for [1] secs
      switch to costume [Dragon norm v]
  
  stop script
  end
end

Fixed and edited the script. I think you just needed a 'stop script' block in there.
Did that work?


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#12 2012-10-18 07:55:44

Xeronimo
New Scratcher
Registered: 2012-10-17
Posts: 5

Re: Touching not working!?

Hm ... still the same problem ... it seems to me like it's only registered as a 'touch' if certain, specific pixels of each sprite come into contact!?

Offline

 

#13 2012-10-18 11:14:16

Willpower
Scratcher
Registered: 2012-01-26
Posts: 1000+

Re: Touching not working!?

Xeronimo wrote:

Hm ... still the same problem ... it seems to me like it's only registered as a 'touch' if certain, specific pixels of each sprite come into contact!?

Can you post a link to this project?


http://i49.tinypic.com/e84kdj.png

Offline

 

#14 2012-10-18 15:59:46

awesomeness321
Scratcher
Registered: 2012-08-10
Posts: 100+

Re: Touching not working!?

Willpower wrote:

Xeronimo wrote:

Hm ... still the same problem ... it seems to me like it's only registered as a 'touch' if certain, specific pixels of each sprite come into contact!?

Can you post a link to this project?

First, he needs to upload it.


My newest project:http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=projects&amp;type=newest&amp;return=image&amp;num=1Color:#30F9A5 I am currently http://blocks.scratchr.org/API.php?user=awesomeness321&amp;action=onlineStatus&amp;type=text

Offline

 

#15 2012-10-19 02:30:54

Xeronimo
New Scratcher
Registered: 2012-10-17
Posts: 5

Re: Touching not working!?

Sorry, here's the link! Thanks  smile

http://scratch.mit.edu/projects/Xeronimo/2844723

Offline

 

#16 2012-10-22 21:35:22

gorjessina17
New Scratcher
Registered: 2012-10-22
Posts: 1

Re: Touching not working!?

I'm having the same problem as well. When I have my Sprite 1 set in a forever loop of "move 2 steps - if on edge, bounce" it will register the touch of my Sprite 3. But if I have it set to "glide" mode (even within the same exact script, with just taking out the move & bounce blocks and replacing them with the glide blocks), it doesn't register the touch. Is this something to do with how the glide script itself works? Maybe the sprite isn't technically touching the pixels between glide points?

Offline

 

Board footer