Log In  

Hi Folks,
First time poster here - having a great time learning Pico-8 and enjoying making a nice maze game and a 36 year old ambition to create a sequel to the ZX Spectrum's Hungry Horace. So...

I have a two channel baseline that I want to keep throughout the game, but would like to fade in channels three and four based on events in game - how far through the level people are, presence of certain beasties, or just at random, etc - and keep it in time with the other channels.

Suspect I could create each variant as a Pattern on its own, but I can't see an ability to control which pattern to move to when one ends.

Any ideas?

Thanks (and looking forward to showing off my first effort in a few weeks :-)
Paul

P#52823 2018-05-17 11:32 ( Edited 2018-05-20 19:21)

I've found that changes to patterns via poke don't seem to update immediately (it only applies the next time the pattern is triggered, iirc), but changes to SFX do. So what I'd probably do is have some silent SFXs always playing on those other channels in the pattern, but swap the note data in those SFXs (via memcpy) with other SFXs.

This could mean notes cut in suddenly in ways that sound bad, so you may want to read the SFX data and wait and only swap the SFX in gaps when no notes would be playing on the new SFX. I actually rigged up a system like this for a project but then didn't end up using it :p

P#52824 2018-05-17 12:02 ( Edited 2018-05-17 16:03)

Thanks for the tip! Good to know i'd not missed anything in the regular API that could do this.

I'm going to shelve messing with Poke and the like until i'm more comfortable with the basics and have more of a game that justifies the effort :-)

When I do find a solution though i'll report back!

P#52832 2018-05-17 14:21 ( Edited 2018-05-17 18:21)

You could just go to the SFX, upon the event, and poke the "Volume" variable accordingly.

P#52881 2018-05-20 12:40 ( Edited 2018-05-20 16:40)

I am doing that right now for my X-Wing vs Tie fighter project and @kittenmaster is the only solutin that works.
That is, play a looping sfx and poke the notes/volumes - this is the only solution that work given that playing sounds and _update are not synchronized (eg note duration is not a multiple of 1/30).

P#52885 2018-05-20 15:21 ( Edited 2018-05-20 19:21)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-29 04:21:43 | 0.037s | Q:17