Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8903835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:58:11+00:00 2026-06-15T01:58:11+00:00

So I am new to C# programming, and I am creating a connect four

  • 0

So I am new to C# programming, and I am creating a connect four game with graphics. I have a grid with circles. What I need to do is, see the chip move down when the user clicks in a certain column. Do I need to use a timer or something? or do I do a loop and maybe move the circle downwards by giving a smaller yCoordinate every time?

Also, is there a way that this circle will not be overlapping the grid? As in, can I make it look as if it is being moved behind the grid?

This is what I have done so far…

    private int columnPosition = 0;
    private int xCoordinate;
    private int yCoordinate;

    public Form1()
    {
        InitializeComponent();
    }

    private void panel1_Paint(object sender, PaintEventArgs e)
    {

        Graphics g = grid.CreateGraphics();
        Pen pen = new Pen(Color.White, 1);
        Pen pen2 = new Pen(Color.Black, 4);

        for (int i = 0; i < 7; i++)
        {
            for (int j = 0; j < 6; j++)
            {
                g.DrawEllipse(pen2, new System.Drawing.Rectangle((i * 70) + 20, (j * 60) + 10, 50, 50));
                g.FillEllipse(pen.Brush, new System.Drawing.Rectangle((i *70) + 20, (j * 60) + 10, 50, 50));



            }
        }
    }

    private void panel2_Paint(object sender, PaintEventArgs e)
    {
        Graphics g = panel2.CreateGraphics();
        Pen pen = new Pen(Color.Red, 5);
        Pen pen2 = new Pen(Color.Black, 3);

        if (columnPosition != -1)
        {
            g.DrawEllipse(pen2, new System.Drawing.Rectangle(columnPosition * 35 - 15, 0, 50, 50));
            g.FillEllipse(pen.Brush, new System.Drawing.Rectangle(columnPosition * 35 - 15, 0, 50, 50));

        }

    }

    private void panel1_MouseMove(object sender, MouseEventArgs e)
    {
        columnPosition = e.X / 35;
        Console.WriteLine(e.X);
        panel2.Refresh();
    }

    private void panel1_MouseLeave(object sender, EventArgs e)
    {
        columnPosition = -1;
        panel2.Refresh();
    }

    private void panel1_MouseClick(object sender, EventArgs e) 
    {
          ///// THIS IS WHERE I AM STUCK
    }

}

Sorry I wanted to upload an image of the grid but since I am a new user I can’t -.- !!

Thanks in advance for any help 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T01:58:12+00:00Added an answer on June 15, 2026 at 1:58 am

    You could use a timer, but you would also need to keep track of each circle through the entire animation. What if a user clicks another column while the animation is still happening? You wouldn’t want to reuse the same timer, you would want another.

    One downside to the timer is the the circle won’t flow smoothly, unless you have the timer go off frequently, but then you have the issue of moving the right amount for the amount of time that has passed (what if the computer is under heavy load, and can’t handle the timer right away?). Also, the WinForms API was not designed to handle high refresh rates (other libraries such as DirectX were developed for this purpose).

    Most games that have animations use another method of handling all of this. Essentially the applications becomes one big while(true) loop. It may no literally be while(true), but the idea is that as long as the game is running, the loop continues iterating. Upon each iteration of the loop, you draw the game. The next time the loop iterates, you calculate how much time has passed, then use that to determine how far each sprite (graphic) should have moved, then draw them accordingly. This is very analogous to how actual animation works (such as a movie in a theater). To the human eye, it looks like a moving picture, but in reality it is a series of still images that are refreshed at a high rate (usually 30 – 60 times per second).

    I’m not a professional game developer. I’m not even sure I would consider myself a “hobbiest”. I’m sure modern game programming is much more evolved then what I have described, but the basic concepts are all there. I would recommend picking up a book (or finding a good tutorial online) that is aimed at teaching game development to a non-game developer (a beginner’s guide).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm pretty new to programming, and I'm creating a simple text-based game.> I'm wondering
I am new to programming. I am creating a small word jumble game to
I'm pretty new to programming and I'm creating a python game for my little
I'm pretty new to programming in general and I'm creating a small game for
What is the real benefit of creating a new programming language? It is highly
Totally new to programming so kindly excuse the silly question. I have this URL
First off I'm new at programming. I'm creating an app with one navigation bar
I am new to programming and this is creating a lot of confusion for
We are creating an excel plugin but need some guidance as we're new to
I'm relative new to android programming and layouts, and got stuck on creating a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.