I want to flip an Sprite . if i do this with setSccaleX(-1) and setScaleY(-1) the Sprite is left from where the object shoud be so what i have to do ? i use Texture with Region for the Anmimation
--Input (sprite2): another sprite to check for collision detection --Return: return true if the rectangles overlap otherwise return false
-- self bottom < other sprite top if self:getY() + self:getHeight() < sprite2:getY() then return false end -- self top > other sprite bottom if self:getY() > sprite2:getY() + sprite2:getHeight() then return false end -- self left > other sprite right if self:getX() > sprite2:getX() + sprite2:getWidth() then return false end -- self right < other sprite left if self:getX() + self:getWidth() < sprite2:getX() then return false end
Comments
function sprite:collision(sprite2)
--Input (sprite2): another sprite to check for collision detection
--Return: return true if the rectangles overlap otherwise return false
-- self bottom < other sprite top
if self:getY() + self:getHeight() < sprite2:getY() then
return false
end
-- self top > other sprite bottom
if self:getY() > sprite2:getY() + sprite2:getHeight() then
return false
end
-- self left > other sprite right
if self:getX() > sprite2:getX() + sprite2:getWidth() then
return false
end
-- self right < other sprite left
if self:getX() + self:getWidth() < sprite2:getX() then
return false
end
return true
end
how can i include code here ? : )
http://members.giderosmobile.com/knowledgebase.php?action=displayarticle&id=41
Likes: Tstar_one