Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //C# Traffic Signal Simulation SRC
- //Coded By BrÜ
- //CompulsiveCoding.com
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Stoplight_Example_SRC_Code
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- public bool WayOne=false;
- public int I=0;
- private void timer1_Tick(object sender, EventArgs e)
- {
- I++;
- if (WayOne==false){
- pictureBox1.Location= new System.Drawing.Point(355,I);
- }
- else
- {
- pictureBox2.Location = new System.Drawing.Point(I, 246);
- }
- if (I == 525 && WayOne == true)
- {
- label1.ForeColor = Color.Yellow;
- label1.Text = "Slow Down!!";
- }
- if(I==735 && WayOne==true){
- WayOne=false;
- label2.ForeColor = Color.Green;
- label1.ForeColor = Color.Red;
- label2.Text = "Go!!";
- label1.Text="Stop!!";
- I=0;
- pictureBox2.Location = new System.Drawing.Point(0, 246);
- }
- if (I == 525 && WayOne == false)
- {
- label2.ForeColor = Color.Yellow;
- label2.Text = "Slow Down!!";
- }
- if(I==735 && WayOne==false){
- WayOne=true;
- label1.ForeColor = Color.Green;
- label2.ForeColor = Color.Red;
- label2.Text = "Stop!!";
- label1.Text = "Go!!";
- I=0;
- pictureBox1.Location = new System.Drawing.Point(355, 0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement