How should I improve it? Make it come out at slower intervals? Make it bigger? Smaller? Blacker? Whiter?
How should I improve it? Make it come out at slower intervals? Make it bigger? Smaller? Blacker? Whiter?
At 3/9/05 09:17 PM, rebelliousstudios wrote: What's the code for a movie clip to chase another movie clip?
and what would the script be for when the movie clip touches another start another frame?
Thanks
If you meant to do this all at once then try this - add it to the frame and read the comments in the code.
clip1 = _root.mc;
// Clip1 is the clip that is moving towards the other.
clip1.speed = 15;
// How fast the clip moves to the other.
clip2 = _root.mc2;
// The second clip (target).
clip1.onEnterFrame = function() {
if (!this.hitTest(clip2)) {
this.angle = Math.atan2(clip2._y-this._y, clip2._x-this._x);
this._rotation = this.angle*(180/Math.PI);
this._x += this.speed*Math.cos(this.angle);
this._y += this.speed*Math.sin(this.angle);
} else {
_root.gotoAndStop(2);
// Change the 2 to whichever frame it should go to, or the _root if you need to.
}
};
What is the script for disabling the right-click menu?
At 3/10/05 04:56 PM, Mac_Dude wrote: What is the script for disabling the right-click menu?
stage.showMenu = false;
How do you make a movie-clip go to the other side of the screen if it runs off the other?Like it goes off the south boundary but then reenters by the morth boundary? Thanks Sorta like an asteroids thing.
add this to your code:
if(this._y > sh+this._height/2){
this._y = -this._height/2;
} else if(this._y < -this._height/2){
this._y = this._height/2+sh;
}
if(this._x > sw+this._width/2){
this._x = -this._width/2;
} else if(this._x < -this._width/2){
this._x = sw+this._width/2;
}
make sure that "sh" is the height of the stage, and "sw" is the width of the stage.
I need some help with making point A (_root.createEmptyMovieClip("clip",1) extend to were ever point B (_root.createEmptyMovieClip("clip2",2) goes to, Any idea how to do this??
At 3/10/05 11:59 PM, legendaryAce wrote: I need some help with making point A (_root.createEmptyMovieClip("clip",1) extend to were ever point B (_root.createEmptyMovieClip("clip2",2) goes to, Any idea how to do this??
Have you checked:
www.flashkit.com/tutorials
www.tutorialized.com
www.gotoandstop.it
www.newgrounds.com/portal
yet?
At 3/11/05 12:36 PM, High_Roller wrote: www.flashkit.com/tutorials
www.tutorialized.com
www.gotoandstop.it
www.newgrounds.com/portal
or...
www.actionscript.org
www.macromedia.com/tutorials
www.gotoandstop.org
www.flashmove.com
1) Spawning duplicated movieclips
2) at random y-axis coordinates running from the left of the screen
3)=how?
Do you mean randomly duplicating a MC at a set interval, having the MC have a random y-coordinate with a x-coordinate of 0, and move across the screen at a set speed?
At 3/11/05 04:56 PM, Begoner wrote: Do you mean randomly duplicating a MC at a set interval, having the MC have a random y-coordinate with a x-coordinate of 0, and move across the screen at a set speed?
i believe. ive got the code almost all worked out but it isnt working -.-
onClipEvent(load){
_root.circle._x = -100;
_root.circle._y = random(500);
}
So the circle must start on the left side of the screen, but at a random height. For clicking purposes, do I embed this MC into a button, or should it be a button to begin with, then make it an MC?
Speed..?
Well, I recommend that you do not use buttons at all. A movie clip can do ANYTHING a button can do, and more. Make the movie clip you want to be duplicated and call it "ball0." Then, on the frame the game is on, put:
number = 1;
timer = 10;
_root.onEnterFrame = function() {
timer--;
if (timer == 0) {
duplicateMovieClip(ball0, "ball"+number, this.getNextHighestDepth());
_root["ball"+number]._y = Math.random()*550;
_root["ball"+number]._x = -100;
_root["ball"+number].onEnterFrame = function() {
this._x += 5;
if (this._x>550) {
this.swapDepths(99999);
removeMovieClip(this);
}
};
_root["ball"+number].onPress = function() {
this.swapDepths(99999);
removeMovieClip(this);
};
number++;
timer = 10;
}
};
And put the ball0 MC somewhere in the corner. This may not be the most efficient way, but it worked for me.
The code didn't work. I'm trying to make the movieclip go to the left border if it goes out of the right border, right if goes out of the left border, up to down, and down to up. Sorta like an asteroids game Thia is my code so far. My frame is 650x500
And where should I put this code?
if(this._y > 500+this._height/2){
this._y = -this._height/2;
} else if(this._y < -this._height/2){
this._y = this._height/2+500;
}
if(this._x > 650+this._width/2){
this._x = -this._width/2;
} else if(this._x < -this._width/2){
this._x = 650+this._width/2;
}
Thank you very much. =D
At 3/11/05 05:30 PM, Begoner wrote: And put the ball0 MC somewhere in the corner. This may not be the most efficient way, but it worked for me.
This code did nothing whatsoever. I tried tweaking it every way possible, but still nothing. The ball just stays in the corner where it was told to stay. (?)
At 3/11/05 07:04 PM, High_Roller wrote: This code did nothing whatsoever. I tried tweaking it every way possible, but still nothing. The ball just stays in the corner where it was told to stay. (?)
Sorry, its working now... a boatload of changes, but: now it will pick a random y coordinate and start moving along the x axis as told, but only for half a second, it will then disappear, and repeat the process. What's up?
Well, that script, when compiled, gave me this:
http://www.freewebs.com/begoner/ballHelpDup.swf
And that .swf works perfectly well for me. Maybe I mistyped something, though. Here is the source for the above link:
At 3/11/05 07:08 PM, Begoner wrote: Well, that script, when compiled, gave me this:
http://www.freewebs.com/begoner/ballHelpDup.swf
And that .swf works perfectly well for me. Maybe I mistyped something, though. Here is the source for the above link:
http://www.freewebs.com/begoner/ballHelpDup.fla
I have Flash MX and can't read your fla. Is it because I have flash mx that this is happening? :8(
Yeah, I have Flash MX 2004, so that's probably why. But the script should work regardless. I just made a 1-frame Flash movie. On the first frame, put the code:
number = 1;
timer = 10;
_root.onEnterFrame = function() {
timer--;
if (timer == 0) {
duplicateMovieClip(ball0, "ball"+number, this.getNextHighestDepth());
_root["ball"+number]._y = Math.random()*400;
_root["ball"+number]._x = -100;
_root["ball"+number].onEnterFrame = function() {
this._x += 5;
if (this._x>550) {
this.swapDepths(99999);
removeMovieClip(this);
}
};
_root["ball"+number].onPress = function() {
this.swapDepths(99999);
removeMovieClip(this);
};
number++;
timer = 10;
}
};
Then, make a movie clip, and give it the instance of of ball0. Don't put anything in its actions panel. When you test the movie, it should work. If not, sorry, I don't know why it doesn't.
At 3/11/05 07:38 PM, Begoner wrote: number = 1;
timer = 10;
_root.onEnterFrame = function() {
timer--;
if (timer == 0) {
duplicateMovieClip(ball0, "ball"+number, this.getNextHighestDepth());
_root["ball"+number]._y = Math.random()*400;
_root["ball"+number]._x = -100;
_root["ball"+number].onEnterFrame = function() {
this._x += 5;
if (this._x>550) {
this.swapDepths(99999);
removeMovieClip(this);
}
};
_root["ball"+number].onPress = function() {
this.swapDepths(99999);
removeMovieClip(this);
};
number++;
timer = 10;
}
};
ugg wtf am i doing wrong... instance name ball0. It is a circle. In the corner. One frame movie, movieclip has no actions. Frame has actions, but comes up with error:
**Warning** Scene=Scene 1, Layer=Layer 1, Frame=1: Line 2: Case-insensitive identifier 'number' will obscure built-in object 'Number'.
number = 1;
So I change number to num, still the same results:
Circles start spawning off the stage to the left, and when they hit the left border of the stage they disappear. What do the semicolons mean after the }? Those look out of place (?).
aagghhhh...
Try changing number to:
tkh
And see if that works. I doubt there's a built in tkh. And if that doesn't work, and it gives the same error, I think there's something messed-up with your Flash.
At 3/11/05 07:45 PM, Begoner wrote: Try changing number to:
tkh
http://img110.exs.cx/my.php?loc=img110&image=gun20wi.swf
>:8( No errors, but check out the .swf.
Watch it for awhile, especially the left border. -.-
Lol, I'm sorry. I don't know what to say. You changed both "number"s to "tkh"s, right? If so, I have no clue.
At 3/11/05 08:03 PM, Begoner wrote: Lol, I'm sorry. I don't know what to say. You changed both "number"s to "tkh"s, right? If so, I have no clue.
i tried it with number.. got error
changed it to num.. got the problem i showed you
changed it to tkh.. got the problem i showed you
hot damn it, i guess i give up
hi, i was wondering if anyone has a script for random wandering, cause eviludy's didnt work.....
how do i make it so that if the mouse is hidden in the first scene it isnt hidden in the 2nd scene?
2b r not2b lawl
At 3/12/05 11:48 AM, Begoner wrote: Mouse.show()
I think.
Yeah I'm not sure if you need a semicolon though?
Mouse.show(); does it too, so.
Mouse.hide();
Mouse.show();
Mouse.addListener(listener);
Mouse.removeListener(listener);
These are all of the mouse actions, I believe.
At 3/12/05 01:31 PM, mofomojo wrote: onClipEvent (enterFrame) {
var movieclip:Object = new Object();
seq1 = _x -= 15;
Command = "a"
if (0==0 && Command == True) {
seq1;
seq1 = True;
} if( seq1 == True && _x<=0){
seq1 = False;
_x+=15;
Command = False;
}
}
Do you have a question//Is this not working?
At 3/11/05 07:42 PM, High_Roller wrote:
ugg wtf am i doing wrong... instance name ball0. It is a circle. In the corner. One frame movie, movieclip has no actions. Frame has actions, but comes up with error:
**Warning** Scene=Scene 1, Layer=Layer 1, Frame=1: Line 2: Case-insensitive identifier 'number' will obscure built-in object 'Number'.
number = 1;
So I change number to num, still the same results:
Circles start spawning off the stage to the left, and when they hit the left border of the stage they disappear. What do the semicolons mean after the }? Those look out of place (?).
aagghhhh...
It's blatantly a depth problem. I believe getNextHighestDepth was glitchy in MX but they fixed the errors in MX 2004 (don't quote me on this as i'm not sure).
I added the d variable as the depth:
number = 1;
timer = 10;
d = 0;
_root.onEnterFrame = function() {
timer--;
if (timer == 0) {
duplicateMovieClip(ball0, "ball"+number, d++);
_root["ball"+number]._y = Math.random()*400;
_root["ball"+number]._x = -100;
_root["ball"+number].onEnterFrame = function() {
this._x += 5;
if (this._x>550) {
this.swapDepths(99999);
removeMovieClip(this);
}
};
_root["ball"+number].onPress = function() {
this.swapDepths(99999);
removeMovieClip(this);
};
number++;
timer = 10;
}
};