AleksandarMIlenkovic / quickb2

Automatically exported from code.google.com/p/quickb2
0 stars 0 forks source link

Adding actor not working #23

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Actors set in objects added to tdMap are not displaying.

Original issue reported on code.google.com by t.wisnie...@gtempaccount.com on 19 May 2011 at 8:48

GoogleCodeExporter commented 8 years ago
Could really use this, the car driving is great and since your actors are 
working so well I don't want to make my own engine. Please, pretty please ;)

Original comment by t.wisnie...@gtempaccount.com on 22 May 2011 at 10:00

GoogleCodeExporter commented 8 years ago
Oops sorry, missed this one.  What version of quickb2 are you using?  Are you 
on the SVN head?  If you can reproduce the problem with a few lines of code, 
I'd appreciate it, because I can't reproduce it.

Original comment by doug...@gmail.com on 23 May 2011 at 2:05

GoogleCodeExporter commented 8 years ago
Try adding actor to playerCar in CarDriving demo, I can't get it to work.
If you can please post snippet here, thx.
in constructor, at the end of file
var actorClass:Class = getDefinitionByName(actorClassStringRef) as Class;
            var wrapper:qb2FlashSpriteActor = new qb2FlashSpriteActor();
            wrapper.addChild(new actorClass());
            playerCar.actor = wrapper;

Original comment by *...@forever-entertainment.com on 25 May 2011 at 8:04

GoogleCodeExporter commented 8 years ago
The likely problem is that you haven't given the map an actor 
(qb2IActorContainer) as well, so the car's actor doesn't have anything to be 
added to.

However, you make me realize that perhaps if the parent doesn't have an actor 
container, the actor should be added to the closest ancestor that has an actor 
container defined.

I like this idea (I think), but I won't be able to add it in the immediate 
future.  I'll keep this issue open for now until I add that functionality...for 
now, make sure that giving the map an actor fixes the issue.

Original comment by doug...@gmail.com on 26 May 2011 at 2:00

GoogleCodeExporter commented 8 years ago
this hacks code, show actors:

qb2_friend function addActor():void
        {
            if ( _actor && !_actor.parent && _parent )
            {
                if ( _parent._actor && (_parent._actor is DisplayObjectContainer) )
                {
                    (_parent._actor as DisplayObjectContainer).addChild(_actor);
                }
//-------------------- start stupid hacks -----------------------------------
                else if ( _parent._parent._actor && (_parent._parent._actor is DisplayObjectContainer) )
                {
                    (_parent._parent._actor as DisplayObjectContainer).addChild(_actor);
                }           
//-------------------- end stupid hacks -----------------------------------
            }
        }

Original comment by Mikhail....@gmail.com on 5 Jul 2011 at 11:02

GoogleCodeExporter commented 8 years ago
Besides not being generalized, one problem that can occur with this:

adding adding a body A with an actor to a body B without an actor, then adding 
body B to another container with an actor, body A's actor will not update 
properly.

Original comment by doug...@gmail.com on 10 Jul 2011 at 12:48