EVR.Sound.Prompt = function(sound)
{
   EVR.Animation.call(this, SOUND_PROMPT_FRAME_RATE);
   this.sound = sound;
   this.shifted = false;
   this.initialize();
   this.append();
   this.play();
}
EVR.Sound.Prompt.prototype = new EVR.Prompt;
EVR.inherit(EVR.Sound.Prompt, EVR.Animation);
EVR.Sound.Prompt.prototype.initialize = function()
{
   var container = this.sound;
   var text = SOUND_PROMPT_TEXT;
   var color = SOUND_PROMPT_COLOR;
   var size = SOUND_PROMPT_SIZE;
   var offset = SOUND_PROMPT_OFFSET;
   var spacing = SOUND_PROMPT_LETTER_SPACING;
   var height = SOUND_PROMPT_HEIGHT;
   EVR.Prompt.call(
      this, container, text, color, size, null, null, null, offset, spacing,
      height);
}
EVR.Sound.Prompt.prototype.sequence = function()
{
   var step = SOUND_PROMPT_STEP;
   var shifted = this.shifted;
   if (shifted)
   {
      this.move(step);
   }
   else
   {
      this.move(-step);
   }
   this.shifted = !shifted;
}
EVR.Sound.Prompt.prototype.hide = function()
{
   this.set_opacity(0);
}
EVR.Sound.Prompt.prototype.show = function()
{
   this.set_opacity(1);
}
EVR.Sound.Prompt.prototype.toString = function()
{
   return "[object EVR.Sound.Prompt]";
}
EVR.include("sound/audio/HTML5.js");
EVR.include("sound/audio/BGSound.js");
EVR.include("sound/audio/Embed.js");
EVR.Sound.Audio = function(container, type, format)
{
   EVR.Component.call(this, container, type);
   this.volume = SOUND_INITIAL_VOLUME;
   this.volume_step = SOUND_VOLUME_STEP;
   this.muted = true;
   this.format = format;
}
EVR.Sound.Audio.prototype = new EVR.Component;
EVR.Sound.Audio.prototype.set_song = function(name)
{
   this.song = name;
   this.set_path();
}
EVR.Sound.Audio.prototype.set_path = function()
{
   var root = SOUND_PATH;
   var song = this.song;
   var format = this.format;
   var quality = SOUND_QUALITY;
   var extension = format;
   var path = root + song + "/" + format + "/" + quality + "." + extension;
   this.element.setAttribute("src", path);
}
EVR.Sound.Audio.prototype.mute = function()
{
   if (this.muted)
   {
      this.muted = false;
      if (this.volume <= 0)
      {
	 this.increase_volume();
      }
   }
   else
   {
      this.muted = true;
   }
   this.set_volume();
}
EVR.Sound.Audio.prototype.increase_volume = function()
{
   var volume = this.volume + this.volume_step;
   if (volume > 1)
   {
      volume = 1.0;
   }
   if (this.muted)
   {
      this.mute();
   }
   this.volume = volume;
   this.set_volume();
}
EVR.Sound.Audio.prototype.decrease_volume = function()
{
   var volume = this.volume - this.volume_step;
   if (volume <= 0)
   {
      volume = 0;
      if (!this.muted)
      {
	 this.mute();
      }
   }
   else if (this.muted)
   {
      this.mute();
   }
   this.volume = volume;
   this.set_volume();
}
EVR.Sound.Audio.prototype.toString = function()
{
   "[object EVR.Sound.Audio]";
}
EVR.Sound.Audio.BGSound = function(container)
{
   EVR.Sound.Audio.call(this, container, "bgsound", "mp3");
   this.set_attributes();
   this.append();
}
EVR.Sound.Audio.BGSound.prototype = new EVR.Sound.Audio;
EVR.Sound.Audio.BGSound.prototype.set_attributes = function()
{
   var element = this.element;
   element.loop = -1;
   element.volume = -10000;
}
EVR.Sound.Audio.BGSound.prototype.set_volume = function()
{
   var element = this.element;
   if (this.muted)
   {
      element.volume = -10000;
   }
   else
   {
      element.volume = - parseInt((1 - this.volume) * 1500);
   }
}
EVR.Sound.Audio.BGSound.prototype.toString = function()
{
   return "[object EVR.Sound.Audio.BGSound]";
}
EVR.Sound.Audio.HTML5 = function(container)
{
   this.container = container;
   this.initialize_audio();
   this.volume = SOUND_INITIAL_VOLUME;
   this.volume_step = SOUND_VOLUME_STEP;
   this.set_attributes();
   this.append();
}
EVR.Sound.Audio.HTML5.prototype = new EVR.Sound.Audio;
EVR.Sound.Audio.HTML5.prototype.initialize_audio = function()
{
   var format = "ogg";
   if (!document.createElement("audio").canPlayType("audio/ogg"))
   {
      format = "mp3";
   }
   EVR.Sound.Audio.call(this, this.container, "audio", format);
}
EVR.Sound.Audio.HTML5.prototype.set_attributes = function()
{
   var element = this.element;
   element.volume = 0;
   element.addEventListener(
      "ended", function() { this.currentTime = 0; }, false);
}
EVR.Sound.Audio.HTML5.prototype.mute = function()
{
   EVR.Sound.Audio.prototype.mute.call(this);
   var element = this.element;
   if (element.paused)
   {
      element.play();
   }
}
EVR.Sound.Audio.HTML5.prototype.set_volume = function()
{
   var element = this.element;
   if (this.muted)
   {
      element.volume = 0;
   }
   else
   {
      element.volume = this.volume;
   }
}
EVR.Sound.Audio.HTML5.prototype.set_song = function(name)
{
   var element = this.element;
   var paused = element.paused;
   EVR.Sound.Audio.prototype.set_song.call(this, name);
   element.load();
   if (!paused && !this.muted)
   {
      element.play();
   }
}
EVR.Sound.Audio.HTML5.prototype.toString = function()
{
   return "[object EVR.Sound.Audio.HTML5]";
}
18.188.125.151
18.188.125.151
18.188.125.151
 
August 12, 2013

I've been researching tartan/plaid recently for decoration in my updated version of Ball & Cup, now called Send. I want to create the atmosphere of a sports event, so I plan on drawing tartan patterns at the vertical edges of the screen as backgrounds for areas where spectator ants generate based on player performance. I figured I would make my own patterns, but after browsing tartans available in the official register, I decided to use existing ones instead.

I made a list of the tartans that had what I thought were interesting titles and chose 30 to base the game's levels on. I sequenced them, using their titles to form a loose narrative related to the concept of sending. Here are three tartans in the sequence (levels 6, 7 and 8) generated by an algorithm I inferred by looking at examples that reads a tartan specification and draws its pattern using a simple dithering technique to blend the color stripes.


Acadia


Eve


Spice Apple

It would be wasting an opportunity if I didn't animate the tartans, so I'm thinking about animations for them. One effect I want to try is making them look like water washing over the area where the ants are spectating. I've also recorded some music for the game. Here are the loops for the game over and high scores screens.

Game Over

High Scores