That depends on how exactly you are doing this. If you're making something like:szmol96 wrote:I only check pixels around the player and at some bullets' position. Is that still slow?HugoBDesigner wrote:The problem with pixel collision is that it is slow under most circumstances. Making the computer check thousands of pixels everytime is slow. Are you checking them every frame? If you are, just compare the pixels in an area close to the player (for example, pixels in a radius of 50 pixels around the player). Depending on what you have this can work very well
Code: Select all
for x = 1, imagewidth do
for y = 1, imageheight do
if x >= playerx-50 and x <= playerx+50 and y >= playery-50 and y <= playery+50 then
--your code here
end
end
end
If you were doing this, try doing this instead:
Code: Select all
for x = playerx-50, playerx+50 do
for y = playery-50, playery+50 do
--your code here
end
end
If this wasn't the problem, I'd like to have the code (or, if you don't wanna share, at least part of it) so I can see your problem