EVR.include("level/cluster/Beam.js");
EVR.Level.Cluster = function(passage, width, gap, practice)
{
   this.passage = passage - 1;
   this.beam_width = parseFloat(width);
   this.gap = parseFloat(gap);
   this.practice = practice;
   this.dimensions = [0, 0];
}
EVR.Level.Cluster.prototype = new EVR.Graphic;
EVR.Level.Cluster.prototype.update_dimensions = function()
{
   var remove = false;
   if (!this.attached)
   {
      var remove = true;
      this.append();
   }
   this.dimensions = EVR.Graphic.prototype.get_dimensions.call(this);
   if (remove)
   {
      this.remove();
   }
}
EVR.Level.Cluster.prototype.get_dimensions = function()
{
   return this.dimensions;
}
EVR.Level.Cluster.prototype.initiate = function(container, level)
{
   EVR.Graphic.call(
      this, container, RATIO_HEIGHT, null, null, container.container);
   this.beam_height = container.beam_height;
   this.colors = level.beams;
   this.margin = container.margin;
   this.set_proportions();
   this.populate();
   this.update_dimensions();
}
EVR.Level.Cluster.prototype.set_proportions = function()
{
   var width = this.calculate_width();
   var height = this.container.get_dimensions(true)[1];
   EVR.Graphic.prototype.set_proportions.call(this, width, height);
}
EVR.Level.Cluster.prototype.calculate_width = function()
{
   var sum = this.beam_width + this.gap;
   var count = this.colors.length;
   var divisor = count + (this.margin / this.beam_height) * (count - 1);
   return sum / divisor;
}
EVR.Level.Cluster.prototype.populate = function()
{
   this.beams = [];
   for (var ii = 0; ii < this.colors.length; ii++)
   {
      this.beams.push(new EVR.Level.Cluster.Beam(this, ii, this.practice));
   }
}
EVR.Level.Cluster.prototype.draw = function()
{
   EVR.Graphic.prototype.draw.call(this);
   if (!!this.beams)
   {
      for (var ii = 0; ii < this.beams.length; ii++)
      {
	 this.beams[ii].draw();
      }
   }
   this.update_dimensions();
}
EVR.Level.Cluster.prototype.get_gap_x = function()
{
   var x = this.get_coordinates()[0];
   var width = this.beams[0].get_dimensions()[0];
   return x + width;
}
EVR.Level.Cluster.prototype.toString = function()
{
   return "[object EVR.Level.Cluster]";
}
EVR.Level.Cluster.Beam = function(container, index, practice)
{
   this.container = container;
   this.index = index;
   this.practice = practice;
   this.width = container.beam_width;
   this.height = container.beam_height;
   this.color = container.colors[index];
   this.dimensions = [0, 0];
   this.construct();
}
EVR.Level.Cluster.Beam.prototype = new EVR.Beam;
EVR.Level.Cluster.Beam.prototype.construct = function()
{
   var relative = this.container.size_relative;
   var color = this.color;
   var border = BEAM_BORDER;
   if (this.practice && this.index == this.container.passage)
   {
      color = null;
      border = BEAM_PASSAGE_BORDER;
   }
   EVR.Beam.call(
      this, this.container, color, this.width, this.height, null, null,
      relative);
   this.css.border = border;
   this.orient();
}
EVR.Level.Cluster.Beam.prototype.shape = function()
{
   EVR.Beam.prototype.shape.call(this);
   this.update_dimensions();
   if (!!!window.ActiveXObject)
   {
      var dimensions = this.get_dimensions();
      this.set_dimensions(dimensions[0] - 4, dimensions[1] - 4);
      this.update_dimensions();
   }
}
EVR.Level.Cluster.Beam.prototype.orient = function()
{
   var container = this.container;
   var margin = container.margin;
   var height = container.beam_height;
   var offset = height + margin;
   this.place(null, offset * this.index);
}
EVR.Level.Cluster.Beam.prototype.update_dimensions = function()
{
   this.dimensions = EVR.Graphic.prototype.get_dimensions.call(this);
}
EVR.Level.Cluster.Beam.prototype.get_dimensions = function()
{
   return this.dimensions;
}
EVR.Level.Cluster.Beam.prototype.toString = function()
{
   return "[object EVR.Level.Cluster.Beam]";
}
EVR.include("level/countdown/Glyph.js");
EVR.Level.Countdown = function(level, container, action)
{
   this.level = level;
   this.container = container;
   this.action = action;
   this.length = COUNTDOWN_LENGTH;
   this.delay = COUNTDOWN_DELAY;
   this.rate = 50;
   this.elapsed = new EVR.Time();
   this.build();
}
EVR.Level.Countdown.prototype.build = function()
{
   this.glyphs = [];
   for (var ii = this.length; ii > 0; ii--)
   {
      this.glyphs.push(new EVR.Level.Countdown.Glyph(this.container, ii));
   }
}
EVR.Level.Countdown.prototype.start = function()
{
   this.level.set_state(LEVEL_STATE_WAITING, false);
   this.loop(this.delay);
}
EVR.Level.Countdown.prototype.update = function()
{
   var difference = this.set_time();
   var seconds = this.elapsed.get_seconds();
   if (seconds < this.length)
   {
      if (typeof(this.seconds) == "undefined")
      {
	 this.glyphs[0].append();
      }
      else if (seconds > this.seconds)
      {
	 this.glyphs[seconds - 1].remove();
	 this.glyphs[seconds].append();
      }
      else
      {
	 this.glyphs[seconds].grow(difference / 1000);
      }
      this.seconds = seconds;
      this.loop(this.rate);
   }
   else
   {
      this.glyphs[seconds - 1].remove();
      this.action();
   }
}
EVR.Level.Countdown.prototype.set_time = function()
{
   var difference = 0;
   var time = +new Date;
   if (this.time)
   {
      difference = time - this.time;
      this.elapsed.add(difference);
   }
   this.time = time;
   return difference;
}
EVR.Level.Countdown.prototype.loop = function(delay)
{
   var current = this;
   window.setTimeout(
      function()
      {
	 current.update();
      }, delay);
}
EVR.Level.Countdown.prototype.draw = function()
{
   var glyph, glyphs = this.glyphs;
   for (var ii = 0; ii < this.length; ii++)
   {
      glyph = glyphs[ii];
      glyph.attached && glyph.draw();
   }
}
EVR.Level.Countdown.prototype.toString = function()
{
   return "[EVR.Level.Countdown]";
}
3.215.182.36
3.215.182.36
3.215.182.36
 
June 29, 2013

A few weeks ago, for Fishing Jam, I made a fishing simulation from what was originally designed to be a time attack arcade game. In the program, Dark Stew, the player controls Aphids, an anthropod who fishes for aquatic creatures living in nine pools of black water.



Fishing means waiting by the pool with the line in. The longer you wait before pulling the line out, the more likely a creature will appear. Aside from walking, it's the only interaction in the game. The creatures are drawings of things you maybe could find underwater in a dream.

The background music is a mix of clips from licensed to share songs on the Free Music Archive. Particularly, Seed64 is an album I used a lot of songs from. The full list of music credits is in the game's README file.

I'm still planning to use the original design in a future version. There would be a reaction-based mini game for catching fish, and the goal would be to catch as many fish as possible within the time limit. I also want to add details and obstacles to the background, which is now a little boring, being a plain, tiled, white floor.

If you want to look at all the drawings or hear the music in the context of the program, there are Windows and source versions available. The source should work on any system with Python and Pygame. If it doesn't, bug reports are much appreciated. Comments are also welcome :)

Dark Stew: Windows, Pygame Source

I wrote in my last post that I would be working on an old prototype about searching a cloud for organisms for Fishing Jam. I decided to wait a while before developing that game, tentatively titled Xenographic Barrier. Its main interactive element is a first-person scope/flashlight, so I'd like to make a Wii version of it.

I'm about to start working on a complete version of Ball & Cup. If I make anything interesting for it, I'll post something. There are a lot of other things I want to write about, like game analyses, my new GP2X and arcades in Korea, and there's still music to release. Lots of fun stuff coming!