2015年11月2日 星期一

拉霸卡住版

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;

namespace WindowsFormsApplication6
{
    public partial class Form1 : Form
    {
        int i,j,p1 = -70, p2 = 70, p3 = 210, max =280, min = -140,v1 = 35,v2=30,v3=30,x1=0,x2=300,x3=600,qq=0,pp,vv=0,gg=0,wp;
        int[,] ea = new int[3, 3] { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }};
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            qq++;
            pp = qq % 2;
            if (pp == 1)
            {
                timer1.Enabled = true;
               /* timer2.Enabled = true;
                timer3.Enabled = true;*/
            }
            else if(pp==0)
            {
                vv +=1;
                /*timer2.Enabled = false;
                timer3.Enabled = false;*/
            }
           
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (vv ==1)
            {
                gg++;
                wp = gg % 10;
                if (wp == 0) v1 -= 5;
               
            }
           
            if (min - p1<= ea[0,0] && ea[0,0] < max-p1) ea[0,0]+=v1;
            else ea[0,0] = min - p1;
            pictureBox1.Location = new Point(x1,p1+ea[0,0]);
            if (min - p2 <= ea[0,1] && ea[0,1] < max-p2) ea[0,1]+=v1;
            else ea[0,1] = min - p2;
            pictureBox2.Location = new Point(x1, p2+ea[0,1]);
            if (min - p3 <= ea[0,2] && ea[0,2] < max - p3) ea[0,2] += v1;
            else ea[0,2] = min - p3;
            pictureBox3.Location = new Point(x1, p3+ea[0,2]);
        }


        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void timer2_Tick(object sender, EventArgs e)
        {
           if (min - p1 <= ea[1,0] && ea[1,0] <= max - p1) ea[1,0] += v2;
            else ea[1,0] = min - p1;
            pictureBox4.Location = new Point(x2, p1 + ea[1,0]);
            if (min - p2 <= ea[1,1] && ea[1,1] <= max - p2) ea[1,1] += v2;
            else ea[1,1] = min - p2;
            pictureBox5.Location = new Point(x2, p2 + ea[1,1]);
            if (min - p3 <= ea[1,2] && ea[1,2] <= max - p3) ea[1,2] += v2;
            else ea[1,2] = min - p3;
            pictureBox6.Location = new Point(x2, p3 + ea[1,2]);
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {

        }

        private void timer3_Tick(object sender, EventArgs e)
        {
            if (min - p1 <= ea[2, 0] && ea[2, 0] <= max - p1) ea[2, 0] += v3;
            else ea[2, 0] = min - p1;
            pictureBox7.Location = new Point(x3, p1 + ea[2, 0]);
            if (min - p2 <= ea[2, 1] && ea[2, 1] <= max - p2) ea[2, 1] += v3;
            else ea[2, 1] = min - p2;
            pictureBox8.Location = new Point(x3, p2 + ea[2, 1]);
            if (min - p3 <= ea[2, 2] && ea[2, 2] <= max - p3) ea[2, 2] += v3;
            else ea[2, 2] = min - p3;
            pictureBox9.Location = new Point(x3, p3 + ea[2, 2]);
        }

     
    }
}

沒有留言:

張貼留言