//Ajoute un Puyo à la grille public void AddElement(int x, int y, Puyo p1) { p1.SetPosition(points[x, y]); pTab[x, y] = p1; columns[x]++; AddChild(p1); }
//Met à jour la hitbox des colonnes public void UpdateColumnHitBoxes() { Puyo pu = new Puyo(); for (int i = 0; i < WID; i++) { columnHitBoxes[i] = new CCRect(points[i, 0].X, points[i, 0].Y, pu.GetSpriteSize(), GetPointDown(i).Y); } }
public Pair(Grid grid, int c1, int c2) : base() { p1 = new Puyo(c1); p2 = new Puyo(c2); this.grid = grid; AddChild(p1); AddChild(p2); p2.Position = new CCPoint(p1.AnchorPointInPoints.X, p1.AnchorPointInPoints.Y + p1.GetSpriteSize()); //On commence avec le Puyo p2 au-dessus p1.SetColumn(2); p2.SetColumn(2); //3e colonne placement = 1; //Puyo 2 au-dessus ContentSize = new CCSize(p1.ScaledContentSize.Width, p1.ScaledContentSize.Height * 2); UpdatePointDown(); }
public void CreateGridPuzzle(int[,] colorGrid) { WID = 6; HEI = 13; points = new CCPoint[WID, HEI]; CreatePoints(); pTab = new Puyo[WID, HEI]; for (int i = 0; i < WID; i++) { for (int j = 0; j < HEI; j++) { pTab[i, j] = null; } } columns = new int[WID]; columnHitBoxes = new CCRect[WID]; killList = new List <Puyo>(); chain = new List <Puyo>(); floatingPuyos = new List <Puyo>(); for (int i = 0; i < WID; i++) { columns[i] = 0; } for (int j = 0; j < HEI; j++) { for (int i = 0; i < WID; i++) { if (colorGrid[i, j] != 0) { p = new Puyo(colorGrid[i, j]); AddElement(i, j, p); } } } UpdateLinks(); UpdateColumnHitBoxes(); }
public Grid(int[,] colorGrid) : base() { p = new Puyo(); CreateGridPuzzle(colorGrid); }
/* * Constructeur */ public Grid() : base() { p = new Puyo(); CreateGrid(); }