Weekly Sneak Peek - Week 22
🕑 Added 2020-06-02 15:50:12 +0000 UTCHello! ^w^
Thank you for checking out this sneak peek! You really want to see some naked kobolds, huh? Well here you go!




Cutescene System
Hi Null here! :3 People really enjoyed last week’s section so I thought I'd showcase coding stuff more regularly!
This week I’ll cover how I implemented the cutscene system.
One thing I missed a lot coming from Unity are coroutines, which were super handy for things like cutscenes, boss patterns, AI, etc.
To emulate coroutines, I wrote a little scripting system inside of GameMaker that can accomplish the same.
A cutscene is made up of events:

An event can basically do whatever it wants, and the cutscene controller will keep calling it until its “done” flag is set to true.
Because the system needs to support jumping and branching, the events are kept in memory until the cutscene finished. That’s also why there is a second “Setup/Reset” event on the object in addition to GameMaker’s standard Create event.
Event types, such as camera shake, walking a character, opening a dialogue box, panning the camera, etc. will inherit this base event and flesh it out with their own implementation.

Most of them are very simple. For example, all the camera shake event does is set the appropriate attribute for the active camera and then set itself to "done".
For the actual scripting language I made short functions that create and setup the events and also add them to the cutscene:

The cutscene controller itself is very simple, too:

Putting it all together it looks like this:

This would loop indefinitely, because the last line jumps back to the beginning.
Result:

And there you have it! It is very simple but we can easily extend it and it is highly flexible! I’m looking forward to using this for all kinds of scripted encounters. :D
Cheers!
Cookie & Null
Comments
Cookiedraggy
Thanks! - Null
Tyler R
Gotta love reusable and easy to use code. Great work!
Felbun
Soon? That’s awesome to hear! Honestly, I was expecting it to be another month or something. Anyway keep up the good work
Cookiedraggy
We are not giving out release dates, but it is due pretty soon! ^^
Felbun
This village update is going to be packing quite a ton of new content. What’s your guy’s estimate on it being done?
Cookiedraggy
Awww im glad you like them! ^^
Zephy Foxy
I love the female kobolds, they're so cute