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 Viewswell, the coding i have makes it appear when i go to the that frame. does that mean it has posotive depths? if so, then it still doesnt remove then, because i added a peice of coding changing the depths to posotive anyway.
and if it does remove ones create with crateemptymovieclip, then it would remove "the_tail". but it doesnt :/
rather confusing, because in theory it should wor.
At 1/5/09 09:18 AM, WolfAkela wrote: Check if your code is actually "seeing" the MCs by tracing a value from them, like the_head._x.
ah! yes there is. on 2 lines.
nodes[0] = {x:the_head._x, y:the_head._y};
for (var x = 1; x<tail_nodes-1; ++x) {
what's the significane of this?
hm...I should explain it better.
I have 3 frames. Frame 1 is the preloader. Frame 2 is the menu. Frame 3 is one of the games in the acutal whoel thing.
In that game i have a string. theres a movieclip, instance name "the_head". in the coding i found i created an emptymovieclip name "the_tail" blah blah blah, and now I have string on that frame. there is a back button there so that it goes back to the menu.
I need it so that when it enters frame 2, the movieclips the_head and the_tail aren't there. but it's proving difficult.
I'm also using AS2.0
help?
ok, i gave the movieclips i was using depths, but when i click the back to go to the menu, the movieclip is still connected yo my mouse (thats what the mc is)
is there another way?
I tried adding a coding into a button about removeing MovieClips with the instance names "the_head" and "the_tail", but it didn't seem to work.
all I put was:
onClipEvent (enterFrame) function {
"the_head".removeMovieClip;
"the_tail"/removeMovieClip
}
stop ();
(*note: I just wrote this by hand. the code is probably wrong the way i typed it just now but as far as i know the actual code has no errors. I'm sure it doesn't.)
(**note: the stop is so it doesn't move onto the next frame)
I used this, but it still kept the movieclips in. Am I using the wrong code, or am I typing it wrong? can someone help?
so, like, could anyone help me on this? i've tried removeMovieClip, but it doesnt seem to have worked.
It seems good so far, i only encountered one bug.
the bug was the is you move your mouse to the bottom corner, it changes the turrets gun facing to a default position of a 45 degree angle facing left.
you might want to add hit test in at the floor and at the ramp and wals, so the balls dont fly through them.
ok, here's the code:
//the string
tail_len = 2;
tail_nodes = 100;
nodes = new Array();
_root.attachMovie("the_head", "the_head", 1, {_x:250, _y:200});
_root.createEmptyMovieClip("the_tail", 2);
for (x=1; x<tail_nodes; x++) {
nodes[x] = {x:the_head._x, y:the_head._y};
}
the_head.onEnterFrame = function() {
this._x = _root._xmouse;
this._y = _root._ymouse;
the_tail.clear();
the_tail.lineStyle(2, 000000);
the_tail.moveTo(the_head._x, the_head._y);
nodes[0] = {x:the_head._x, y:the_head._y};
for (var x = 1; x<tail_nodes-1; ++x) {
rotation = Math.atan2(nodes[x].y-nodes[x-1].y, nodes[x].x-nodes[x-1].x);
pos_x = nodes[x-1].x+tail_len*Math.cos(rotation)
;
pos_y = nodes[x-1].y+tail_len*Math.sin(rotation)
;
nodes[x] = {x:pos_x, y:pos_y};
the_tail.lineTo(pos_x, pos_y);
}
};
stop ();
(the stop is so it doesnt continue to other frames)
the main movieclip for the head of the string is "the_head" (without qoutes) and the movieclip for the string part is "the_tail" (wihtout qoutes)
the string part of the game is on frame 3, and the menu is on frame 2.
i need it so it doesnt have "the_head" and "the_tail" on frame 2.
are you able to help?
I found a tutorial on flash kit (might have been tutotialized) on making a string thing, like the classic string game.
I added a button, going to the certain game with the string, and when i press the back button, it still keeps the string on. I've looked everywhere but i can't seem to find a code that gets rid of the string when it goes back to the menu.
can anyone give me a hand?
At 1/2/09 12:41 PM, YoungAndWise wrote:At 1/2/09 12:23 PM, J0Rel wrote: Now, on the play button(that is frame 1) just put on the code:Wait, he doesn't need to do any of this. He is already using a NG preloader, which has a working play button... you're telling him how to make a play button.
on(release){
_root.play(5);
}
What your doing with this is that your saying to the button that if the user clicks on it it will go to the frame 5 of the main timelime where the sound and the movie starts at the same time.
All he has to do is put the audio in a keyframe directly after the preloader (probably frame 2). It's as simple as creating a keyframe in frame 2 (there probably is one already), and dropping the audio on stage (make sure you are in frame 2). I also recommend using a separate layer for music, if you aren't already.
Thank you YoungAndWise, this worked! i didnt need any coding at the end, just changed the reapeat to "0", and it made the sound stop at the end. Thank you so much!
"bump time" I say.
I'll explain something else.
I imported a WMA file, and want to put it into flash. however, when i preview it plays the sound straight awya. I need it so it doesn't play the sound on the preloader, plays the sound when i click the play button ON the preloader, and stop the sound at the end of the movie so it does not continually loop the sound.
anyone help?
Is there a way i can sotp the sound, then start it when it goes to the frame after the NG preloader? If so, then i don't know how to od it :/.
At 12/31/08 02:27 PM, Dasuraga wrote:At 12/31/08 01:54 PM, flailthefox wrote: im doing this game, and im wondering if there is a code that goes along the lines of: if you hit a certain object, then it repaces the character movieclip with something like an explosion.there are several solutions for this, depending on what you'd like. You could
is there a code for this? if so either point me in the right direction to finding it or give me the code.
1) add some extra frames to the enemy's movie clip, while making a loop for the main animation frames. Ex. if your main animation is 5 frames, you stick 3 explosion frames for 6-8, at frame 5 put a goto 1, and at 8, you destroy the movie clip
2)(AS 3) add the explosion animation to the parent(which would be the stage) and destruct the main clip. This will effectively "replace" the movie clip with the explosion.
Pardon the bad explanation, I just picked up Flash again after 18 months today.
Hm...I see your solutions.
1) there is no enemy, just somehting to crash into XD. Sorry i didnt explain it clearer. But, if i used that method, coudl I add more frames to my movie clip and put some codes in to say that when i crash into it, to go to these frames?
2) that could work, i could use the alpha couldn't I? I might use that method.
im doing this game, and im wondering if there is a code that goes along the lines of: if you hit a certain object, then it repaces the character movieclip with something like an explosion.
is there a code for this? if so either point me in the right direction to finding it or give me the code.
Ok, i "used my eyes" As you so aduquetly put it. There are the same number of { as there is }
Hm...it still says there is an error, on the same source description and everything :/
Ok. Lucky me, I got Adobe Flash CS3 Professional. I was looking through the flash tutorials, looking at how to make a platform game. I found one and had a look through it. I copied pasted coding that went along the lines of:
onClipEvent(load) {
var speed:Number = 0;
var walk:Number = 3;
var run:Number = 6;
var grav:Number = 0;
var falling:Number = 0;
var jumped:Boolean = false;
var jumpHeight:Number = 15;
var touchingGround:Boolean = false;
var scale:Number = _xscale;
}
onClipEvent(enterFrame) {
if (!touchingGround) {
grav++;
this._y += grav;
} else {
grav = 0;
}
if (_root.ground.hitTest(_x,_y,true)) {
touchingGround = true;
} else {
touchingGround = false;
}
Now, this shoudl have made the character animation i had fall onot a rectangle and it shouln't fall through.
This is not the problem you are thinking of.
What ahppened was that it said:
Loacation: Scene 1,Layer 'Layer 1', Frame 1,Line 1
Description: 1087: Syntax error: extra characters found after end of program.
Source: onClipEvent(load) {
Can anyone help to sort this problem?
It's better when you read books, because it stretches your imagination. that's why most people should read em.
David Edding's Belgariad book series, thier great. if you do, there is another about the same characters called the Malloreon, both series have 5 books in each.
heh heh, I get it. Mario jumped on the turtlles thinking they were koopas, now they are dead. XD funny.
i dont really know if this worked, i probably didnt
lol, yeh i see your point, homework isnt important, its just because they didnt get it all done in the lesson
i like that game, so leave it alone
Got it woroking! im flail333!
fien, it was the wrong idea trying making this topic..... im going to cry
Shut the hell up, just shut up! god........
iim lonely, no one likes me of talks to me, NG is my only friend...