1

我正在尝试使用 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
--

这段代码写在电影剧本上。

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

4

1 回答 1

1

以你的方式,不管有多少第一次检查是真的,如果后面的任何一个检查是真的,那么你将在第 31 帧结束。

如果您在每个 if 语句中放置一个“退出”,这将确保以后的检查不会完成。喜欢:

if the timer >= 360 and sprite(16).visible = 1 then
   member ("tellIt").text = "TIME UP"
   _movie.go(32)
   exit
end if
于 2013-03-31T14:45:19.090 回答