Thursday, April 9, 2009

Branding

Branding a product is almost an art form. It's a subtle balance of form function and profit. Easy to balance 2 of the 3. All 3 is hard so we follow rules. I find the solution to my big problems is the balance of these simple elements. Branding is the way products stand out from the crowd. Making it and selling it are two very different problems. Not to say that these are not just good common since solutions to grand problems.
  • Simple is best(think Nike swoosh)
  • Up front sales pitch(Ease of use, amazons one click shopping)
  • Brand Uniformity(same colors, logos, etc)
Check out my website for a simple example of a Branded site.
www.IanMott.com

Saturday, April 4, 2009

Using Array's to Exclude Tower Placement in AS3

This is a problem I've spent way to much time on. As most things that take a long time to solve the solution is rather simple. This example is using a code base that draws a grid of some fixed size and has a path following the grid row and columns. There is a fixed path for each level in the game stored in a case statement that fills an array with the path for a given level. Path points are stored as there grid positions.

The simple version of this code is that we make an array and store all the "Occupied" positions. Once we have that this function checks each value of our Array. During this check the function compares the mouse x,y position to the Array's x,y positions.
The only time this function sets our Boolean value to true is when both the mouse x,y are equal to one of the Array's x,y positions.

/*
*Declared in side (main.as)
*public var OccupiedValue :Boolean = false;
*public var Occupied:Array = new Array;
*Occupied = (Path:Array);
*Declared in side (tower.as)
*var game:(Main.as);
*Occupied.push((new tower x,y));
*Original author: Ian Mott @ www.IanMott.com -Please leave comment if you use this code. *Thank you
*/
public function checkOccupied():void
{
//Result of this check Boolean value
game.OccupiedValue = false;
//Position of the mouse
var x1 :int = this.parent.mouseX;
var y1 :int = this.parent.mouseY;
//Format Position to grid size
x1 = Math.ceil(x1/this.game.grid_size);
y1 = Math.ceil(y1/this.game.grid_size);
//Check Occupied for same x, y
for (var i :int = 1; i < game.Occupied.length; i++)
{
var p_point :Array = game.Occupied[i];
var pX :int, pY :int;
pX = p_point[0];
pY = p_point[1];
if (pX == x1 && pY == y1)
{
game.OccupiedValue = true;
}

}