EVR.Level.Prompt = function(level)
{
   this.level = level;
   this.initialize();
   this.append();
}
EVR.Level.Prompt.prototype = new EVR.Prompt;
EVR.Level.Prompt.prototype.initialize = function()
{
   var container = this.level.container;
   var text = LEVEL_START_PROMPT_TEXT;
   var color = LEVEL_PROMPT_COLOR;
   var size = LEVEL_PROMPT_SIZE;
   var background = LEVEL_PROMPT_BACKGROUND;
   var depth = LEVEL_PROMPT_DEPTH;
   var offset = [null, ROAD_OFFSET];
   EVR.Prompt.call(
      this, container, text, color, size, background, depth, null, offset);
}
EVR.Level.Prompt.prototype.set_finish_text = function()
{
   var level = this.level;
   var text = LEVEL_FINISHED_PROMPT_TEXT;
   if (level.id == LEVEL_LIMIT && level.is_clear())
   {
      text += ", " + LEVEL_VIEW_ENDING_PROMPT_TEXT;
   }
   else if (level.next_level_is_available())
   {
      text = LEVEL_CLEAR_PROMPT_TEXT;
   }
   this.set_text(text);
}
EVR.Level.Prompt.prototype.toggle = function()
{
   var attached = this.attached;
   attached && this.remove();
   !attached && this.append();
}
EVR.Level.Prompt.prototype.toString = function()
{
   return "[object EVR.Level.Prompt]";
}
EVR.include("level/cheers/marquee/Marquee.js");
EVR.Level.Cheers = function(level)
{
   EVR.Graphic.call(this, level.container, null, null, ALIGN_TOP);
   EVR.Animation.call(this, CHEERS_ANIMATION_RATE);
   this.level = level;
   this.cheer_texts = CHEERS_TEXTS;
   this.boost_bounds = [CHEERS_MIN_BOOST_LENGTH, CHEERS_MAX_BOOST_LENGTH];
   this.drag_threshold = CHEERS_DRAG_THRESHOLD;
   this.step = CHEERS_SCROLL_STEP;
   this.delay = CHEERS_SCROLL_DELAY;
   this.last_time = null;
   this.boost_length = null;
   this.drag_length = null;
   this.scrolling = false;
   this.setAttributes();
   this.append();
   this.background = new EVR.Level.Cheers.Marquee(
      this, CHEERS_SHADOW_COLOR_OFFSET, CHEERS_SHADOW_OFFSET,
      CHEERS_SHADOW_OPACITY);
   this.foreground = new EVR.Level.Cheers.Marquee(
      this, null, null, CHEERS_FOREGROUND_Z_INDEX, CHEERS_FOREGROUND_OPACITY);
}
EVR.Level.Cheers.prototype = new EVR.Graphic;
EVR.inherit(EVR.Level.Cheers, EVR.Animation);
EVR.Level.Cheers.prototype.setAttributes = function()
{
   this.set_proportions(CHEERS_MARQUEE_WIDTH, CHEERS_MARQUEE_HEIGHT);
   this.place(0, CHEERS_MARQUEE_OFFSET);
   this.css.overflow = "hidden";
}
EVR.Level.Cheers.prototype.scroll = function()
{
   var marquee_length = this.calculateScrollLength();
   var width = this.get_dimensions()[0];
   var cutoff = -marquee_length + width * (1 - CHEERS_SCROLL_PADDING);
   this.scrolling = true;
   this.play(null, this.delay, cutoff);
}
EVR.Level.Cheers.prototype.calculateScrollLength = function()
{
   var length = 0;
   var glyphs = this.foreground.glyphs;
   for (var ii = 0; ii < glyphs.length; ii++)
   {
      length += glyphs[ii].offsetWidth;
   }
   return length;
}
EVR.Level.Cheers.prototype.sequence = function(cutoff)
{
   var step = this.step;
   var foreground = this.foreground;
   var background = this.background;
   var foreground_x = foreground.get_coordinates()[0] - step;
   var background_x = background.get_coordinates()[0] - step;
   if (background_x < cutoff)
   {
      foreground_x = 0;
      background_x = 0;
      this.stop();
      this.play(null, this.delay, cutoff);
   }
   foreground.set_coordinates([foreground_x]);
   background.set_coordinates([background_x]);
}
EVR.Level.Cheers.prototype.update = function(sprinting, speed)
{
   if (this.level.practice)
   {
      return;
   }
   var time = this.level.clock.time.get();
   var interval = time - this.last_time;
   this.last_time = time;
   this.updateBoostTimer(sprinting, speed, interval);
   this.updateDragTimer(sprinting, speed, interval);
}
EVR.Level.Cheers.prototype.updateBoostTimer =
   function(sprinting, speed, interval)
{
   if (sprinting && speed == PATH_SPRINT_SPEED)
   {
      this.boost_length += interval;
      if (this.boost_length >= this.boost_bounds[1])
      {
	 this.addCheer();
	 this.boost_length = 0;
      }
   }
   else if (this.boost_length != 0)
   {
      this.addCheer();
      this.boost_length = 0;
   }
}
EVR.Level.Cheers.prototype.addCheer = function()
{
   var length = this.boost_length;
   var bounds = this.boost_bounds;
   if (length >= bounds[0])
   {
      this.drag_length = 0;
      if (length > bounds[1])
      {
	 this.boost_length = bounds[1];
      }
      var cheer = this.determineCheerText();
      this.foreground.addCheer(cheer);
      this.background.addCheer(cheer);
   }
}
EVR.Level.Cheers.prototype.determineCheerText = function()
{
   var bounds = this.boost_bounds;
   var range = bounds[1] - bounds[0];
   var offset = this.boost_length - bounds[0];
   var texts = this.cheer_texts;
   var index = Math.round((texts.length - 1) * (offset / range));
   return texts[index];
}
EVR.Level.Cheers.prototype.updateDragTimer = 
   function(sprinting, speed, interval)
{
   if (speed < PATH_INITIAL_SPEED || (speed < PATH_SPRINT_SPEED && sprinting))
   {
      this.drag_length += interval;
      if (this.drag_length >= this.drag_threshold)
      {
	 this.addJeer();
	 this.drag_length = 0;
      }
   }
}
EVR.Level.Cheers.prototype.addJeer = function()
{
   this.foreground.addJeer();
   this.background.addJeer();
}
EVR.Level.Cheers.prototype.draw = function()
{
   EVR.Graphic.prototype.draw.call(this);
   if (!!this.foreground)
   {
      this.foreground.draw();
      this.background.draw();
   }
   if (this.scrolling)
   {
      this.stop();
      this.scroll();
   }
}
EVR.Level.Cheers.prototype.remove = function()
{
   EVR.Graphic.prototype.remove.call(this);
   if (!!this.foreground)
   {
      this.foreground.remove();
      this.background.remove();
   }
   if (this.scrolling)
   {
      this.stop();
      this.scrolling = false;
   }
}
EVR.Level.Cheers.prototype.toString = function()
{
   return "[object EVR.Level.Cheers]";
}
54.80.81.223
54.80.81.223
54.80.81.223
 
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!


↠ RSS Feed ↞