using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp1
public partial class Form1 : Form
private void pictureBox1_Click(object sender, EventArgs e)
private void timer1_Tick(object sender, EventArgs e)
Random rd = new Random();
enemy1.Location = new Point(x, 0);
enemy2.Location = new Point(x, 0);
enemy3.Location = new Point(x, 0);
enemy4.Location = new Point(x, 0);
coin1.Location = new Point(x, 0);
coin2.Location = new Point(x, 0);
coin3.Location = new Point(x, 0);
coin4.Location = new Point(x, 0);
coin5.Location = new Point(x, 0);
coin6.Location = new Point(x, 0);
if (car.Bounds.IntersectsWith(enemy1.Bounds))
if (car.Bounds.IntersectsWith(enemy2.Bounds))
if (car.Bounds.IntersectsWith(enemy3.Bounds))
if (pictureBox1.Top >= 600)
pictureBox1.Top += speed;
if (pictureBox2.Top >= 600)
pictureBox2.Top += speed;
if (pictureBox3.Top >= 600)
pictureBox3.Top += speed;
if (pictureBox4.Top >= 600)
pictureBox4.Top += speed;
if (pictureBox7.Top >= 600)
pictureBox7.Top += speed;
if (car.Bounds.IntersectsWith(coin1.Bounds))
label1.Text = "Coins" + colletedcoin.ToString();
coin1.Location = new Point(x, 0);
if (car.Bounds.IntersectsWith(coin2.Bounds))
label1.Text = "Coins" + colletedcoin.ToString();
coin2.Location = new Point(x, 0);
if (car.Bounds.IntersectsWith(coin3.Bounds))
label1.Text = "Coins" + colletedcoin.ToString();
coin3.Location = new Point(x, 0);
if (car.Bounds.IntersectsWith(coin4.Bounds))
label1.Text = "Coins" + colletedcoin.ToString();
coin4.Location = new Point(x, 0);
if (car.Bounds.IntersectsWith(coin5.Bounds))
label1.Text = "Coins" + colletedcoin.ToString();
coin5.Location = new Point(x, 0);
if (car.Bounds.IntersectsWith(coin6.Bounds))
label1.Text = "Coins" + colletedcoin.ToString();
coin6.Location = new Point(x, 0);
private void enemy2_BackColorChanged(object sender, EventArgs e)
private void Form1_KeyDown(object sender, KeyEventArgs e)
if (e.KeyCode == Keys.Left)
if (e.KeyCode == Keys.Right)
if (e.KeyCode == Keys.Up)
if (e.KeyCode == Keys.Down)