00:00
00:00
Newgrounds Background Image Theme

PalmVoe just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Foss:alpha Star

1,737 Views | 10 Replies
New Topic Respond to this Topic

Foss:alpha Star 2005-12-09 10:18:31


Foss: Main

What this is is that it makes stars (or other stuff) go from alpha 0 to alpha 100 and backwards. Don't sure if this have been done already but this is a pretty simple way to do it.
SAMPLE
Ok, make a new MC and make a star in it.
Place this code in it:
onClipEvent(enterFrame){
_alpha<=0?plus=1:0
_alpha>=100?plus=0:0
_alpha+=(plus)*5;
_alpha-=(!plus)*5;
}

Even thought this is FOSS Material I still want to explain the code for you.

onClipEvent(enterFrame){
_alpha<=0?plus=1:0
Makes the var plus true if alpha is lower than 0, same as if(_alpha<=0){plus=1}
_alpha>=100?plus=0:0
Makes the var plus false if alpha is higher than 100
_alpha+=(plus)*5;
Makes the alpha of the MC rise if the var plus is true
_alpha-=(!plus)*5;
Makes the alpha of the MC lower if the var plus is false
}

~GWHC


BBS Signature

Response to Foss:alpha Star 2005-12-09 10:28:45


At 12/9/05 10:18 AM, GuyWithHisComp wrote: Don't sure if this have been done already but this is a pretty simple way to do it.

onClipEvent(enterFrame){
plus = plus==undefined ? -1 : plus
plus *= Math.abs(50-_alpha)>=50 ? -1 : 1;
_alpha += plus*5
}

okay, i got it down to 3 lines. lets see if someone can get it further...


BBS Signature

Response to Foss:alpha Star 2005-12-09 10:37:20


At 12/9/05 10:31 AM, -KhAo- wrote: [script]

That didn't work.
Anyway, 2 lines :)

onClipEvent(enterFrame){
plus?_alpha+=5:_alpha-=5;
_alpha<=0?plus=1:_alpha>=100?plus=0:0;
}


BBS Signature

Response to Foss:alpha Star 2005-12-09 10:37:53


At 12/9/05 10:31 AM, -KhAo- wrote: onClipEvent(enterFrame){
_alpha += (plus==undefined ? -1 : plus)*(Math.abs(50-_alpha)>=50 ? -1 : 1)*5
}

doesnt work, but i got it down to one line:

onClipEvent(enterFrame){
_alpha += 5*(plus = (plus==undefined ? -1 : (Math.abs(50-_alpha)>=50 ? -1*plus : plus)));
}


BBS Signature

Response to Foss:alpha Star 2005-12-09 10:38:29


damn, authorblues won


BBS Signature

Response to Foss:alpha Star 2005-12-09 10:39:50


At 12/9/05 10:38 AM, GuyWithHisComp wrote: damn, authorblues won

we should play more games like this ^^;
theyre fun...

also, on a related note, when did the BBS turn off auto-formatting.
the auto-formatting should have torn apart my code...


BBS Signature

Response to Foss:alpha Star 2005-12-09 10:54:43


At 12/9/05 10:18 AM, GuyWithHisComp wrote: stuff

its a pretty good effect, it looks cool

Response to Foss:alpha Star 2005-12-09 10:56:15


At 12/9/05 10:39 AM, authorblues wrote: also, on a related note, when did the BBS turn off auto-formatting.
the auto-formatting should have torn apart my code...

yeah guys, dont answer my question... =p
seriously, whats up with the old auto-format?


BBS Signature

Response to Foss:alpha Star 2005-12-09 10:57:34


At 12/9/05 10:39 AM, authorblues wrote: we should play more games like this ^^;
theyre fun...

Maybe we can make a topic about it


BBS Signature

Response to Foss:alpha Star 2005-12-09 11:21:24


At 12/9/05 10:56 AM, authorblues wrote:
At 12/9/05 10:39 AM, authorblues wrote: also, on a related note, when did the BBS turn off auto-formatting.
the auto-formatting should have torn apart my code...
yeah guys, dont answer my question... =p
seriously, whats up with the old auto-format?

I think that if you have many spaces in the code, it mostly takes it as usual words and doesn't autoformat. =P

Response to Foss:alpha Star 2005-12-09 11:22:37


At 12/9/05 11:21 AM, Rantzien wrote: I think that if you have many spaces in the code, it mostly takes it as usual words and doesn't autoformat. =P

Gosh darned alt account >=(


BBS Signature