Skip to content

Instantly share code, notes, and snippets.

@fish2000
Created January 17, 2012 19:36
Show Gist options
  • Select an option

  • Save fish2000/1628376 to your computer and use it in GitHub Desktop.

Select an option

Save fish2000/1628376 to your computer and use it in GitHub Desktop.
Ten-year-old ActionScript 1 code for manipulating a grid of hexagons
/// init
/// build grid
g = new Array();
g[0] = new Array();
g[1] = new Array();
/// do grids
for (i = 0; i < _root.g0xgridmax; i++) {
this.g[0][i] = new Array();
this.g[1][i] = new Array();
for (j = 0; j < _root.g0ygridmax; j++) {
/// grid0
this.g[0][i][j] = "g0r"+i+"c"+j;
this.attachMovie("hexclip", String(this.g[0][i][j]), _root.depth++);
var tx = ((_root.g0xspace * i) + _root.g0xoffset);
var ty = ((_root.g0yspace * j) + _root.g0yoffset);
//this[g[0][i][j]]._x = _root.cisox(tx, ty, _root.gspace);
//this[g[0][i][j]]._y = _root.cisoy(tx, ty, _root.gspace);
this[g[0][i][j]]._x = tx;
this[g[0][i][j]]._y = ty;
this[g[0][i][j]]._xscale = _root.gxscale;
this[g[0][i][j]]._yscale = _root.gyscale;
//this[g[0][i][j]]._rotation = _root.grotation;
var cc = new Object();
cc.ra = 100;
cc.rb = 200;
cc.ga = 100;
cc.gb = 20;
cc.ba = 100;
cc.bb = 10;
cc.aa = 100;
cc.ab = 255;
(new Color(this[g[0][i][j]])).setTransform(cc);
/// grid1
this.g[1][i][j] = "g1r"+i+"c"+j;
this.attachMovie("hexclip", String(this.g[1][i][j]), _root.depth++);
var tx = ((_root.g1xspace * i) + _root.g1xoffset);
var ty = ((_root.g1yspace * j) + _root.g1yoffset);
//this[g[1][i][j]]._x = _root.cisox(tx, ty, _root.gspace);
//this[g[1][i][j]]._y = _root.cisoy(tx, ty, _root.gspace);
this[g[1][i][j]]._x = tx;
this[g[1][i][j]]._y = ty;
this[g[1][i][j]]._xscale = _root.gxscale;
this[g[1][i][j]]._yscale = _root.gyscale;
//this[g[1][i][j]]._rotation = _root.grotation;
var cc = new Object();
cc.ra = 100;
cc.rb = 200;
cc.ga = 100;
cc.gb = 20;
cc.ba = 100;
cc.bb = 10;
cc.aa = 100;
cc.ab = 255;
(new Color(this[g[1][i][j]])).setTransform(cc);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment