The Shindig: Music?
As part of the PiCoSteveMo game jam I'm building a deck builder game where you host a great party.
The last time (see day 5) I worked on showing more than a single row of guests and introduced the planning "scene". I ran into some issues setting up the concept of a class in lua and left it at that.
Since last working I've made some progress on the planning scene. I managed to reuse some of the concepts from the party scene whilst resisting the urge to refactor out common logic.
State / scene management
I was also recommended a very simple system for managing states which I'm a big fan of. The gist of it is like this. We set a global variable to hold the update and draw methods of the current scene. Then we call them in the top-level PICO-8 hooks.
-- empty global variables which will be populated with
-- update and draw methods for scenes
Update = nil
Draw = nil
function _init()
-- the initial state
PartyInit()
end
function _update()
Update()
end
function _draw()
Draw()
end
Then we define a state's init, draw and update methods. The init function switches the Update and Draw methods to point to the methods of this state.
-- update the Update and Draw methods to be the one for this scene
function PartyInit()
Update=PartyUpdate
Draw=PartyDraw
end
function PartyUpdate()
end
function PartyDraw()
end
To switch to the a new state your just call the init method for that state, e.g. PartyInit() or PlanningInit() etc.
It doesn't solve my issue of having out of scope global variables so for now I may just put everything in one file again.
Music and sound
I'm starting to get the hang of the sprite editor and putting sprites on the screen. I've also worked with accepting user input and managing game state. As of yet I haven't done any work with sounds or composing music and I don't want this to become an afterthought, so I'll try some today.
After all what kind of party would it be without music. In the Shining movie it seems like they use what sounds like ballroom music from the 1920s. I'd like to have a try recreating that feeling.
After some messing around I think I'm starting to understand the two user interfaces. As before the cheat sheet was very helpful in learning to navigate the functionality.
One initially looks like it is designed for sound effects:
and the next looks like a tracker for composing music:
But both of these screens are actually showing representations of the same data in memory. You can see in the tracker the first column is the octave of the note.
You can see I'm adding a 5 in the last column sometimes. This is the effect column and 5 corresponds to the "fade out" effect. Two notes next two each other will sound like a held down note so I am using the fade out to simulate pressing the key again.
It still doesn't feel like I can compose naturally in this interface yet but let's see where the music takes us.