I'm developing some platform-like game using AS3 and Flash CS5 for animations. I've already done most of the mechanics now, and I've starded to drawing characters and animating them. But some problem appeared. I used getBounds(this) for caching all of the collisions, and after changing the placeholders to real images everything sucks. Is there any way to change the bounding box to something more constant? What's the proper way to handle with this problem in AS3? I was thinking about representing each colidable object as a pair of animated object and some constant object that will be my colliding box. But usage of that model will be quite annoying... couse I would need to make two working objects/classes for each object that I would like to have collidable. Every help will be appreciated. Looking for some non-noob ways of dealing with it =]
Ok... What I did exactly to handle it somehow: I've created an object and called it BBox. I filled it red to be seen well. Now I put it in each MotionClip that I want to have constant bounding box. But to have the stage clear I just added 'visible = false' in it's class constructor. Basicaly it is visible in Flash in scene view, but it's hidden in game, so I can easly draw it in scene view. Of course I resize this object each time using it to fit my needs. The only thing to remember is to call bBox.hitTestObject() not this.hitTestObject() in class that is being used. Of course I need to call getChildByName in the class that I want to use this boundingbox and keep its referance also. It's some tricky way of doing this and there must be some easier one. I you have some other way of doing that just let me know.