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

#1 2013-01-02 09:12:45

WacsamDZero
New Scratcher
Registered: 2013-01-02
Posts: 2

How to use the touching commond

there is nothing happend when I choose the touching of sensing command in an if command . why
code:
if touching role1
  go to x:50 y:50

Offline

 

#2 2013-01-02 09:21:55

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

Re: How to use the touching commond

you need a forever, maybe


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

Offline

 

#3 2013-01-02 10:01:44

technoguyx
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: How to use the touching commond

Yes, that's right. If you want something to happen when the sprite touches another, you need to check constantly whether the condition (touching a sprite) is met.

when gf clicked
forever
    if <touching [Sprite2 v]?>
        go to x:(50) y:(50)
    end
end
Alternatively, you can check just once when something else happens.

when I receive [something v]
if <touching [Sprite2 v]?>
    go to x:(50) y:(50)
end


http://getgnulinux.org/links/en/linuxliberated_4_78x116.png

Offline

 

#4 2013-01-02 16:22:47

lalala3
Scratcher
Registered: 2008-10-03
Posts: 100+

Re: How to use the touching commond

WacsamDZero wrote:

there is nothing happend when I choose the touching of sensing command in an if command . why
code:
if touching role1
  go to x:50 y:50

It's not a command. When it runs, if your sprite is touching role1 at the moment it checks for it, it will go to those coordinates. Otherwise, it will continue down the script. Make note that "if" is not synonymous to "when".


http://img515.imageshack.us/img515/9374/signature2nt.png

Offline

 

#5 2013-01-02 18:59:25

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: How to use the touching commond

If you want it to be like "When this sprite is touching role 1", you can use

wait until <<touching [role1 v]>>

Last edited by Mokat (2013-01-02 18:59:49)


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#6 2013-01-02 20:54:56

WacsamDZero
New Scratcher
Registered: 2013-01-02
Posts: 2

Re: How to use the touching commond

thank you very much

Offline

 

#7 2013-01-05 08:17:11

willsmith963
New Scratcher
Registered: 2013-01-05
Posts: 3

Re: How to use the touching commond

yes dood it is realy ameging try it.

Offline

 

Board footer