|
-
shooting lasers like this...
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:
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();
};
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...
Here is a link to Kooleroids zip file
Thanks for any and all help KM-Krew!
-Dan
-
I search on this forum for "asteroids"
There was no answer when theSWEEN asked a similar question on 12-28-2007, 10:43 AM at:
http://board.flashkit.com/board/show...ight=asteroids
But dangrace seems to have made some progress on 03-09-2009, 09:17 AM at:
http://board.flashkit.com/board/show...ight=asteroids
and also half way down the page at:
http://board.flashkit.com/board/show...ds#post4148934
-
Ongoing asteroids
Thanks RM. Yes, I've been coming back to this game for awhile and two of those posts were mine. The only thing I still want to do is redesign the lasers. All my beta testers agree the lasers are a bit buggy i.e. prior lasers cancel if a new one is shot. Holding down the space bar does not release a stream of lasers, but instead produces a stuttering effect. That's why I like and linked that game example.
Anyone know where to plug that above code into kooleroids?!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|