2018年3月25日 星期日

Scratch 廣播(broadcast)

Cat  :
Say:"Hello! Dog"
broadcast "dogSay" -(1)
(2)receive "catSay"
say: "Let's go to movies"
轉向-90度
set rotation style "left-right"
broadcast "LetGo" -(3)  
repeat until x position <-270
    move 10 step
    next costume
    wait 0.2

Dog:
(1) receive "dogSay"
say:"Hello! Cat"
broadcast "catSay" -(2)
(3) receive "LetGo"
repeat until x position <-270
    move 10 step
    next costume
    wait 0.2
Cat 程式
Dog 程式