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;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Windows.Threading;
- namespace Tetris
- {
- /// <summary>
- /// Lógica de interacción para MainWindow.xaml
- /// </summary>
- public partial class MainWindow : Window
- {
- Cuadrado P1, P2, P3, P4,
- P5, P6, P7, P8,
- P9, P10, P11, P12,
- P13, P14, P15, P16;
- int[,] MatrizTetris;
- DispatcherTimer DP;
- public int X;
- public MainWindow()
- {
- InitializeComponent();
- DP = new DispatcherTimer();
- DP.Interval = new TimeSpan(0, 0, 0, 0, 100);
- DP.Tick += new EventHandler(DP_TICK);
- DP.IsEnabled = true;
- MatrizTetris = new int[100, 100];
- //Load Piece 1
- P1 = new Cuadrado(Canvas, 50, 50);
- P2 = new Cuadrado(Canvas, 50, 60); //50 60 se invierte las cord
- P3 = new Cuadrado(Canvas, 40, 60);
- P4 = new Cuadrado(Canvas, 40, 70);
- }
- public void DP_TICK(object sender, EventArgs e)
- {
- Prp_1.Content = P1.X;
- Prp_2.Content = P1.Y;
- Prp_3.Content = P2.X;
- Prp_4.Content = P2.Y;
- }
- private void Window_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.A)
- {
- P1.MoveL();
- P2.MoveL();
- P3.MoveL();
- P4.MoveL();
- }
- if (e.Key == Key.D)
- {
- P1.MoveR();
- P2.MoveR();
- P3.MoveR();
- P4.MoveR();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement