{"id":2850,"date":"2013-09-06T19:34:55","date_gmt":"2013-09-07T02:34:55","guid":{"rendered":"http:\/\/www.nathalielawhead.com\/candybox\/?p=2850"},"modified":"2013-09-06T19:34:55","modified_gmt":"2013-09-07T02:34:55","slug":"offender-2-programming-a-composer","status":"publish","type":"post","link":"http:\/\/www.nathalielawhead.com\/candybox\/offender-2-programming-a-composer","title":{"rendered":"Offender 2 &#8211; Programming A Composer"},"content":{"rendered":"<p>Every time I program the soundtrack for one of my games I get inspired with how I could perfect the engine for music.<br \/>\nI know that a long term goal will be to program a composer. It&#8217;s my personal creative crusade. :) I want to create something that, with some degree of intelligence, really &#8220;makes&#8221; music while you play.<br \/>\nAlthough realizing that goal is still a ways off, I&#8217;m very proud of my current achievement.<\/p>\n<p>Offender 2 development has covered a lot of ground since my last <a href=\"http:\/\/www.nathalielawhead.com\/candybox\/the-sounds-music-of-offender-2-production-notes\" target=\"_blank\">blog post update<\/a>.<br \/>\nOne of the advantages of creating your own music is that you can get really creative with how the engine will handle playing it. You can get as detailed as you want!<\/p>\n<p>I&#8217;ve finished pretty much all audio work except for the final touch. In-game bunny dialogue. Given the nature of the game, this is very important.<br \/>\nChoosing the most manageable starting point for it, I began with the boss battle (<a href=\"https:\/\/vimeo.com\/72319390\" target=\"_blank\">The Tank<\/a>).<br \/>\nHere&#8217;s an excerpt of it (Give it a listen! You won&#8217;t regret it.) :<\/p>\n<p><iframe loading=\"lazy\" width=\"100%\" height=\"166\" scrolling=\"no\" frameborder=\"no\" src=\"https:\/\/w.soundcloud.com\/player\/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F109077823\"><\/iframe><\/p>\n<p>I decided to start with this portion of the game because it was the most linear, or so it seemed.<br \/>\nI came up with the idea of having the bunnies bicker with eachother while trying to navigate the thing (listen to the above).<br \/>\nThen I decided to break up the dialogue, so that the engine could compile a random &#8220;bicker playlist&#8221;. Every-time you play against The Tank the conversation would take place in a different order. Appearing to be a new argument.<\/p>\n<p>Here&#8217;s an example of it coded:<br \/>\n[swfobj src=&#8221;http:\/\/nathalielawhead.com\/sourcefiles\/Offender2\/code_examples\/Aud_BossTank.swf&#8221; height=&#8221;586&#8243; width=&#8221;460&#8243;]<\/p>\n<p>(<a href=\"http:\/\/nathalielawhead.com\/sourcefiles\/Offender2\/code_examples\/Aud_BossTank.fla\" target=\"_blank\">Download source here!<\/a>)<\/p>\n<p>Code:<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #888888\">\/\/test sound events that take presendence over the tank dialogue currently playing<\/span>\r\n<span style=\"color: #888888\">\/\/when one is done dialogue is to resume from where it left off<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_aud_testEvent:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_AbductionVoice08<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_AbductionVoice09<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_AbductionVoice10<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_AbductionVoice11<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_AbductionVoice12<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_AbductionVoice13<\/span><span style=\"color: #333333\">());<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_chan_tankEvent:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">();\/\/<\/span>used <span style=\"color: #008800; font-weight: bold\">for<\/span> all events\r\n\r\n<span style=\"color: #888888\">\/\/dialogue for the boss tank<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_aud_tankDialogue_default:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_BossTank_Dialogue_Default01<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_BossTank_Dialogue_Default02<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_BossTank_Dialogue_Default03<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_BossTank_Dialogue_Default04<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_BossTank_Dialogue_Default05<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_BossTank_Dialogue_Default06<\/span><span style=\"color: #333333\">());<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_chan_tankDialogue_default:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">();<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> num_aud_tankDialogue_default:<span style=\"color: #333399; font-weight: bold\">Number<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">;\/\/<\/span>the array element <span style=\"color: #333333\">(<\/span>channel<span style=\"color: #333333\">)<\/span> currently playing\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> num_aud_tankDialogue_default_position:<span style=\"color: #333399; font-weight: bold\">Number<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">;\/\/<\/span>the position that it was last on <span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">for<\/span> pausing and resuming<span style=\"color: #333333\">)<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> trans_aud_tankDialogue:<span style=\"color: #333399; font-weight: bold\">SoundTransform<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">SoundTransform<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">);<\/span>\r\n\r\n<span style=\"color: #888888\">\/\/randomize the array (thanks stackoverflow!)<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">shuffleArray<\/span><span style=\"color: #333333\">(<\/span> a <span style=\"color: #333333\">:<\/span> <span style=\"color: #333399; font-weight: bold\">*<\/span><span style=\"color: #333333\">,<\/span> b <span style=\"color: #333333\">:<\/span> <span style=\"color: #333399; font-weight: bold\">*<\/span> <span style=\"color: #333333\">){<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">return<\/span> <span style=\"color: #333333\">(<\/span> Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()<\/span> <span style=\"color: #333333\">&gt;<\/span> <span style=\"color: #333333\">.<\/span><span style=\"color: #0000DD; font-weight: bold\">5<\/span> <span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">?<\/span> <span style=\"color: #0000DD; font-weight: bold\">1<\/span> <span style=\"color: #333333\">:<\/span> <span style=\"color: #333333\">-<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">;<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n<span style=\"color: #888888\">\/\/The Dialogue<\/span>\r\n\r\n<span style=\"color: #888888\">\/\/Call this to start<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evntInit_snd_BossTank<\/span><span style=\"color: #333333\">(){<\/span>\r\n\t<span style=\"color: #888888\">\/\/randomize the array first<\/span>\r\n\tarr_aud_tankDialogue_default <span style=\"color: #333333\">=<\/span> arr_aud_tankDialogue_default<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">sort<\/span><span style=\"color: #333333\">(<\/span>shuffleArray<span style=\"color: #333333\">);<\/span>\r\n\tnum_aud_tankDialogue_default <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">;\/\/<\/span><span style=\"color: #008800; font-weight: bold\">set<\/span> the initial starting array element value\r\n\tnum_aud_tankDialogue_default_position <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">;\/\/<\/span>reset the position\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;The playback order will be: &quot;<\/span><span style=\"color: #333333\">+<\/span>arr_aud_tankDialogue_default<span style=\"color: #333333\">);<\/span>\r\n\tevntStart_snd_BossTank<span style=\"color: #333333\">();<\/span>\r\n<span style=\"color: #333333\">};<\/span>\r\n\r\n<span style=\"color: #888888\">\/\/Start the main track (default) for the boss tank<\/span>\r\n<span style=\"color: #888888\">\/\/Play the array starting from 1, and stopping at the end<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evntStart_snd_BossTank<\/span><span style=\"color: #333333\">(){<\/span>\r\n\t<span style=\"color: #888888\">\/\/start up the first sound<\/span>\r\n\tarr_chan_tankDialogue_default<span style=\"color: #333333\">[<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">]<\/span> <span style=\"color: #333333\">=<\/span> Sound<span style=\"color: #333333\">(<\/span>arr_aud_tankDialogue_default<span style=\"color: #333333\">[<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">]).<\/span>play<span style=\"color: #333333\">(<\/span>num_aud_tankDialogue_default_position<span style=\"color: #333333\">,<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span>trans_aud_tankDialogue<span style=\"color: #333333\">);<\/span>\r\n\tarr_chan_tankDialogue_default<span style=\"color: #333333\">[<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">].<\/span>addEventListener<span style=\"color: #333333\">(<\/span>Event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">SOUND_COMPLETE<\/span><span style=\"color: #333333\">,<\/span>evntComplete_snd_BossTank<span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Now playing: &quot;<\/span><span style=\"color: #333333\">+<\/span>arr_aud_tankDialogue_default<span style=\"color: #333333\">[<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">]+<\/span><span style=\"background-color: #fff0f0\">&quot; at position &quot;<\/span><span style=\"color: #333333\">+<\/span>num_aud_tankDialogue_default_position<span style=\"color: #333333\">+<\/span><span style=\"background-color: #fff0f0\">&quot;.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evntComplete_snd_BossTank<\/span><span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Event<\/span><span style=\"color: #333333\">){<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Complete, start next.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/remove the listener<\/span>\r\n\tSoundChannel<span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">target<\/span><span style=\"color: #333333\">).<\/span>removeEventListener<span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">type<\/span><span style=\"color: #333333\">,<\/span> evntComplete_snd_BossTank<span style=\"color: #333333\">);<\/span>\r\n\tnum_aud_tankDialogue_default_position <span style=\"color: #333333\">=<\/span> <span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">;\/\/<\/span>reset the position\r\n\t<span style=\"color: #888888\">\/\/set the next one<\/span>\r\n\tnum_aud_tankDialogue_default <span style=\"color: #333333\">+=<\/span>  <span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #888888\">\/\/if you&#39;ve reached the end reset and shuffle (randomize) the array again<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">if<\/span> <span style=\"color: #333333\">(<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">&gt;<\/span>arr_aud_tankDialogue_default<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">-<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">){<\/span>\r\n\t\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;You reached the end of the dialogue. Re-set, re-shuffle, and re-initiate.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n\t\tevntInit_snd_BossTank<span style=\"color: #333333\">();<\/span>\r\n\t<span style=\"color: #333333\">}<\/span><span style=\"color: #008800; font-weight: bold\">else<\/span><span style=\"color: #333333\">{<\/span>\r\n\t\t<span style=\"color: #888888\">\/\/start!<\/span>\r\n\t\tevntStart_snd_BossTank<span style=\"color: #333333\">();<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n<span style=\"color: #888888\">\/\/resume the main track (default) if another event paused it<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evntPause_snd_BossTank<\/span><span style=\"color: #333333\">(){<\/span>\r\n\t<span style=\"color: #888888\">\/\/rememver the position it was stopped at<\/span>\r\n\tnum_aud_tankDialogue_default_position <span style=\"color: #333333\">=<\/span> arr_chan_tankDialogue_default<span style=\"color: #333333\">[<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">].<\/span>position<span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #888888\">\/\/now stop and remove all<\/span>\r\n\tarr_chan_tankDialogue_default<span style=\"color: #333333\">[<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">].<\/span>stop<span style=\"color: #333333\">();<\/span>\r\n\tarr_chan_tankDialogue_default<span style=\"color: #333333\">[<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">].<\/span>removeEventListener<span style=\"color: #333333\">(<\/span>Event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">SOUND_COMPLETE<\/span><span style=\"color: #333333\">,<\/span>evntComplete_snd_BossTank<span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span>arr_aud_tankDialogue_default<span style=\"color: #333333\">[<\/span>num_aud_tankDialogue_default<span style=\"color: #333333\">]+<\/span><span style=\"background-color: #fff0f0\">&quot; was stopped at &quot;<\/span><span style=\"color: #333333\">+<\/span>num_aud_tankDialogue_default_position<span style=\"color: #333333\">+<\/span><span style=\"background-color: #fff0f0\">&quot;.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n\r\n<span style=\"color: #888888\">\/\/The events<\/span>\r\n<span style=\"color: #888888\">\/\/call to trigger a new sound event that should pause dialogue<\/span>\r\n<span style=\"color: #888888\">\/\/tank receives damage, pukes, etc..<\/span>\r\n<span style=\"color: #888888\">\/\/call via: evntEvent_snd_BossTank(THE_SOUND_ARRAY, THE_ARRAY_ELEMENT);<\/span>\r\n<span style=\"color: #888888\">\/\/random: evntEvent_snd_BossTank(THE_SOUND_ARRAY, Math.ceil(Math.random()*THE_SOUND_ARRAY.length)-1);<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evntEvent_snd_BossTank<\/span><span style=\"color: #333333\">(<\/span>arr<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">,<\/span> arr_element<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Number<\/span><span style=\"color: #333333\">){<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;Stop the dialogue, and start the event sound.&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/stop the last <\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">if<\/span><span style=\"color: #333333\">(<\/span>arr_chan_tankEvent<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">&gt;<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">){<\/span>\r\n\t\tarr_chan_tankEvent<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">].<\/span>stop<span style=\"color: #333333\">();<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n\t<span style=\"color: #888888\">\/\/stop the dialogue<\/span>\r\n\tevntPause_snd_BossTank<span style=\"color: #333333\">();<\/span>\r\n\t<span style=\"color: #888888\">\/\/start a new one<\/span>\r\n\tarr_chan_tankEvent<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">]<\/span> <span style=\"color: #333333\">=<\/span> Sound<span style=\"color: #333333\">(<\/span>arr<span style=\"color: #333333\">[<\/span>arr_element<span style=\"color: #333333\">]).<\/span>play<span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">);<\/span>\r\n\tarr_chan_tankEvent<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">].<\/span>addEventListener<span style=\"color: #333333\">(<\/span>Event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">SOUND_COMPLETE<\/span><span style=\"color: #333333\">,<\/span> evntEnd_snd_BossTank<span style=\"color: #333333\">);<\/span>\r\n\t\r\n<span style=\"color: #333333\">}<\/span>\r\n<span style=\"color: #888888\">\/\/resume normal dialogue after the event<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evntEnd_snd_BossTank<\/span><span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Event<\/span><span style=\"color: #333333\">){<\/span>\r\n\tSoundChannel<span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">target<\/span><span style=\"color: #333333\">).<\/span>removeEventListener<span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">type<\/span><span style=\"color: #333333\">,<\/span> evntEnd_snd_BossTank<span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/<\/span>\r\n\tevntStart_snd_BossTank<span style=\"color: #333333\">();<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n\r\n<span style=\"color: #888888\">\/\/Stop ALL boss sounds (clear and close)<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evntStopAll_snd_BossTank<\/span><span style=\"color: #333333\">(){<\/span>\r\n\t<span style=\"color: #0066BB; font-weight: bold\">trace<\/span><span style=\"color: #333333\">(<\/span><span style=\"background-color: #fff0f0\">&quot;\\nALL SOUNDS STOPPED!\\n&quot;<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/stop the dialogue<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">if<\/span><span style=\"color: #333333\">(<\/span>arr_chan_tankDialogue_default<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">!=<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">){<\/span>\r\n\t\tevntPause_snd_BossTank<span style=\"color: #333333\">();<\/span>\r\n\t<span style=\"color: #333333\">};<\/span>\r\n\t<span style=\"color: #888888\">\/\/stop the events (if an event has been called)<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">try<\/span><span style=\"color: #333333\">{<\/span>\r\n\t\t<span style=\"color: #008800; font-weight: bold\">if<\/span><span style=\"color: #333333\">(<\/span>arr_chan_tankEvent<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">&gt;<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">){<\/span>\r\n\t\t\tarr_chan_tankEvent<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">].<\/span>stop<span style=\"color: #333333\">();<\/span>\r\n\t\t<span style=\"color: #333333\">};<\/span>\r\n\t\tarr_chan_tankEvent<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">].<\/span>removeEventListener<span style=\"color: #333333\">(<\/span>Event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">SOUND_COMPLETE<\/span><span style=\"color: #333333\">,<\/span> evntEnd_snd_BossTank<span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #333333\">}<\/span><span style=\"color: #008800; font-weight: bold\">catch<\/span><span style=\"color: #333333\">(<\/span>e<span style=\"color: #333333\">:<\/span>Error<span style=\"color: #333333\">){<\/span>\r\n\t\t<span style=\"color: #888888\">\/\/an event was never initiated<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n<\/pre>\n<\/div>\n<p>It&#8217;s a fun, simple, beginning. I really like how it turned out, so I want to have something similar in the main game (bunnies talking with each-other). One of the reasons is that it&#8217;s a great delivery platform for comedy. It&#8217;s the final touch! The game is going to be packed with humor when I&#8217;m finished.<\/p>\n<p>There&#8217;s a LOT of sound to manage. I&#8217;m taking the liberty to experiment with all sorts of ways to incorporate it. I&#8217;m the most proud of the in-game music (<a href=\"http:\/\/www.nathalielawhead.com\/candybox\/the-sounds-music-of-offender-2-production-notes\" target=\"_blank\">example here<\/a>)\u2026 It&#8217;s the closest thing yet to &#8220;programming a composer&#8221;\u2026 I love that term. One day I&#8217;ll actually do it!<\/p>\n<p>So, to conclude this, I&#8217;m posting another source code excerpt. It plays a sound from a sound set (array), and only plays the next when the starting sound is passed a certain point. A bit like ON_COMPLETE\u2026 I hope that made sense. I&#8217;m super tired. :)<br \/>\nThe result is that sounds don&#8217;t pile over each-other when multiple events with a sound linked to them take place (like damage, health, etc). They play in manageable intervals.<\/p>\n<p>Here&#8217;s an interactive example (button-mash your mouse to test):<br \/>\n[swfobj src=&#8221;http:\/\/nathalielawhead.com\/sourcefiles\/Offender2\/code_examples\/Sound_onlyPlayOnComplete.swf&#8221; height=&#8221;200&#8243; width=&#8221;480&#8243;]<\/p>\n<p>(<a href=\"http:\/\/nathalielawhead.com\/sourcefiles\/Offender2\/code_examples\/Sound_onlyPlayOnComplete.fla\" target=\"_blank\">Download source here!<\/a>)<\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%\"><span style=\"color: #008800; font-weight: bold\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold\">flash.events.MouseEvent<\/span><span style=\"color: #333333\">;<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold\">flash.events.Event<\/span><span style=\"color: #333333\">;<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold\">flash.media.Sound<\/span><span style=\"color: #333333\">;<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_snd_ship_damageHit:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageHit01<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageHit02<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageHit03<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageHit04<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageHit05<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageHit06<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageHit07<\/span><span style=\"color: #333333\">());<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_chan_ship_damageHit:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">();\/\/<\/span>the sound channels <span style=\"color: #008800; font-weight: bold\">for<\/span> the above\r\n<span style=\"color: #888888\">\/\/alien damage<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_snd_ship_damageVoice:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">(<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice01<\/span><span style=\"color: #333333\">(),<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice02<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice03<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice04<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice05<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice06<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice07<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice08<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice09<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice10<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice11<\/span><span style=\"color: #333333\">(),<\/span><span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">AUD_GP_Ship_DamageVoice12<\/span><span style=\"color: #333333\">());<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">var<\/span> arr_chan_ship_damageVoice:<span style=\"color: #333399; font-weight: bold\">Array<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">();\/\/<\/span>sound channels <span style=\"color: #008800; font-weight: bold\">for<\/span> the above\r\n\r\n\r\n<span style=\"color: #888888\">\/\/A sound is &quot;complete&quot; at a custom point -- (hope the following explanation makes sense, I&#39;m too tired to think :)<\/span>\r\n<span style=\"color: #888888\">\/\/randomly play sounds from an array (start one and hold starting the other) based on an interval parameter pased to it<\/span>\r\n<span style=\"color: #888888\">\/\/if you want it to play the next sound half way through pass it 2, etc...<\/span>\r\n<span style=\"color: #888888\">\/\/only one sound (element [0] of it&#39;s sound channel array) may play at a time<\/span>\r\n<span style=\"color: #888888\">\/\/once the sound is at its end point (like 2 - half way through) the next one may play<\/span>\r\n<span style=\"color: #888888\">\/\/you may also pass it a random interval so they trigger at more random<\/span>\r\n<span style=\"color: #888888\">\/\/usage: evnt_snd_startAfterPos(arr_snd_ship_damageVoice, arr_chan_ship_damageVoice, 2, 1);<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evnt_snd_startAfterPos<\/span><span style=\"color: #333333\">(<\/span>sndArray<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">,<\/span> chanArray<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Array<\/span><span style=\"color: #333333\">,<\/span> interval<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Number<\/span><span style=\"color: #333333\">,<\/span> vol<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Number<\/span><span style=\"color: #333333\">){<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> randSnd:<span style=\"color: #333399; font-weight: bold\">Number<\/span> <span style=\"color: #333333\">=<\/span> Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()*<\/span>sndArray<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">)-<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">;<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">var<\/span> sndTrans:<span style=\"color: #333399; font-weight: bold\">SoundTransform<\/span> <span style=\"color: #333333\">=<\/span> <span style=\"color: #008800; font-weight: bold\">new<\/span> <span style=\"color: #333399; font-weight: bold\">SoundTransform<\/span><span style=\"color: #333333\">(<\/span>vol<span style=\"color: #333333\">,<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/if a sound is not already playing then play one<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">if<\/span><span style=\"color: #333333\">(<\/span>chanArray<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">length<\/span><span style=\"color: #333333\">&lt;=<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">){<\/span>\r\n\t\tchanArray<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">]<\/span> <span style=\"color: #333333\">=<\/span> Sound<span style=\"color: #333333\">(<\/span>sndArray<span style=\"color: #333333\">[<\/span>randSnd<span style=\"color: #333333\">]).<\/span>play<span style=\"color: #333333\">(<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">,<\/span>sndTrans<span style=\"color: #333333\">);<\/span>\r\n\t\taddEventListener<span style=\"color: #333333\">(<\/span>Event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ENTER_FRAME<\/span><span style=\"color: #333333\">,<\/span> evnt_reset<span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n\t<span style=\"color: #888888\">\/\/if over interval through then clear the array and start over again<\/span>\r\n\t<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">evnt_reset<\/span><span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">Event<\/span><span style=\"color: #333333\">){<\/span>\r\n\t\t<span style=\"color: #888888\">\/\/trace(&quot;Position: &quot;+chanArray[0].position);<\/span>\r\n\t\t<span style=\"color: #888888\">\/\/trace(&quot;Length: &quot;+sndArray[randSnd].length);<\/span>\r\n\t\t<span style=\"color: #888888\">\/\/if...<\/span>\r\n\t\t<span style=\"color: #008800; font-weight: bold\">if<\/span><span style=\"color: #333333\">(<\/span>Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>chanArray<span style=\"color: #333333\">[<\/span><span style=\"color: #0000DD; font-weight: bold\">0<\/span><span style=\"color: #333333\">].<\/span>position<span style=\"color: #333333\">)<\/span> <span style=\"color: #333333\">&gt;=<\/span> Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">ceil<\/span><span style=\"color: #333333\">(<\/span>sndArray<span style=\"color: #333333\">[<\/span>randSnd<span style=\"color: #333333\">].<\/span>length<span style=\"color: #333333\">\/<\/span>interval<span style=\"color: #333333\">)){<\/span>\r\n\t\t\tremoveEventListener<span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">type<\/span><span style=\"color: #333333\">,<\/span> evnt_reset<span style=\"color: #333333\">);<\/span>\r\n\t\t\tchanArray<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">pop<\/span><span style=\"color: #333333\">();\/\/<\/span>clear the array\r\n\t\t<span style=\"color: #333333\">}<\/span>\r\n\t<span style=\"color: #333333\">}<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\n\r\n<span style=\"color: #888888\">\/\/<\/span>\r\n<span style=\"color: #008800; font-weight: bold\">function <\/span><span style=\"color: #0066BB; font-weight: bold\">test<\/span><span style=\"color: #333333\">(<\/span>event<span style=\"color: #333333\">:<\/span><span style=\"color: #333399; font-weight: bold\">MouseEvent<\/span><span style=\"color: #333333\">){<\/span>\r\n\t<span style=\"color: #888888\">\/\/trigger next half way through<\/span>\r\n\tevnt_snd_startAfterPos<span style=\"color: #333333\">(<\/span>arr_snd_ship_damageVoice<span style=\"color: #333333\">,<\/span> arr_chan_ship_damageVoice<span style=\"color: #333333\">,<\/span> <span style=\"color: #0000DD; font-weight: bold\">2<\/span><span style=\"color: #333333\">,<\/span> <span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">);<\/span>\r\n\t<span style=\"color: #888888\">\/\/trigger next at random<\/span>\r\n\tevnt_snd_startAfterPos<span style=\"color: #333333\">(<\/span>arr_snd_ship_damageHit<span style=\"color: #333333\">,<\/span> arr_chan_ship_damageHit<span style=\"color: #333333\">,<\/span> <span style=\"color: #0000DD; font-weight: bold\">8<\/span><span style=\"color: #333333\">,<\/span> Math<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">random<\/span><span style=\"color: #333333\">()*<\/span><span style=\"color: #0000DD; font-weight: bold\">1<\/span><span style=\"color: #333333\">);<\/span>\r\n<span style=\"color: #333333\">}<\/span>\r\nstage<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">addEventListener<\/span><span style=\"color: #333333\">(<\/span>MouseEvent<span style=\"color: #333333\">.<\/span><span style=\"color: #0000CC\">MOUSE_DOWN<\/span><span style=\"color: #333333\">,<\/span> test<span style=\"color: #333333\">);<\/span>\r\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Every time I program the soundtrack for one of my games I get inspired with how I could perfect the engine for music. I know that a long term goal will be to program a composer. It&#8217;s my personal creative crusade. :) I want to create something that, with some degree of intelligence, really &#8220;makes&#8221; music while you play. Although realizing that goal is still a ways off, I&#8217;m very proud of my current achievement. Offender 2 development has covered a lot of ground since my last blog post update. One of the advantages of creating your own music is&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":4522,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[30,12],"tags":[],"class_list":["post-2850","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-games","category-resources"],"_links":{"self":[{"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/2850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/comments?post=2850"}],"version-history":[{"count":4,"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/2850\/revisions"}],"predecessor-version":[{"id":2854,"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/posts\/2850\/revisions\/2854"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/media\/4522"}],"wp:attachment":[{"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/media?parent=2850"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/categories?post=2850"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nathalielawhead.com\/candybox\/wp-json\/wp\/v2\/tags?post=2850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}