I am in the process of making a side-scrolling shooter game, and have currently made a working game- but I want to change how the hittest is done.
So I decided on going for pixel-based collison detection, with BitmapData.
I have a working example of the new collision detection(http://www.megaupload.com/?d=1XF5JIW4), but I need help with figuring out how to implement this new code(noobalert).
My game as of now only uses frame1 and lots of as2. My current code for spawning EnemyShip1 is:
if (enemyTimer>(60+Math.ceil(Math.random()*7))) {
enemyTimer = 0;
var enemy = _root.attachMovie("EnemyShip1", "EnemyShip1"+_root.getNextHighestDepth(), _root.getNextHighestDepth());
enemies.push(enemy);
}
and is found in ship.as of my game.
And my current code for hittesting EnemyShip1 vs. Ship is:
if(this.hitTest(_root.ship))
{
if(_root.ship.shield._visible == false)
{
_root.ship.updateHealth(-20);
_root.ship.initShake(); //shake effect
}
explode(); //removes movieclip
}
and is found in EnemyShip1.as of my game.
Basically my main problem is that I dont fully understand the code in the linked fla, and therefore have little ideas as to how I can implement it? Eg. I can’t use import in a class definition, and therefore cannot use some of the code in the .fla linked. So I’m unsure if it will still be possible to spawn from ship.as, or if I will have to move over to using actions- as in the linked .fla. Any help will be greatly appreciated ;(.