Results 1 to 15 of 29
-
November 12th, 2004, 05:31 PM #1
Random vertically scrolling stars
How to make random vertically scrolling stars to my space fighter game?

-
November 12th, 2004, 07:16 PM #2
Well, are you doing it by duplicating an mc or a bitmap or many stars? can u give a screenshot of what you want?
-
November 13th, 2004, 09:09 AM #3I mean stars like in this game http://www.miniclip.com/warrior.htm
Originally Posted by Dr Warm

-
November 13th, 2004, 09:40 AM #4
make a new movieclip with the star in it, and set it's linkage to export for actionscript, with a linkage id: "star".
then put this code root
i think this should work. i've not got flash installed atm so i can't check it. unless there's any bugs in it, it will.Code:speed = 10; star = function() { this._y = this._height * -1; this._x = Math.random() * Stage.width; } Object.registerClass("star", star); star.prototype.onEnterFrame = function() { this._y += speed; // if (this._y > Stage.height) { removeMovieClip(this); } } //the code to add stars: this.onEnterFrame = function() { starCount++; _root.attachMovieClip("star", "star_"+starCount, starCount); }
hope this helps
"60% of the time it works... every time." -- Paul Rudd as Brian Fantana.
-
November 13th, 2004, 10:29 AM #5
Umm it didnt work.. So?
First i need to inser new movie clip? Do I name it star and linkage id star export for actionscript? then i draw the star into the movie clip? Then i need to place the star to the stage and enter actionscript?
and I need bit more help with this game..
If enemy hits the hero its shield goes to "damage" frame?
Woohoo! I got the shield damage to work by myself!
-
November 13th, 2004, 11:42 PM #6
hey cyberalthete i can never see what u post for some reason, it looks like this to me:
where i'm guessing they'res supposed to be code after the root, not a gap? is they're something wrong with my browser?then put this code root
i think this should work. i've not got flash installed atm so i can't check it. unless there's any bugs in it, it will.
no, u just leave it in the library, if you give it a linkage name, flash will be able to find it with attachMovieThen i need to place the star to the stage and enter actionscript?
-
November 14th, 2004, 04:42 AM #7
I cant get it working.. Could you send me .fla?
And i need some help with secondary fire.
-
November 14th, 2004, 07:52 AM #8
sorry i can't get to flash atm but i had this on disk of a fishy game i started making, the first frame (menu) has bubble's coming up if you wait long enuf, the code for that is on the first frame, not in the timeline but on the right side of the stage (from memory)
hope it helps
-
November 14th, 2004, 10:33 AM #9Ok i got it working somehow.. but how do i make it so that the stars move down without mouse. Hope you get the point
Originally Posted by Dr Warm

-
November 14th, 2004, 10:39 AM #10
well, i used attachMovieClip instead of attachMovie.. Woops. !! try fixing that:
hope that helpsCode:speed = 10; star = function() { this._y = this._height * -1; this._x = Math.random() * Stage.width; } Object.registerClass("star", star); star.prototype.onEnterFrame = function() { this._y += speed; // if (this._y > Stage.height) { removeMovieClip(this); } } //the code to add stars: this.onEnterFrame = function() { starCount++; _root.attachMovie("star", "star_"+starCount, starCount); }
"60% of the time it works... every time." -- Paul Rudd as Brian Fantana.
-
November 14th, 2004, 11:03 AM #11
So.. Do i need to but that script into the frames actions? And do i need to check "export in first frame"?
By the way heres the swf of my game..
-
November 14th, 2004, 11:54 AM #12
why don't you just use the same method that you have used to do the bullets?
except make them move down, and make their _x property random.
but to answer your question, put that code in the frame with the ship in it, of the main timeline.for export in first frame, try it with and without, with if it's default."60% of the time it works... every time." -- Paul Rudd as Brian Fantana.
-
November 14th, 2004, 12:09 PM #13Yay it works! Thanks!
Originally Posted by cyberathlete

-
November 14th, 2004, 01:06 PM #14
Wtf?! This is weird.. If i but the star script on the layer where the hero is the stars will work but if health is zero it goes to gameover frame script wont work..
This is my the script what i have in the hero layer:
PHP Code:_root.onEnterFrame = function() {
if (score>11900) {
_root.gotoAndPlay("mission");
} else {
trace(score);
}
if (health<10) {
gotoAndStop("gameover");
} else {
trace(health);
}
}
_root.score = 0;
_root.health = 100;
stop();
speed = 10;
star = function() {
this._y = this._height * -1;
this._x = Math.random() * Stage.width;
}
Object.registerClass("star", star);
star.prototype.onEnterFrame = function() {
this._y += speed;
//
if (this._y > Stage.height) {
removeMovieClip(this);
}
}
//the code to add stars:
this.onEnterFrame = function() {
starCount++;
_root.attachMovie("star", "star_"+starCount, starCount);
}

-
November 15th, 2004, 11:17 AM #15
come on help me out here :S


Reply With Quote

Bookmarks