shohan4556 Posted April 21, 2016 Share Posted April 21, 2016 Hello, fellows I am making a color games and I am struggling to implement the idea pleas take a look the image attachment. I want to collide the red square with red block and yellow with yellow blocks. thanks. Link to comment Share on other sites More sharing options...
none-9999 Posted April 21, 2016 Share Posted April 21, 2016 Hola https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath If any of the 4 points of the small cube, it is within the triangle. if the small box turn, you have to calculate the coordinates of each of the four points (arithmetic) Link to comment Share on other sites More sharing options...
shohan4556 Posted April 21, 2016 Author Share Posted April 21, 2016 3 minutes ago, gilber966 said: Hola https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/isPointInPath If any of the 4 points of the small cube, it is within the triangle I dont understand why isPointPath can do this. I want to do with Phaser. is there any way to do it with Phaser. Link to comment Share on other sites More sharing options...
none-9999 Posted April 21, 2016 Share Posted April 21, 2016 You see why not use frameworks. Do not try the large square as a square, treat him like two triangles, then each point of the four that make up the small square, you calculate if within any triangle, if only one is inside is that your picture small collided with one of the two triangles. Link to comment Share on other sites More sharing options...
Recommended Posts