How to get all the pixels within a rotated image of a sprite in a screen?
in
Programming Questions
•
21 days ago
I have a map with square obstacles of size 20px X 20px,
whose center points are indexed into an array list. In my
game, I have a tank with dimension of 30px X 30px which
moves through the map, but should stop when it collides with
an obstacle. To check the collision, I need to get all the
pixels' coordinates within the rotated image of the tank.
Does the image.loadPixel() work for this? If yes, then what
pixels would pixels[] be populated with? I need the x- and
y- coordinates of the pixels separated for my purpose. How
would this be possible using the pixels[] array?
Any other way to check for collisions b/w the tank and the
square obstacles would be a great plus.
PS: I am working on Processing.js.
1