Even more collision!

Today I worked some more on the collision-checks for the game. I got the line-circle collision to work with SFML. The code had been working for a while before I realized I had forgotten to update the players collider position when the player moved. Now it has been implemented and I will put it to the test tomorrow.

I have also added a check between two circles. Most of the objects (I believe all the objects but the projectiles) will have a circular shape. So this will check collision between enemy-enemy, player-enemy, player-object, enemy-object. And today I finally got to use some of that math I never thought I would from school.

pythagoras

The Pythagorean theorem.

I also improved the tool which we will use to set the points in our room which we will check the collision between.

pointsOnMap

The scale is 1:2 but the output is the correct points we will use later. For extra help I show the mouse position in the bottom right corner. The black lines (which might be hard to see in this picture) show the user where he/she has put the points and where the player won’t be able to get past. We will simply name the files after which room the points are for. As it is now you can’t choose the pixels that are at the edge of the picture, I will have to look in to that so there will be no gaps in between the rooms. Tomorrow I will put three of the rooms together and see how well this really works.


One response to “Even more collision!

  • Helena

    Väldigt kul att läsa om din progress! Speciellt så fnissade jag lite när du beskrev att du nu äntligen såg nyttan av gymnasiematten :-)!

Leave a comment