okay. What I do :
Code: Select all
-- I load my images this way
img.alien = {
lg.newQuad(32, 16, 16,16,img.Size,img.Size),
lg.newQuad(0, 16, 16,16,img.Size,img.Size),
lg.newQuad(16, 16, 16,16,img.Size,img.Size),
lg.newQuad(32, 32, 16,16,img.Size,img.Size),
lg.newQuad(0, 32, 16,16,img.Size,img.Size),
lg.newQuad(16, 32, 16,16,img.Size,img.Size)
}
-- then I could draw them, only one now for example
lg.drawq (img.tiles, img.alien[1], aliens[1].x, aliens[1].y,0,img.scale,img.scale)
Thats an alien on screen.
Now, if I hit one, I draw a explosion at its position for a short time
The alien images got different colours so the explosion image should be in the same colour as the alien colour.
I try :
Code: Select all
if img.alien == 1 then
lg.drawq( img.tiles , img.boom , aliens[i].x , aliens[i].y , 0 ,img.scale,img.scale )
end
Thats not possible for sure. So my question how could I compare the table KEY ( the number in the [] i.e img.alien[ 1 ] ) with a number?
Or maybe a tip how I could do it better