hello I have been writing a side scrolling shooter in visual studio with opengl. I draw the level with GL_QUADSTRIP that reads its points in from a .dat file.
the dat file looks like this
# level length
20
# level speed (used for development/testing)
1.2
# ground data
10
0.0 0.0
1.0 0.25
2.0 0.0
#ceiling data
10
0.0 1.0
1.0 0.75
2.0 1.0
#end
I am trying to use this to try and implement collision detection between the ship(which is just a basic triangle drawn with opengl) and the floor and ceiling data
This isnt working obviously so my question is can anyone help me work out how to read the data form the .dat to check if the ship is collidiing with the level and ending the game.Code:for(int i= 0;i<=level.groundLength; i++){ if (ship.position.x < level.ground[i].x){ gameState = GAME_QUIT; } }
Any help is appreciated
Thanking You