Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
movieclip -> body — Gideros Forum

movieclip -> body

GregBUGGregBUG Guru
edited January 2012 in General questions
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

Sign In or Register to comment.