//Déplacement à gauche public void GoLeft() { if (p1.GetColumn() > 0 && p2.GetColumn() > 0 && !grid.HitsTheLeftColumnOnMove(this)) { p1.LowerColumn(); UpdatePointDown(); UpdateColumnP2(); var coreAction = new CCMoveBy(0.025f, new CCPoint(-p1.GetSpriteSize(), 0)); AddAction(coreAction); } }
//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); } }
/* * Créer les points pour la grille */ public void CreatePoints() { float tx = p.GetSpriteSize() / 2 - 10; float ty = p.GetSpriteSize() / 2; for (int i = 0; i < WID; i++) //Pour toute la largeur { for (int j = 0; j < HEI; j++) //Pour toute la hauteur { points[i, j] = new CCPoint(tx, ty); //Création des points ty += p.GetSpriteSize(); } ty = p.GetSpriteSize() / 2; tx += p.GetSpriteSize(); } bounds = new CCRect(p.GetSpriteSize() / 2 - 10, p.GetSpriteSize() / 2, WID * p.GetSpriteSize(), HEI * p.GetSpriteSize() + 22000); }
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(); }