At 5/12/12 12:05 PM, MintPaw wrote:
No, not quite.
var _bullet:Bullet = new Bullet();
var _enemy:Enemy = new Enemy();
addChild(_bullet);
addChild(_enemy);
addEventListener(Event.ENTER_FRAME, update);
function update(e: event):void
{
if (_bullet.hitTestObject(_enemy)
{
//Et cetera
}
}
As a quick example.
Also, you shouldn't be adding thing to the stage, it's kinda hard to manage, you can actually add things to the doc class by just using "addChild()" instead of "stage.addChild()"
Honestly you should probably go deeper and add things to another MovieClip within the game, just to keep everything in one manageable place.
Wait, okay, so I addChild them from the document class(not from the stage), I give them their attributes from their own classes (speed, positioning, etc..), and then I code their interactions from the document class?
Am I finally getting it right?
And don't add them to the stage.. Okay.