SetColidRect doesn't work because w and h = 0 , why ?
local function createMeteorAnime(x, y)
local tabMeteoriteAnime = {
"asteroid_sprite1",
"asteroid_sprite2",
"asteroid_sprite3"
}
tmeteoriteAnime = math.random(#tabMeteoriteAnime)
MeteorAnime = tabMeteoriteAnime[tmeteoriteAnime]
if meteorAnimeCount < maxMeteoriteAnime then
local meteoriteAnime = gfx.sprite.new()
meteoriteAnime.imagetable = gfx.imagetable.new("images/".. MeteorAnime)
meteoriteAnime.animation = gfx.animation.loop.new(80, meteoriteAnime.imagetable, true)
local w, h = meteoriteAnime:getSize()
meteoriteAnime:setCollideRect(0, 0, w, h)
--meteoriteAnime.allOverlappingSprites()
local Xpath = math.random(400)
local Ypath = -math.random(30) - h
meteoriteAnime:moveTo(Xpath, Ypath)
--meteoriteAnime:moveWithCollisions(Xpath, Ypath)
meteoriteAnime:add()
print("witdh = "..w.." - height = "..h)
meteorAnimeCount = meteorAnimeCount + 1
function meteoriteAnime:collisionResponse(other)
return gfx.sprite.kCollisionTypeOverlap
end
thank you for your advise