Hi,I dont need help but can anyone who has any actions for mc’s to make them do an effect post them here plz.
onClipEvent(enterFrame){
_x++;
}
ok… I’m a smartass
onClipEvent (enterFrame) {
_rotation += 10;
}
Hey david, your a smartass, I am a smartass, we are all smartasses:P
Seriously though, all the really great effects require more than just simple code on an mC.
ok… trying to be serious now.
onClipEvent(load){
yVelocity=5;
xVelocity=-20;
lossOfEnergy=.94;
gravity=4;
}
onClipEvent(enterFrame){
yVelocity+=gravity;
yVleocity*=lossOfEnergy;
xVelocity*=lossOfEnergy;
_x+=xVelocity;
_y+=yVelocity;
if(_x<=0){
_x=1;
xVelocity=-xVelocity;
}else if(_y<=0){
_y=1;
yVelocity=-yVelocity;
}else if(_x+_width>=300){
_x=299-_width;
xVelocity=-xVelocity;
}else if(_y+_height>=300){
_y=299-_height;
yVelocity=-yVelocity;
}
}
onClipEvent(mouseDown){
yVelocity-=Math.random()*100+1;
xVelocity-=Math.random()*100-50;
}
I think that will work. that’s second year stuff… haven’t worked with these in a while.
That is pretty cool. I did something like that when I was learning elasticity:)
that mixed with some scaling effects is the basis for most of my limited physics knowledge so far. I just worked off of that example.
If you add scaling you can create z movement… which is pretty cool too.
Hi,
yourMc is an instance of a movie clip that will be multiplicated as many times as the value of ‘num’
f = 0.8;
r = 0.1;
f2 = 0.5;
r2 = 0.1;
num = 5;
elasticMenuEnabled = true;
function elasticMenu() {
for (i=1; i<=num; i++) {
a = yourMc[“a”+i];
a.xscale = a.xscale*f+(a.s-a._xscale)r;
a.yscale = a.yscalef+(a.s-a._yscale)r;
//a._y = a1._y+(a1._height(i-1));
a._xscale += a.xscale;
a._yscale += a.yscale;
}
tu = Number(yo)+1;
for (i=(tu); i<=num; i++) {
a = este["a"+i];
b = este["a"+(i-1)];
a.y = (b._y+(b._height));
a.yvel = a.yvel*f2+(a.y-a._y)*r2;
a._y += a.yvel;
}
el = Number(yo)-1;
for (i=(el); i>=1; i--) {
a = este["a"+i];
b = este["a"+(i+1)];
a.y = (b._y-(b._width/2)-(a._width/2));
a.yvel = a.yvel*f2+(a.y-a._y)*r2;
//if (a._y>=minY*2) {
a._y += a.yvel;
//}
}
}
yourMc.onEnterFrame = function() {
if (elasticMenuEnabled) {
elasticMenu();
}
}
SWEEET!
very nice coding there.
is that your code or is it someone elses and you just copied it. The only reason I want to know is that if I use it, I’d put in comment tags giving credit to the creator. I think I’ll be playing around with that one a bit.
btw… the code I pasted above with velocity was taken from “Flash Game design” by friends of Ed books. If anyone is interested. I didn’t put in the comment tags but they really should be there.
Hi,
Yes, I wrote this code long ago and am using it again in project I’m working on at the moment.
bye
hmm… it doesnt’ do anything for me. Guess I’m not getting something…
Hi,
Sorry David, there was something missing.
I’m posting a fla with everything on it
Thankx
SHO
thanks sir. I’ll open it up when I get a chance.
THANKS!
THIS REALLY HELPS, HERES A COOL FLASH MOVIE.
**** it. I accidentaly stickied this thread and now I can’t unsticky it. Teach me to play around with the moderator options.
Well… I’ll talk to k and see what he knows about unsticking things.
Hey david, I unstuck it.
Thanks… that option didn’t seem to be doing it for me.
Odd, I had no problem. It is actually the first time I have ever used my mod capabilities. WOO HOO!
Create 2 circles,1 small and 1 big make them mc’s,give the big one an instance name of parent.Give the smaller one the instance name child1.Now Create a line from one mc to another and give it aninstance name:line.now right click on child1 actions and put in this code,
onClipEvent (load)
{
spring = false;
startX = _x;
startY = _y;
spX = 0;
spY = 0;
_root.line._visible = 1;
parentx = _root.parent._x;
parenty = _root.parent._y;
_root.line._x = parentx;
_root.line._y = parenty;
_root.line._xscale = _root.child1._x-parentx;
_root.line._yscale = _root.child1._y-parenty;
}
onClipEvent (mouseDown)
{
startDrag ("", true);
spring = true;
}
onClipEvent (mouseUp)
{
stopDrag ();
spring = false;
}
onClipEvent (enterFrame)
{
parentx = _root.parent._x;
parenty = _root.parent._y;
_root.line._x = parentx;
_root.line._y = parenty;
//////
_root.line._xscale = _root.child1._x-parentx;
_root.line._yscale = _root.child1._y-parenty;
//!spring = if false
if (!spring)
{
//code to create the movements
spX += (startX-_x);
spY += (startY-_y);
spX *= .09;
spY *= .09;
_x += spX;
_y += spY;
}
}
you don’t need to create the line 100/100 with a 135 degree slant?
I thought that was riquired for a line follow.
i have no idea,but i got it off here