EVR.Level.Road.Borders = function(container, level)
{
   this.container = container;
   this.background = level.background;
   this.height = ROAD_BORDER_WIDTH;
   this.build();
}
EVR.Level.Road.Borders.prototype.build = function()
{
   this.borders = [];
   this.borders.push(this.build_border(ALIGN_TOP, -this.height));
   this.borders.push(this.build_border(ALIGN_BOTTOM, this.height));
}
EVR.Level.Road.Borders.prototype.build_border = function(alignment, offset)
{
   var border = new EVR.Graphic(
      this.container, null, null, alignment, this.container.container);
   border.set_color(this.background);
   border.set_proportions(1, this.height);
   border.place(null, offset);
   border.append();
   return border;
}
EVR.Level.Road.Borders.prototype.draw = function()
{
   for (var ii = 0; ii < this.borders.length; ii++)
   {
      this.borders[ii].draw();
   }
}
EVR.Level.Road.Borders.prototype.get_dimensions = function(ratio)
{
   return this.borders[0].get_dimensions(ratio);
}
EVR.Level.Road.Borders.prototype.get_coordinates = function(ratio)
{
   return this.borders[0].get_coordinates(ratio);
}
EVR.Level.Road.Borders.prototype.toString = function()
{
   return "[object EVR.Level.Road.Borders]";
}
EVR.Level.Road.Racer.Ghost = function(container, level)
{
   EVR.Level.Road.Racer.call(this, container, level);
   this.initialize_avatar();
   this.set_step();
   this.update_dimensions();
   this.initialize_trail();
   this.lane = 0;
}
EVR.Level.Road.Racer.Ghost.prototype = new EVR.Level.Road.Racer;
EVR.Level.Road.Racer.Ghost.prototype.initialize_avatar = function()
{
   EVR.Level.Road.Racer.prototype.initialize_avatar.call(this);
   this.avatar.set_opacity(GHOST_OPACITY);
}
EVR.Level.Road.Racer.Ghost.prototype.initialize_trail = function()
{
   var trail = new EVR.Level.Road.Path.Trail(this.level);
   trail.load();
   this.index = 0;
   this.marker = trail[0];
   this.trail = trail;
}
EVR.Level.Road.Racer.Ghost.prototype.update =
   function(player_speed, rate, cluster)
{
   if (this.trail.trail.length > 0)
   {
      this.advance_marker();
      this.update_offset(player_speed, rate);
      if (cluster >= 0)
      {
	 this.update_map_indicator(cluster);
      }
      this.lane = this.marker.lane;
   }
   this.place();
}
EVR.Level.Road.Racer.Ghost.prototype.place = function()
{
   if (this.trail.trail.length > 0)
   {
      EVR.Level.Road.Racer.prototype.place.call(this);
   }
}
// fix offset during redraw
EVR.Level.Road.Racer.Ghost.prototype.advance_marker = function()
{
//    var time = this.level.clock.time.get();
//    var trail = this.trail.trail;
//    var index = this.index;
//    var limit = trail.length - 1;
//    var advanced = false;
//    while (index < limit && trail[index + 1].time < time)
//    {
//       advanced = true;
//       index++;
//    }
//    this.index = index;
//    this.marker = trail[index];
//    return advanced;
   var index = this.index + 1;
   var trail = this.trail.trail;
   if (index >= trail.length)
   {
      index--;
   }
   this.marker = trail[index];
   this.index = index;
}
EVR.Level.Road.Racer.Ghost.prototype.update_offset =
   function(player_speed, rate)
{
   var dimensions = this.container.get_dimensions();
   var ratio = dimensions[1] / dimensions[0];
   var difference = this.marker.speed - parseFloat(player_speed);
   this.offset += difference * ratio * rate;
}
EVR.Level.Road.Racer.Ghost.prototype.update_map_indicator =
   function(cluster_index)
{
   var road = this.container;
   var map = this.level.map;
   var racer_x = road.racer.get_coordinates()[0];
   var distance = racer_x - this.get_coordinates()[0];
   var direction = distance <= 0 ? 1 : -1;
   distance = Math.abs(distance);
   var items = road.path.items;
   var cluster = items[cluster_index];
   if (direction < 0)
   {
      var edge = cluster.get_coordinates()[0];
   }
   else
   {
      var edge = cluster.get_coordinates()[0] + cluster.get_dimensions()[0];
   }
   var difference = Math.abs(racer_x - edge);
   var remove = false;
   for (var ii = cluster_index; ii < items.length - 1 && ii > 0; ii += direction)
   {
      if (difference >= distance)
      {
	 break;
      }
      cluster = items[ii + direction];
      difference += cluster.get_dimensions()[0];
   }
   if (ii > 0 && ii < items.length - 1)
   {
      map.advance_ghost(ii - 1);
   }
}
EVR.Level.Road.Racer.Ghost.prototype.toString = function()
{
   return "[object EVR.Level.Road.Racer.Ghost]";
}
EVR.include("level/road/racer/player/Player.js");
EVR.include("level/road/racer/Ghost.js");
EVR.include("level/road/racer/flame/Flame.js");
EVR.include("level/road/racer/flash/Flash.js");
EVR.Level.Road.Racer = function(container, level)
{
   this.container = container;
   this.level = level;
   this.lane = 0;
}
EVR.Level.Road.Racer.prototype.initialize_avatar = function()
{
   var container = this.container;
   var avatar = new EVR.Emoticon(this.level.container);
   avatar.set_container(container);
   avatar.aligner.alignment = ALIGN_TOP_LEFT;
   avatar.set_proportions(1, container.beam_height);
   avatar.set_color();
   avatar.append();
   this.avatar = avatar;
   this.initialize_offset();
}
EVR.Level.Road.Racer.prototype.initialize_offset = function()
{
   var dimensions = this.avatar.container.get_dimensions();
   this.offset = dimensions[1] / dimensions[0] / PLAYER_OFFSET;
}
EVR.Level.Road.Racer.prototype.place = function()
{
   this.avatar.place(this.offset, this.step * this.lane);
}
EVR.Level.Road.Racer.prototype.set_step = function()
{
   var height = this.container.beam_height;
   var margin = this.container.margin;
   this.step = height + margin;
}
EVR.Level.Road.Racer.prototype.draw = function()
{
   this.place();
   this.avatar.draw();
   this.update_dimensions();
}
EVR.Level.Road.Racer.prototype.move = function(direction)
{
   var lane = this.lane + direction;
   var count = this.level.count_lanes();
   if (lane < 0)
   {
      this.lane = count - 1;
   }
   else if (lane >= count)
   {
      this.lane = 0;
   }
   else
   {
      this.lane = lane;
   }
   this.place();
}
EVR.Level.Road.Racer.prototype.update_dimensions = function()
{
   this.dimensions = this.avatar.get_dimensions();
}
EVR.Level.Road.Racer.prototype.get_dimensions = function(ratio)
{
   if (ratio == true)
   {
      return this.avatar.get_dimensions(true);
   }
   else
   {
      return this.dimensions;
   }
}
EVR.Level.Road.Racer.prototype.get_coordinates = function(ratio)
{
   return this.avatar.get_coordinates(ratio);
}
EVR.Level.Road.Racer.prototype.remove = function()
{
   this.avatar.remove();
}
EVR.Level.Road.Racer.prototype.toString = function()
{
   return "[object EVR.Level.Road.Racer]";
}
18.97.14.90
18.97.14.90
18.97.14.90
 
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