导演Lingo问题 - 见代码

时间:2013-03-31 14:20:24

标签: if-statement statements lingo adobe-director

我正在尝试使用if语句转到Director游戏项目中的两个不同的帧但是尽管我已经转到第32帧的一个集合并转到第31帧而另一个,它们都将转到同一帧31。我究竟做错了什么?我无法弄清楚。 (参见此处的代码示例:)

-

on timeOut


  if the timer >= 360 and sprite(16).visible = 1 then
    member ("tellIt").text = "TIME UP"
    _movie.go(32)


  end if

  if the timer >= 360 and sprite(15).visible = 1 then
    member ("tellIt").text = "TIME UP"
    _movie.go(32)


  end if

  if the timer >= 360 and sprite(14).visible = 1 then
    member ("tellIt").text = "TIME UP"
    _movie.go(32)

  end if

  if the timer >= 360  and sprite(13).visible = 1 then
    member ("tellIt").text = "TIME UP"
    _movie.go(32 
  end if

if the timer > 350 and sprite(16).visible = 0 then
    _movie.go(31)
    member ("endIt").text = "LUNCH IS FOR THE BIRDS"
    member ("tellIt").text = "TIME FLIES"
  end if

  if the timer > 350 and sprite(15).visible = 0 then
    _movie.go(31)
    member ("endIt").text = "LUNCH IS FOR THE BIRDS"
    member ("tellIt").text = "TIME FLIES"
  end if

  if the timer > 350 and sprite(14).visible = 0 then
    _movie.go(31)
    member ("endIt").text = "LUNCH IS FOR THE BIRDS"
    member ("tellIt").text = "TIME FLIES"
  end if

  if the timer > 350  and sprite(13).visible = 0 then
    _movie.go(31)
    member ("endIt").text = "LUNCH IS FOR THE BIRDS"
    member ("tellIt").text = "TIME FLIES"
  end if

  if the timer > 350  and sprite(12).visible = 0 then
    _movie.go(31)
    member ("endIt").text = "LUNCH IS FOR THE BIRDS"
    member ("tellIt").text = "TIME FLIES"
  end if
--

此代码写在电影脚本上。

我真的希望你能引导我朝着正确的方向前进,因为我不知道为什么它不会进入我要求它的框架。游戏中的其他所有内容似乎都运行良好。

1 个答案:

答案 0 :(得分:1)

你拥有它的方式,首先检查的数量是多少都无关紧要,如果后面的任何一项检查都是真的,那么你最终会在第31帧结束。

如果在每个if语句中放置一个'exit',那么将确保不执行后面的检查。像:

if the timer >= 360 and sprite(16).visible = 1 then
   member ("tellIt").text = "TIME UP"
   _movie.go(32)
   exit
end if