Hi Everyone,
I've been playing with tmoore's "kooleroids" code to learn a bit about flash games. I want to replace the way kooleroids fires lasers with the way lasers are shot in this example here.
That example has code that can't be copy/pasted because it's a screenshot, but I believe I transcribed it accurately here:
I've tried to figure out where this code would go and I realize I would also need to change Kooleroids "laser" to "bullet" and "spaceship" to "ship" to correspond to the above code's movie clips, I believe...Code:var bulletSpeed = 12; var bulletReady = true; var bulletDelay = 150; var bulletArray = []; var bulletCount = 0; function createBullets(){ var bulletMc = this.attachMovie("bullet","bullet"+bulletCount,1000+bulletCount); bulletCount++; bulletMc._x = shipMc._x+(shipMc._width/2)-(bulletMc._width/2); bulletMc._y = shipMc._y=bulletMc._height; bulletArray.push(bulletMc); } function moveBullets(){ if (bulletReady && key.isDown(Key.SPACE)) { bulletReady = false; currentTime = getTimer(); createBullets(); } else { if (currentTime+bulletDelay<=getTimer()) { bulletReady = true; } } for (var i = 0; 1,bulletArray.length; i++) { bulletArray[i]._y-= bulletSpeed; } } this.onEnterFrame = function() { moveStars(); moveShip(); moveBullets(); };
Here is a link to Kooleroids zip file
Thanks for any and all help KM-Krew!
-Dan




Reply With Quote
