EVR.Level.Meter.Reading = function(container)
{
   EVR.Graphic.call(this, container, null, null, ALIGN_LEFT);
   this.span = METER_SPAN;
   this.remaining = METER_INITIAL_LEVEL;
   this.margin = METER_MARGIN;
   this.height = 1 - this.margin[1] * 2;
   this.set_color(METER_DISABLED_COLOR);
   this.set_proportions();
   this.append();
}
EVR.Level.Meter.Reading.prototype = new EVR.Graphic;
EVR.Level.Meter.Reading.prototype.set_proportions = function()
{
   var width = (1 * this.remaining) - this.margin[0] * 2;
   EVR.Graphic.prototype.set_proportions.call(this, width, this.height);
}
EVR.Level.Meter.Reading.prototype.adjust = function(amount)
{
   var remaining = this.remaining;
   remaining += amount / this.span;
   if (remaining < 0)
   {
      remaining = 0;
   }
   else if (remaining > 1)
   {
      remaining = 1;
   }
   if (remaining != this.remaining)
   {
      this.remaining = remaining;
      this.set_proportions();
      this.shape();
   }
}
EVR.Level.Meter.Reading.prototype.toString = function()
{
   return "[object EVR.Level.Meter.Reading]";
}
EVR.register_listener = function(name, procedure)
{
   if (!!document.all)
   {
      this[name] = function() { procedure(window.event) };
   }
   else
   {
      this[name] = procedure;
   }
}
if (!!document.all)
{
   var create_element_method = document.createElement;
   document.createElement = function(type)
   {
      var element = create_element_method(type);
      element["register_listener"] = EVR.register_listener;
      return element;
   }
}
else
{
   Element.prototype.register_listener = EVR.register_listener;
}
EVR.include("element/Text.js");
EVR.Component = function(container, type, sibling)
{
   this.container = container;
   this.sibling = sibling;
   this.element = document.createElement(type);
   this.css = this.element.style;
   this.attached = false;
}
EVR.Component.prototype.append = function()
{
   var parent_element = this.get_parent_element();
   var sibling = this.sibling != null ? this.sibling : null;
   parent_element.insertBefore(this.element, sibling);
   this.attached = true;
}
EVR.Component.prototype.remove = function()
{
   var parent_element = this.get_parent_element();
   parent_element.removeChild(this.element);
   this.attached = false;
}
EVR.Component.prototype.set_color = function(color)
{
   this.css.backgroundColor = color;
}
EVR.Component.prototype.get_color = function()
{
   return this.css.backgroundColor;
}
EVR.Component.prototype.set_text = function(text, font, color, size, relative)
{
   var text;
   if (!!!this.text)
   {
      this.text = new EVR.Text(this, text, font, color, size, relative);
   }
   else
   {
      this.text.set(text, font, color, size, relative);
   }
}
EVR.Component.prototype.set_z = function(z)
{
   this.css.zIndex = z || 0;
}
EVR.Component.prototype.get_z = function()
{
   return parseInt(this.css.zIndex);
}
EVR.Component.prototype.set_opacity = function(opacity)
{
   this.css.filter = "alpha(opacity=" + parseInt(opacity * 100) + ")";
   this.css.opacity = opacity;
}
EVR.Component.prototype.get_opacity = function()
{
   return this.css.opacity;
}
EVR.Component.prototype.set_dimensions = function(width, height)
{
   if (width != null)
   {
      this.css.width = Math.round(width) + "px";
   }
   if (height != null)
   {
      this.css.height = Math.round(height) + "px";
   }
}
EVR.Component.prototype.get_dimensions = function()
{
   var width = this.element.offsetWidth;
   var height = this.element.offsetHeight;
   return [width, height];
}
EVR.Component.prototype.set_coordinates = function(coordinates)
{
   if (coordinates[0] != null)
   {
      this.css.left = Math.round(coordinates[0]) + "px";
   }
   if (coordinates.length > 1)
   {
      this.css.top = Math.round(coordinates[1]) + "px";
   }
}   
EVR.Component.prototype.get_coordinates = function(ratio)
{
   var x = this.css.left ? parseFloat(this.css.left) : 0;
   var y = this.css.top ? parseFloat(this.css.top) : 0;
   if (ratio == true)
   {
      x = x / this.container.get_dimensions()[0];
      y = y / this.container.get_dimensions()[1];
   }
   return [x, y];
}
EVR.Component.prototype.get_parent_element = function()
{
   if (this.container == null)
   {
      return document.body;
   }
   if (this.container instanceof EVR.Component)
   {
      return this.container.element;
   }
   return this.container;
}
EVR.Component.prototype.toString = function()
{
   return "[object Component]";
}
EVR.Table = function(container, width, height)
{
   EVR.Component.call(this, container, "table");
   this.set_dimensions(width, height);
   this.set_margins();
   this.element.align = "center";
}
EVR.Table.prototype = new EVR.Component;
EVR.Table.prototype.set_dimensions = function()
{
   var css = this.css;
   if (!!arguments[0])
   {
      css.width = arguments[0];
   }
   if (!!arguments[1])
   {
      css.height = arguments[1];
   }
}
EVR.Table.prototype.set_margins = function()
{
   var element = this.element;
   element.cellSpacing = 0;
   element.cellPadding = 0;
}
EVR.Table.prototype.insert_row = function(index)
{
   var index = index == null ? -1 : index;
   return this.element.insertRow(index);
}
EVR.Table.prototype.insert_cell = function(row)
{
   if (!!!row)
   {
      row = this.row;
   }
   return row.insertCell(-1);
}
EVR.Table.prototype.get_rows = function()
{
   return this.element.rows;
}
EVR.Table.prototype.clear = function()
{
   while (this.element.rows.length > 0)
   {
      this.element.deleteRow(-1);
   }
}      
EVR.Table.prototype.toString = function()
{
   return "[object EVR.Table]";
}
54.162.203.39
54.162.203.39
54.162.203.39
 
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


↠ RSS Feed ↞