I am trying to do collision detection(tried using TNTCollision but did not work ).
1. My (1st object ) background object is moving continuously from off the screen and towards left of screen,I am translating its position to left by subtracting 4 from its current position in Enter_Frame.
-->It's 'Y' changes in every EnterFrame randomly and so it's height changes the value of which I certainly have)
-->The AnchorPoint of this object has been set to (0,1)
2. Second object just moves up and down, its X remains 0 (which is the centre of the screen).
I tried a couple of things to detect collision manually but it's kind of getting confusing because the anchorpoint of first object is (0,1), any knack to detect collision between such objects?
I tried this using TNTCollisionEngine but I am quite surprised that it's not working:Here is the code
if colcheck (mc1:getX(), mc1:getY(), mc1:getWidth(), mc1:getHeight(), mc1:getRotation(), d, f, up:getWidth(), up:getHeight(), up:getRotation()) then
tntCollision.setCollisionAnchorPoint(0, 1)
print("YOU LOOSE")
end
mc1 here is an animation I created using MovieClip
Thanks
Comments
sorry.
www.tntengine.com
if mc1:getX() >= up:getX() and mc1:getX() + mc1:getWidth() <= d + up:getWidth() and mc1:getY() >= f - up:getHeight() then
local text4 = TextField.new(conf.fontLarge, "YOU LOOSE")
text4:setPosition(conf.dx - conf.width/3, conf.dy - conf.height/5)
text4:setTextColor(0x0000)
self:addChild(text4)
end
Thanks
www.tntengine.com