Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.18 / 5.00 3,534 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.80 / 5.00 4,200 Viewsi want it so that if I move my character MC bubbles flot upwards from him. ny ideas? i'm sure it involves an even listener somewhere.
Destroyed.
Certified audiophreak, lv 60.
At 4/22/09 01:25 PM, Slipstreamer wrote: What are you talking about?
oh ill explain:
i have a movieclip called "bubble". i have a motion tween of it where it moves up and then faddes as its going up.
I want it so on stage as my character moves bubbles appear out of him, doing the same action but wiht some variation.
that ok?
Destroyed.
At 4/22/09 01:10 PM, flailthefox wrote: i'm sure it involves an even listener somewhere.
dont flatter yourself...
is this what your looking for?
Wherever you have your code for movement, just add some code to spawn a bubble mc in the same place.
With as2, just use attachMovie
With as3, create a new instance of the bubble class and addChild it.
Signatures are for people who aren't lazy.
Note, I use AS2 here
Take a look at the attachMovie method here.
Then, to randomise it, you could change the rotation of it.
[bubblename]._rotation = Math.floor(Math.random*360)
This creates a random number between 0 and 1 (including 0, but not 1). It then multiplies this number by 360, and rounds it down (Math.floor()). This creates a random rotation between 0 and 359 (360-1).
Basically, by putting the instance name there, you can change the direction in which the bubble moves.
If you were to use code to move the bubble and make it fade, instead of using a motion tween, you could randomise a lot more.
with ([bubblename]) {
speedx = Math.floor(Math.random*21-10);
// makes a variable equal to a random whole number between -10 and 10 ((21-1)-10)
speedy = Math.floor(Math.random*11+1);
// another random number
alphachange = Math.floor(Math.random*12+1);
// creates a random whole number between 1 and 10 ((12-1)-1)
// don't forget, you can change the numbers to change the range of the randomiser
onEnterFrame = function () {
this._x += speedx;
// moves the bubble right by one of the random numbers made above
this._y += speedy;
// does the same downwards
// as the random number can be both positive and negative, it is equally as likely to go up
this._alpha -= alphachange;
// decreases the visibility of the bubble by a third random number
// alpha is visibility, and starts at 100% (completely visible) and goes to 0% (completely invisible)
if (this._alpha<=0) {
// if the alpha reaches 0 (when the bubble is completely invisible), run the following stuff
this.removeMovieClip();
// deletes the bubble
}
};
}
Is this the kind of 'randomness' you wanted?
By the way, next time, give a more informative topic title. What is 'mouse effecto'?
Doomsday-One, working on stuff better than preloaders. Marginally.
umm, my method might not be dynamic but it sure as hell is alot easier :P
At 4/22/09 02:05 PM, Yambanshee wrote: umm, my method might not be dynamic but it sure as hell is alot easier :P
Your method involves animating. And that is the hardest thing of all.
Doomsday-One, working on stuff better than preloaders. Marginally.