Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Timers;
- using System.Diagnostics;
- /*
- Notes:
- I made the dimensions of the gameboard 400 x 600 based of the ratio of the example on the website.
- */
- namespace Assign5_Tetris
- {
- public partial class Form1 : Form
- {
- //Global variables.
- public static int R = 20; // Row and column max. The example video was 10 x 20
- public static int C = 10;
- public static System.Timers.Timer timeIncriment;
- public static Stopwatch theTime;
- public static int RADIUS = 30;
- //public static Color CURRENT_COLOR;
- //Game global variables
- public bool STARTED = false;
- public bool LEVELUP_TIMEGOAL = false;
- public bool LEVELUP_LINEGOAL = false;
- public uint LINE_COUNTER = 0;
- // True = occupied coordinate.
- // False = unoccupied coordinate.
- public static bool [,] State;
- public Form1()
- {
- InitializeComponent();
- }
- /* The I-piece, which is four blocks in a straight line
- The L-piece, which is three blocks in a straight line, and a fourth "foot" block
- The T-piece, which is three blocks in a straight line, and a fourth block in the middle of the second row
- The Cube-piece, which is a 2x2 square of four blocks
- The Z-block, which is like the cube-piece, except the second row is offset to the right by one
- The Reverse-Z-block, which is like the cube-piece, except the second row is offset to the left by one */
- public class I_piece
- {
- }
- public class L_piece
- {
- }
- public class T_piece
- {
- }
- public class Cube_piece
- {
- }
- public class Z_piece
- {
- }
- public class reverseZ_Block
- {
- }
- public class Level
- {
- private uint speed = 1000; //1000 milliseconds
- private uint currentLevel;
- public uint CurrentLevel { get; set; } = 1; //This short hand removed an error.
- public uint Speed
- {
- set { speed = value; }
- get { return speed; }
- }
- public void levelUp()
- {
- /* Working name: level.levelUp();
- * Purpose: 1. Increase level
- * 2. decrease speed of game clock by 50 milliseconds
- 3(possibly). Points multiplier.*/
- CurrentLevel++;
- uint decrement_amount = 50; //50 milliseconds
- Speed -= decrement_amount;
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- State = new Nullable<bool>[R, C];
- //Set the level
- Level currentLevel = new Level();
- uint speed = currentLevel.Speed;
- //Set the timer
- theTime = new Stopwatch();
- timeIncriment = new System.Timers.Timer(speed);
- timeIncriment.Elapsed += IncrementTime;
- timeIncriment.AutoReset = true;
- }
- public void IncrementTime(object sender, ElapsedEventArgs e)
- {
- DisplayClock.Text = String.Format("{0:#0}:{1:00}", theTime.Elapsed.Minutes, theTime.Elapsed.Seconds);
- }
- private void GameBoard_Paint_1(object sender, PaintEventArgs e)
- {
- using (Pen MyPen = new Pen(Color.BurlyWood))
- {
- for (int i = 1; i < C; i++)
- {
- //
- // Why times i?
- e.Graphics.DrawLine(MyPen, (GameBoard.Width * i) / C, 0, (GameBoard.Width * i) / C, GameBoard.Height);
- }
- for (int i = 1; i < R; i++)
- {
- e.Graphics.DrawLine(MyPen, 0, (GameBoard.Height * i) / R, GameBoard.Width, (GameBoard.Height * i) / R);
- }
- }
- }
- private void startButton_Click(object sender, EventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement