0

我需要一种算法来告诉精灵在文本出现后立即结束,基本上我需要制作一个过场动画来描述游戏中故事的开始,但是由于我使用的是游戏制作者,我不知道如何要做到这一点,有人可以帮助我吗?

4

1 回答 1

0

For cutscenes and automated image sequences you usually have some sort of variables, that handle the states and counters for displaying sprite's sub-images. But firstly I like to use mainly two main time-related variables in my controller object usually named sys (counter and counterTime):

c = 0;  // and for stepEvent: c += 1;              // so it goes +1 per step
ct = 0; // and for stepEvent: ct+= 1 / room_speed; // so it goes +1 per second

During the cutscene you might want to stop everything else that moves:

is_cutscene = false;  // objects might not be able to move when this is true
                      // you still have to implement that by yourself
                      // player can't move if is_cutscene, nothing happens!!
                                             (except cutscene buttons etc...)

So now when the player gets to a 'cutscene'y object and triggers some cutscene_1 = true eg. you can have the image/text/sound/animation object come to life/create/active... That object might have in the create event:

duration = 6;       // 6 seconds the scene lasts
start_time = sys.ct // and in Step: if sys.ct > (start_time + duration)
                    //              then -> cutscene advance/destroy

Ofcourse - this is super simple and now you could only say implement:

  • walk close to a pop-up object
  • show an image for 6 seconds
  • it dissappears

And it might not be big trouble to implement it... BUT THIS may also be the foundation for more advanced multi-step sequence and cuts.

于 2021-10-14T09:12:22.190 回答