I tried to do it this way, but it just went REALLY slow, and I'm not sure if it even worked. The way I tried to do it probably isn't the best way either.
Code: Select all
for y = y1, y1+img1:height() do
for x = x1, x1+img1:width() do
for ty = y2, y2+img2:height() do
for tx = x2, x2+img2:width() do
tcolPix = testimg:pixel( x, y );
tcolTPix = testimg:pixel( tx, ty );
colPix = tcolPix:colors();
colTPix = tcolTPix:colors();
if ( colPix == colTPix ) then
return true;
end
end
end
end
end
The old way I had it was like this:
Code: Select all
if ( (shipX >= platformX) and (shipX+imgShip:width() <= platformX+imgPlatform:width()) ) then
if ( (shipY+imgShip:height() >= platformY-1) and (shipY+imgShip:height() <= platformY) ) then
if ( shipSpeed < 0.6 ) then
-- Do stuff
end
end
end
Thanks.