Advertisement
LogicalTrue

Tetris

Feb 18th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Controls;
  7. using System.Windows.Shapes;
  8. using System.Windows.Media;
  9.  
  10. namespace Tetris
  11. {
  12.  
  13.  
  14.  
  15.     class Cuadrado
  16.     {
  17.  
  18.         public SolidColorBrush C = new SolidColorBrush();
  19.         public Rectangle _P = new Rectangle();
  20.         public int X,
  21.                    Y,
  22.                    YDIR,
  23.                    XDIR = 5;
  24.         const int TAM = 10;
  25.  
  26.  
  27.         public Cuadrado(Canvas c, int X, int Y)
  28.         {
  29.             _P.Width = TAM;
  30.             _P.Height = TAM;
  31.             this.X = X;
  32.             this.Y = Y;
  33.             C.Color = Color.FromRgb(255, 0, 0);
  34.             _P.Fill = C;
  35.  
  36.             Canvas.SetLeft(_P, X);
  37.             Canvas.SetTop(_P, Y );
  38.          
  39.  
  40.             c.Children.Add(_P);
  41.         }
  42.  
  43.       public void Gravity()
  44.         {
  45.             Y += YDIR;
  46.             Canvas.SetTop(_P, Y);
  47.             YDIR += 1;
  48.         }
  49.  
  50.        public void MoveL()
  51.         {
  52.             X -= XDIR;
  53.             Canvas.SetLeft(_P, X);
  54.         }
  55.  
  56.        
  57.        public void MoveR()
  58.         {
  59.             X += XDIR;
  60.             Canvas.SetLeft(_P, X);
  61.         }
  62.  
  63.  
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement