Hello there!
I am creating a game with a colleague of mine, from the university, that takes place underwater.
I have the following code, which i took from http://www.n99creations.com/?pID=user_examples&col=Blue&eg=Bubble_Cursor (thanx to the creator) and i tried to embody it into the code of the game we are creating:
onClipEvent (load) {
_root.bubble._xscale=random(30)
_root.bubble._yscale=_root.bubble._xscale
bubblecount=0
xvelocity=Math.random()*2-Math.random()*2
yvelocity=1.02
_root.bubble._alpha=100;
}
onClipEvent (enterFrame) {
function bubbles() {
bubblename = "_root.bubble"+bubblecount;
_root.bubble.duplicateMovieClip(bubblename, bubblecount);
bubblecount++;
}
_root.bubble._x += xvelocity;
_root.bubble._y /= yvelocity;
_root.bubble_alpha--;
if (_root.bubble._alpha<1) {
_root.bubble.removeMovieClip();
}
if (_root.bubble._y>400) {
_root.bubble.removeMovieClip();
}
if (_root.bubble._y<0) {
_root.bubble.removeMovieClip();
}
if (_root.bubble._x>550) {
_root.bubble.removeMovieClip();
}
if (_root.bubble._x<0) {
_root.bubble.removeMovieClip();
}
This code is inside the rest of the code, inside a single mc.
I have taken out the part with the mouse, because i want the bubbles to get out from random places at the bottom, inside the scene. Should i write a initial position?
Although the example works, inside the game it doesn’t.
The “bubble” mc is inside the main scene. Only a single bubble is generated
Thanks in advance!