Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Controls;
- using System.Windows.Shapes;
- using System.Windows.Media;
- namespace Tetris
- {
- class Cuadrado
- {
- public SolidColorBrush C = new SolidColorBrush();
- public Rectangle _P = new Rectangle();
- public int X,
- Y,
- YDIR,
- XDIR = 5;
- const int TAM = 10;
- public Cuadrado(Canvas c, int X, int Y)
- {
- _P.Width = TAM;
- _P.Height = TAM;
- this.X = X;
- this.Y = Y;
- C.Color = Color.FromRgb(255, 0, 0);
- _P.Fill = C;
- Canvas.SetLeft(_P, X);
- Canvas.SetTop(_P, Y );
- c.Children.Add(_P);
- }
- public void Gravity()
- {
- Y += YDIR;
- Canvas.SetTop(_P, Y);
- YDIR += 1;
- }
- public void MoveL()
- {
- X -= XDIR;
- Canvas.SetLeft(_P, X);
- }
- public void MoveR()
- {
- X += XDIR;
- Canvas.SetLeft(_P, X);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement