Game Development Reference
In-Depth Information
true);
// Create the sprite out of it
var sprite:Sprite = new Sprite();
sprite.graphics.beginBitmapFill(pd);
sprite.graphics.drawRect(0, 0, wide, high);
sprite.graphics.endFill();
sprite.x = 0;
sprite.y = 0;
// Apply Bevel filter
var filters:Array = sprite.filters;
filters.push(BEVEL);
sprite.filters = filters;
// Create the piece sprite
var p:PieceSprite = new PieceSprite(id, mask);
// Create the group
var group:Group = new Group(p);
ret.push(group);
p.setGroup(group);
//if ( j == (rows-1) && i < 2 )
addChild(p);
p.init(i, j, sprite);
sprite.x = (Math.random()*1000000)%280 + 110;
sprite.y = (Math.random()*1000000)%250 + 110;
}
}
// Assign the 'right' neighbors
// for each piece
PieceSprite.initNeighbors();
m_clean = false;
return ret;
}
Dragging of pieces
Dragging a sprite around the stage is quite straightforward. How about moving
around a bunch of sprites at the same time? In this implementation of the game, we
don't create a new sprite once two or more pieces are matched, but they are kept as
separate sprites. However, we need to move the whole bunch when any one piece
belonging to the group is moved by the player.
 
Search WWH ::




Custom Search