in my code i tried to assign at a MovieClip a Body
like this:
in function birds:init(createBody)
self.Animation = MovieClip.new{
{1, 7, self.anim[1]},
{8, 15, self.anim[2]},
{16, 23, self.anim[3]},
{24, 31, self.anim[4]},
{32, 39, self.anim[3]},
{40, 47, self.anim[2]}
}
"self.bird_body" already defined in this function....
self.Animation.body = self.bird_body
self:addChild(self.Animation)
but when in main loop
i do:
world:step(1/60, 10, 10)
-- Draw all sprites aligned with physics engine...
for i=1, stage:getNumChildren() do
local sprite = stage:getChildAt(i)
if sprite.body then
sprite:setPosition(sprite.body:getPosition())
sprite:setRotation(sprite.body:getAngle() * 180 / math.pi)
end
end
the birds sprites had no body ... (is nil)
why?
any help?
TNT ENGiNE for Gideors Studio - Particle Engine, Virtual Pad, Animator Studio, Collision Engine - DOWNLOAD NOW !!! IT'S FREE!!! -
www.tntengine.com
Comments
It seems the line
self.Animation.body = self.bird_body
should be
self.body = self.bird_body
ops....
i feel so stupid! )
*** it's about 1 hour and i dind't see it !! maybe I have to buy glasses ... :-B
thanks atilim! ^:)^
www.tntengine.com