0
    bool right;
    bool left;
    bool jump;
    int G = 30;
    int Force;
    public Form1()
    {
        InitializeComponent();
    }

    private void timer1_Tick(object sender, EventArgs e)
    {

        if(player.Bounds.IntersectsWith(box.Bounds) && player.Right >= box.Left && player.Right < box.Right)
        {
            right = false;
        }
    }

This is a fragment of my code. Everything in code beside this is working correctly.

This fragment makes statement when Right side of Object Player and Left side of Object Box collide. It works but there is a little bug which I've met in many projects : This is a screenshot of collision

As you see even through objects collide and statement works and stop the player to move left, you can barely see that they still overlap slightly. This ruins and has conflict with other side collisions. I have no idea what is the problem so please, i need some answers

  • It depends on how you move the object. Take a look at [this post](http://stackoverflow.com/a/33985530/3110834). – Reza Aghaei Jul 29 '16 at 19:18
  • i am a pretty amateur in C# so can you please EDIT that if statement for me? So that PLAYER stops when there is collision and doesn't go overlap as this is shown in picture in the post – Frosty Bacon Jul 29 '16 at 22:18
  • I don't know anything about your program and the way it works, the only thing that any user can do for you here, is guide you to solve problems when you post [MVCE](http://stackoverflow.com/help/mcve) or share idea about how you can do the job. As an idea, take a look at linked post. Also to get more help, post MCVE :) – Reza Aghaei Jul 29 '16 at 22:28
  • ok thanks for help – Frosty Bacon Jul 29 '16 at 22:38

0 Answers0