EVR.include("level/scoreboard/meter/Segment.js");
EVR.Level.Scoreboard.Meter = function(scoreboard)
{
   EVR.Graphic.call(this, scoreboard, null, null, ALIGN_CENTER);
   this.scoreboard = scoreboard;
   this.segments = [];
   this.count = SCOREBOARD_METER_SEGMENTS;
   this.bounds = [SCOREBOARD_METER_MIN_SPEED, SCOREBOARD_METER_MAX_SPEED];
//    this.set_proportions(SCOREBOARD_METER_WIDTH, 1);
   this.set_proportions(1, 1);
   this.append();
   this.addSegments();
}
EVR.Level.Scoreboard.Meter.prototype = new EVR.Graphic;
EVR.Level.Scoreboard.Meter.prototype.addSegments = function()
{
   var count = this.count;
   var segments = [];
   for (var ii = 0; ii < count; ii++)
   {
      segments.push(new EVR.Level.Scoreboard.Meter.Segment(this, ii, count));
   }
   this.segments = segments;
   this.arrange();
}
EVR.Level.Scoreboard.Meter.prototype.arrange = function()
{
   var segments = this.segments;
   var offset = 0;
   for (var ii = 1; ii < segments.length; ii++)
   {
      offset += segments[ii - 1].get_dimensions()[1];
      segments[ii].set_coordinates([0, offset]);
   }
}
EVR.Level.Scoreboard.Meter.prototype.update = function(speed)
{
   var min = this.bounds[0];
   var max = this.bounds[1];
   var difference = max - min;
   var level = Math.round(this.count * ((speed - min) / difference));
   var segment, segments = this.segments;
   var offset = 0;
   for (var ii = segments.length - 1; ii >= 0; ii--)
   {
      segment = segments[ii];
      if (offset < level)
      {
	 if (!segment.isActive())
	 {
	    segment.activate();
	 }
      }
      else
      {
	 if (segment.isActive())
	 {
	    segment.deactivate();
	 }
      }
      offset++;
   }
   return level / this.count;
}
EVR.Level.Scoreboard.Meter.prototype.draw = function()
{
   EVR.Graphic.prototype.draw.call(this);
   var segments = this.segments;
   for (var ii = 0; ii < segments.length; ii++)
   {
      segments[ii].draw();
   }
   this.arrange();
}      
EVR.Level.Scoreboard.Meter.prototype.toString = function()
{
   return "[object EVR.Level.Scoreboard.Meter]";
}
EVR.Level.Scoreboard.Meter.Segment = function(meter, index, count)
{
   EVR.Graphic.call(this, meter);
   this.meter = meter;
   this.index = index;
   this.count = count;
   this.active = false;
   this.setAttributes();
   this.append();
}
EVR.Level.Scoreboard.Meter.Segment.prototype = new EVR.Graphic;
EVR.Level.Scoreboard.Meter.Segment.prototype.setAttributes = function()
{
   var height = 1.0 / this.count;
   var y = this.index * height;
   this.set_proportions(1, height);
   this.deactivate();
   this.set_color();
}
EVR.Level.Scoreboard.Meter.Segment.prototype.deactivate = function()
{
   this.css.visibility = "hidden";
//    this.css.display = "none";
//    this.set_opacity(SCOREBOARD_METER_INACTIVE_OPACITY);
   this.active = false;
}
EVR.Level.Scoreboard.Meter.Segment.prototype.set_color = function()
{
   var color = this.meter.scoreboard.buildYellow(this.index, this.count);
   this.setBorder();
   EVR.Graphic.prototype.set_color.call(this, color.get_string());
}
EVR.Level.Scoreboard.Meter.Segment.prototype.setBorder = function(red)
{
   var offset = SCOREBOARD_METER_BORDER_COLOR_OFFSET;
   var color = this.meter.scoreboard.buildYellow(
      this.index, this.count, offset);
   var css = this.css;
   css.borderWidth = 0;
   css.borderLeftWidth = SCOREBOARD_METER_HORIZONTAL_BORDER_WIDTH;
   css.borderRightWidth = SCOREBOARD_METER_HORIZONTAL_BORDER_WIDTH;
   if (this.index == this.count - 1)
   {
      css.borderBottomWidth = SCOREBOARD_METER_BOTTOM_BORDER_WIDTH;
   }
   css.borderColor = color.get_string();
   css.borderStyle = "solid";
}
EVR.Level.Scoreboard.Meter.Segment.prototype.activate = function()
{
   this.css.visibility = "";
//    this.css.display = "";
//    this.set_opacity(1);
   this.active = true;
}
EVR.Level.Scoreboard.Meter.Segment.prototype.isActive = function()
{
   return this.active;
}
EVR.Level.Scoreboard.Meter.Segment.prototype.toString = function()
{
   return "[object EVR.Level.Scoreboard.Meter.Segment]";

}
EVR.include("level/streak/Glyph.js");
EVR.Level.Streak = function(level)
{
   this.level = level;
   this.container = level.container;
   this.glyphs = [];
   this.streak = 0;
}
EVR.Level.Streak.prototype.increase = function()
{
   var streak = ++this.streak;
//    if (!this.level.practice)
//    {
//       var probability = STREAK_CHEER_PROBABILITY;
//       if (Math.random() <= probability)
//       {
// 	 this.glyphs.push(new EVR.Level.Streak.Glyph(this));
//       }
//    }
}
EVR.Level.Streak.prototype.reset = function()
{
   this.streak = 0;
   this.apply_to_glyphs("remove");
   this.glyphs = [];
}
EVR.Level.Streak.prototype.apply_to_glyphs = function(method)
{
   var glyphs = this.glyphs;
   for (var ii = 0; ii < glyphs.length; ii++)
   {
      glyphs[ii][method]();
   }
}
EVR.Level.Streak.prototype.draw = function()
{
   this.apply_to_glyphs("draw");
}
EVR.Level.Streak.prototype.clear = function()
{
   this.apply_to_glyphs("remove");
}
EVR.Level.Streak.prototype.valueOf = function()
{
   return this.streak;
}
EVR.Level.Streak.prototype.toString = function()
{
   return this.streak;
}
EVR.Level.Streak.Glyph = function(streak, index, count)
{
   EVR.Graphic.call(this, streak.container, null, null, ALIGN_BOTTOM_LEFT);
   this.streak = streak;
   this.set_attributes();
   this.append();
}
EVR.Level.Streak.Glyph.prototype = new EVR.Graphic;
EVR.Level.Streak.Glyph.prototype.set_attributes = function()
{
   this.set_proportions(STREAK_GLYPH_WIDTH, STREAK_GLYPH_HEIGHT);
   this.set_z(STREAK_Z_INDEX);
   this.set_opacity(STREAK_OPACITY);
   this.css.fontWeight = STREAK_FONT_WEIGHT;
   this.set_text();
   this.initialize_position();
}
EVR.Level.Streak.Glyph.prototype.set_text = function()
{
   this.text = this.determine_text();
   this.set_color_index();
   var font = STREAK_FONT_FAMILY;
   var color = STREAK_COLORS[this.color_index];
   var size = STREAK_FONT_SIZE;
   this.set_shadow(font, size);
   var cheer = new EVR.Graphic(this, null, null, ALIGN_TOP, this.container);
   cheer.set_proportions(STREAK_GLYPH_WIDTH, 0);
   cheer.set_text(this.text, font, color, size);
   cheer.append();
   this.cheer = cheer;
}
EVR.Level.Streak.Glyph.prototype.set_color_index = function()
{
   this.color_index = Math.get_random_int(0, STREAK_COLORS.length - 1);
}
EVR.Level.Streak.Glyph.prototype.determine_text = function()
{
   var cheers = STREAK_CHEERS;
   var streak = this.streak.streak;
   var range = Math.get_random_number(0, streak / STREAK_CHEER_GRADIENT);
   (range >= 1) && (range = .999);
   var index = Math.floor(cheers.length * range);
   return cheers[index];
}
EVR.Level.Streak.Glyph.prototype.set_shadow = function(font, size)
{
   var shadow = new EVR.Graphic(this, null, null, ALIGN_TOP, this.container);
   var color = STREAK_SHADOWS[this.color_index];
   shadow.set_proportions(STREAK_GLYPH_WIDTH, 0);
   shadow.set_text(this.text, font, color, size);
   shadow.append();
   this.shadow = shadow;
   this.place_shadow();
}
EVR.Level.Streak.Glyph.prototype.place_shadow = function()
{
   var shadow = this.shadow;
   var position = shadow.get_coordinates();
   var offset = STREAK_SHADOW_OFFSET;
   var coordinates = [position[0] + offset[0], position[1] + offset[1]];
   shadow.set_coordinates(coordinates);
}
EVR.Level.Streak.Glyph.prototype.initialize_position = function()
{
   var x = Math.random();
   var y = -Math.get_random_number(STREAK_MIN_Y, STREAK_MAX_Y);
   this.place(x, y);
}
EVR.Level.Streak.Glyph.prototype.draw = function()
{
   EVR.Graphic.prototype.draw.call(this);
   if (!!this.shadow && !!this.cheer)
   {
      this.shadow.draw();
      this.place_shadow();
      this.cheer.draw();
   }
}
EVR.Level.Streak.Glyph.prototype.toString = function()
{
   return "[object EVR.Level.Streak.Glyph]";
}
54.224.168.206
54.224.168.206
54.224.168.206
 
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 ↞