Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+3)

To make the process more generic, you might write the animated field's script something like this:

on view do
 s:deck.sounds@"clip1","clip2","clip3"
 t:0 each snd in s
  if (0+me.text)~floor t play[snd] end
  t:t+60*snd.duration
 end 
 me.text:(floor t)%me.text+1
end

Collect a list of sound clips (s), then track a total time (t) while iterating through the sounds. A new sound needs to be played every time we reach the total duration of the preceding sounds (multiplying sound.duration by 60 to convert it from seconds to frames). To loop the sequence, the overall frame counter should be incremented modulo the sum of the duration of every sound, which we already computed in "t" by the end of the loop. For best results, make all your sound clips have a duration which evenly divides into frames. Note how the indexing to compute "s" offers a convenient way to repeat "phrases" of a song within a sequence without duplicating their sound clips.

(+2)

this is great! thank you guys :)