Hittest Timeline
Hello everybody, I'm new to the forum! I've got a problem with a game I am creating, I want a movie clip to play once when my character hits it, it has a stop function at the end of the movie clip, but as long as the character is on top of it, it continues to loop, how do I get it to stop at the last frame?Here is the script applied to the movie clip: onClipEvent (enterFrame) {if (this.hitTest(_root.bubMC)) {play();}} All I've been able to do was make the last frame extremely long and load an alternate movieclip without the hittest function applied that runs the animation. Essentially, I am asking, "How do I make a piece of actionscript run only once", like: onClipEvent (enterFrame) {if (this.hitTest(_root.bubMC)) {play(ONLY ONCE BUT AFTER THAT DON'T DO IT AGAIN);}} : ]
KirupaForum > Flash > Flash 8 (and earlier)
Posted on: 08-24-2007, 10:34 AM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Hittest Timeline
Hello everybody, I'm new to the forum!
I've got a problem with a game I am creating, I want a movie clip to play once when my character hits it, it has a stop function at the end of the movie clip, but as long as the character is on top of it, it continues to loop, how do I get it to stop at the last frame?
Here is the script applied to the movie clip:
onClipEvent (enterFrame) {
if (this.hitTest(_root.bubMC)) {
play();
}
}
All I've been able to do was make the last frame extremely long and load an alternate movieclip without the hittest function applied that runs the animation.
Essentially, I am asking, "How do I make a piece of actionscript run only once", like:
onClipEvent (enterFrame) {
if (this.hitTest(_root.bubMC)) {
play(ONLY ONCE BUT AFTER THAT DON'T DO IT AGAIN);
}
}
: ]
Hittest Bounding Box Timeline Context
Hello all
I'm developing an isometric 3d game which is based around a skewed movie clip:
http://www.the-web-works.co.uk/clien.../test/game.fla (31k)
My problem is this: I have two square MCs (_root.board.player, _root.board.obstacle) embedded in a rectangular MC (_root.board). I have skewed an instance of _root.board on the stage, meaning I get isometric movement.
However, when I call _root.board.player.hittest(_root.board.obstacle), Flash evaluates hits of the bounding boxes of the _skewed_ MCs. In other words, it draws a bounding box in the context of the _root, not in the context of the MCs' common parent (_root.board).
This means I get a hit returned when it should not be. I was wondering if there is any way round this, other than testing _x and _y instead of using hittest.
Any ideas, ppl? Many, many thanks again!
Cav
Hittest From Root Timeline Problem
this is my code:
if (_root.crosshare_mc.hitBox_mc.hitTest(_root.tree_m c.bird_mc)){
trace("over bird")
}
This is on frame 1 in the root timeline. I'm trying to detect a hit test between 2 movie clips, the crosshare_mc is being dragged, with the hitBox_mc being a smaller movieclip inside it.
The other movieclip is tree_mc with bird_mc being inside it.
I cannot get a hittest, can anyonr help me???
HitTest A Clip On Main Timeline With Clip Inside A Clip
I've got a specific (smaller) area that I want to be what makes the collision, not the whole movie clip, so I added a layer with a movie clip on it (inside the main movie clip), gave it an instance name then put this on the clip I want it to collide with:
onClipEvent (enterFrame) {
if (_rider.riderHit.hitTest(this)) {
_root.gotoAndPlay("leftWipeOut");
}
}
"rider" is the main movie clip
"riderHit" is the instance name of the clip inside the main clip
Is what I'm wanting possible. Not sure why it's not working.
Thanks for looking. Hope there's enough information here.
jorge
How To Take Time From HitTest True To HitTest False?
hi
i have 2 MCs one is going through the other
and i want to take the time from the beginning
to the end.my code is this:
onClipEvent(load) {
this._visible = 0;
}
onClipEvent(enterFrame) {
first = new Date;
second = new Date;
indicator = 0;
if(!indicator && this.hitTest(_root.rocket)) {
indicator = 1;
sec = erst.getSeconds;
mil = erst.getMilliseconds;
begining = sec add ":" add mil;
}
if(indicator && !this.hitTest(_root.rocket)) {
indicator = 0;
seco = zweit.getSeconds;
mill = zweit.getMilliseconds;
end = seco add ":" add mill;
xposi = getProperty(_root.rocket, _x);
yposi = getProperty(_root.rocket, _y);
position = xposi add yposi;
}
}
further i want to show begining, end and position in 3 different textfields, but nothing works at all !!!
can it be, that it doesn`t work, because "this" is a symbol
in a symbol?!?
thx
bo
Hittest=false, Trying To Do The Opposite Of Hittest.
This question may have such an easy solution it might be worth for the newbies section...
I need an mc to do an action (go to a certain x point) whenever the mouse ISN'T over a particular box. So basically I would need to revert the typical
if (hitTest( _root._xmouse, _root._ymouse));
Anyone knows how to do this?
Thank you soooo much!
HitTest...creating The Opposite Of A HitTest
When I roll over a mc an enter frame triggers a function that is designed to evaluate when the mouse moves off the mc...how do you test for the opposite of a hitTest? I though in an "!", but didn't work.
PHP Code:
var buttonTarget:String = "targetMarkets_mc";
root[buttonTarget].addEventListener(MouseEvent.MOUSE_OVER, overHandler);
function overHandler (event:MouseEvent){
root[buttonTarget].gotoAndStop ("active");
root[buttonTarget].addEventListener(MouseEvent.MOUSE_MOVE, mouseEval);
};
function mouseEval (event:MouseEvent) {
if (!root[buttonTarget].hitTestPoint (mouseX, mouseY, true)) {
root[buttonTarget].gotoAndStop ("inactive");
root[targetMC].removeEventListener (MouseEvent.MOUSE_MOVE, mouseEval);
}
};
Also, how do you remove the event listener? Is there a need?
OnDrag:scroll Thru Timeline / OnRelease: How To Resume Playing The Timeline
i want to scroll thru the timeline by dragging a slider. (just like scolling thru QT) framenumber will be calculated based on slider._x.
when release slider, timeline should play from that point normally
when i stop dragging the slider, the procedure of gotoAndPlay(calculatedFramenumber)does not stop and movie sticks on that frame where slider-button was released.
slider-button-code:
on (press) {
startDrag("", false, 276.5, 331.5, 757.5, 331.5);
}
on (release) {
stopDrag();
}
slider mc-code:
onClipEvent (enterFrame) {
slideframe = math.ceil(1.892*(_x-276.5)+1908);
_root.gotoAndPlay(slideframe);
}
onClipEvent (mouseUp) {
_root.play();
}
can anyone help me on that simple issue?
Controlling A Movie Clip's Timeline Separately From Main Timeline
I've got a problem here that I've been trying to figure out for a while now, and it seems like it should be way easier than this. Here's what I've got:
I'm trying to make a neato little flash swf with lots of buttons that you can push and another little movie clip will show some little animation.
I thought I could get this done pretty simply by making a bunch of buttons, giving them an over, down, hit, sound, etc. and then having one single movie clip do all of the animations, but cleverly use stop(); and gotoandplay();
I have tried a few different ways, searched through the help & tutorials, looked all over forums on the internets, and I still can't get this to work. The main timeline is really just 1 frame, and its only purpose is to just hold all of the buttons. I have given all of the buttons instance names (ending with _btn). There is a separate layer in the main timeline for the actionscript alone, and was hoping to put all of the gotoandplay commands there. The code that I am trying to use in that frame is:
Code:
this.WV_btn.onRelease = function(){this.productzmovie_mc.gotoAndPlay(2);
};
The productzmovie_mc has a command to stop(); in the first frame, and I am trying to get a button to skip to the next frame to get it going. I put a stop(); on the last frame of that animation so that it won't run through the whole thing on the first button press. If I remove that stop(); on the first frame, the whole animation just runs whenever I test it and the button has no effect.
I thought this would be way simpler than making 25 separate movie clips and hiding them or spawning them. Does anyone know what I could be doing wrong here? This seems like a pretty simple operation, and I am probably screwing up some mundane detail (I always do that). Be gentle, I am trying to learn Flash and I am a bigtime n00b. I can post the .fla if you need to see it, but it's pretty simple so far, just lots of buttons.
Thanks!
ActionScript Differences Between Main Timeline And Movie Timeline?
Hello,
Could someone explain the difference if Action Script is on the main timeline or in a movie clips time line which is on the main timeline?
I guess I mean is with regards to referring to other items or movie clips or external scripts etc.
To try and clarify what i'm going on about....
I have a form that uses a php script. The form.swf is brought into my main movie with 'loadmovie' action script.
When the form.swf is run on its own it works. When someone enters the info and hits 'send' the form gets what it needs from the php script and then goes to a 'sucsess' frame. Great.
But..
When the form.swf is run from within my main movie and someone hits 'send' the form goes to my 'fail' frame (even though it is sending the email), the php script is returning a 'fail - invalid email entered' message to the flash form (the email was valid though!!).
Because the form.swf works on its own I'm guessing that, when loaded into the main movie, i need to add something to make it talk to the php properly.
The odd thing is that it must be talking to the php as it is sending the email!!! So why is the php sending back a 'fail' and not a 'success'.
It could be that the form.swf is just not getting a response from the php and so it going to the fail frame. In which case, if my form movie is within my main movie what do i add to the php (or action script) to receive the info to the nested movie.
I cant work it out.
Thanks soooo much for your help.
Julian
Play Movie In Timeline But Keep Main Timeline In Place
Hello,
Scenerio: You are at frame 1 of the timeline and it's stopped, you hit a button and it jumps you to frame 20 and then at frame 20 a movie clip plays.
Question. Can I have that movie play for however long I want (let's say it's a 100 frame movie) BUT have my main timeline still sit on frame 20? And then when the movie is done playing it goes to frame 21 of the main time line? Currently I have to make my main timeline be the same length as any movie I have in it, and so my main timeline ends up being an absurdly long.
Just a general answer will help - which action scripts would I be looking to use (I'm using Flash 8 Pro)?
Thanks
Playing Timeline In Reverse Mode (the Whole Timeline, Not A MC)
hi,
I have to make a flash book where you can view each page forward and backwards - as if you were actually reading the book by clicking on a next or back button depending on what you wanna do.
My problem is: I have the main timeline and all the animations are placed there without using any MCs.
i know a similar topic has been covered hundred of times on this forum, but i didn't found anything covering this specifical issue.
All topics refer to MC's placed on the timeline, but i have all my stuff on the main timeline, without any mc's, so.... i have to ask
Is there any script to make the movie, once stopped, move backwards and then stop, when it finds the stop command?????????
Help!
Thanx in advance
Mcclaine
Movie Clip Timeline Vs. Main Timeline
Ok, i have made a movie clip in Swift 3d and have imported it into Flash MX. Now it is in the first frame as flash will place it there and what i would like to have happen is to tell frame 1 that when the movie clip's timeline ends and stops(frame 90) to then move the parent timeline to continue with stuff
If any one reads this please help or refer me to a MX book that is worth the valuble time we think we have!
Mike
Child MC Timeline Controlling _root Timeline
I have a main Timeline which holds a child MC. The Child MC (text01aMC) runs to a length of 156 frames (text fades up and fades down). I'm trying to move the main time line forward one frame once the child clip has reached frame 156.
I'm using the following code:
stop();
if (_root.text01aMC._currentframe>=156) {
_root.gotoAndPlay(2)
}
This code doesn't seem to do anything?
Can anyone help.
Looping Timeline W/ Delay Swf Imported To New Timeline
I'm pretty new at this and I may be having a conceptual problem. I made a movie that loops with an action script delay. That part works fine. When I preview it plays the way I want it to with a delay before it loops again. Then I export to a swf. On my new movie I "import to library" the swf file. Then I drag it onto a keyframe on my timeline. The clip plays fine but the delay I had in the action script doesn't seem to work anymore. I'm sure there must be something wrong with the way I'm going about this. Is there some other way to delay the imported movie loop?
Thanks
Movie Symbol Timeline & The Main Timeline
Hi guys,
There is the frame in my main timeline which has a movie symbol and when the timeline heads reaches & stops at this frame & start playing the movie symbol timeline, i want that when the timeline head reaches at the end frame of the movie symbol timeline, it should take me to the any frame number/label of the main timeline i want.
I tried adding the action to the end frame of the movie symbol to take me to a different frame of the main timeline but it doesn't do anything. It remains at the same frame of the main timeline.
Is there any way out?
Regards, Rohit
Main Timeline Vs Mc Timeline Smackdown
I've made a little animation in a mc several instances of which sit looping on the main timeline.
I want these mcs to load at intervals on the main timeline, frame 1, 5, 10 etc. (a kind of twinkling stars thing if you must know.)
The problem is the main timeline overrides the mc's timeline.
I was able to sort of fix this by shortening the main timeline, but I can see this solution is not satisfactory for any number of reasons, and even at the most basic level it seems erratic.
Obviously my understanding of this issue is too theoretical and not practical enough, or the other way around.
How can I force the main timeline to really accept the mc timeline instead of just pretending to?
A Timeline Application? (NOT The Flash Timeline)
Hi All,
I'm looking for something I can use to create timelines for a web application I'm building.
When I say "Timelines", I dont mean the "flash timeline". I mean something like this: http://usfweb2.usf.edu/50/images/site/timeline-small.jpg
I've seen and used lots of handy flash chart applications, like "PHP/SWF Charts"
I'd like something just like that, but only to create timelines with.
Any ideas where to look? Google is no help cause if I search "Flash" and "Timeline" together, i get millions of results for THE flash timeline. :(
I'm willing to pay a bit for it too, so its alright if its not free.
A Value From The Main-timeline To A Moviclips Timeline
Hi!
I have a movieclip on the scene. I also have a button on the scene and when I press the button I want to send a variable-value to the movieclip. I have a variable set in the actual frame on the main-timeline but the movieclip doesn´t catch that, when traced I get undefined. Can I send a value from the main-timeline to a moviclips timeline?
A Value From The Main-timeline To A Moviclips Timeline
Hi!
I have a movieclip on the scene. I also have a button on the scene and when I press the button I want to send a variable-value to the movieclip. I have a variable set in the actual frame on the main-timeline but the movieclip doesn´t catch that, when traced I get undefined. Can I send a value from the main-timeline to a moviclips timeline?
Control Of Main Timeline From Another Timeline
Working in Flash Pro 8 (on a Mac), I've got a movie clip on the main timeline. Within the movie clip is a button which, upon pressing, reveals a series of three more buttons.
My objective here is that when you press any one of those given buttons that are within the single button that is within the movie clip an instance of which is on the main timeline that it will take you back to a specific frame on the main timeline.
I am having a devil of an unsuccessful time with the concept of connecting back to the main parent timeline from a child timeline.
Any words of direction on how this is accomplished would be, as usual, appreciated.
Christian Seaborn
seaborn.christian@gmail.com
[hitTest/Mask] Can A Mask Hide A HitTest Area?
Hi, the subject pretty much says it all. I have the following code:
ActionScript Code:
volume.onEnterFrame = function() {
if (volume.hitTest(_xmouse, _ymouse, true)) {
_root.nextFrame();
} else {
_root.prevFrame();
}
};
...and here is the link. Move your mouse under the bar and move it up slowly under the the speaker next to the number. See what happens? Keep in mind that the look is still being perfected, I was just wanting to know if there were a way I could fix the problem or do I just have to start thinking of a new look for it? Thanks in advance.
(PS: let me know what you think of the look and layout please)
Timeline With Timeline Question
I've got four movies loading in one main movie. The problem is that while some of the scripts in those movies still work (the drag button, for instance), some don't, including the close button which takes you back from the frame you're on to the first frame.
I'm guessing this has something to do with the fact that I'm making a command relating to a timeline that is now inbedded in another timeline. So, how do I keep timeline related scriptw working, while my movie is living inside another movie's timeline?
Thanks,
Matthew
Use Timeline's Frames Or Use Mc's Own Timeline?
on various sites like this one: http://www.no-tec.com/not_quite_there.html, he probably used the original timeline for motion tween and so forth.
But for me, after the preloader, when i do stuff, what i do is i dont use the orig. timeline but i use mc's own timeline to create animation.
Is this a bad way to create animation at the start?
MC Timeline & Main Timeline
Hi all,
This is going to sound very simple, but I'm having some trouble understanding exactly how the timelines work. I've tried searching online but I haven't found what I'm looking for.
I have two animated movieclips. The first one is 50 frames long and the second one is 200 frames long.
On the main timeline, I want to the first clip to play and when that has finished I want the second clip to play. But I put them onto the main timeline, each on a different layer, they play at the same time.
I understand MC's play independently of the main timeline, but I've tried placing the second MC on the 50th frame of the main time line so it will play after the first MS has finished but it doesn't work.
Placing them both on the first frame of the main timeline obviously makes them both play at the same time...
How/where would I position the animated movie clips on the timeline so one plays first then the second one plays?
Can anyone please explain this or maybe point me towards a tutorial?
Many thanks.
Use Timeline's Frames Or Use Mc's Own Timeline?
on various sites like this one: http://www.no-tec.com/not_quite_there.html, he probably used the original timeline for motion tween and so forth.
But for me, after the preloader, when i do stuff, what i do is i dont use the orig. timeline but i use mc's own timeline to create animation.
Is this a bad way to create animation at the start?
HitTest Again
hi, I'm trying to create a game that is similar to moon lander. How do I write the hitTest? I know i will have to use hitTest with the x and y coordinates but there are so many coordinates for the irregular mountain, how should I write it?? I mean it is riddiculous to write down all the coordinates manually right. So anyone knows how to write that part?
HitTest?
Ok, I have a quick question.. I've created my first game in Flash 5 and up till now when I did collision detection in Flash 4 I didn't have the option of "hitTest" so I have a question...
Does hit test check the reqtangular box that holds the movie clip, or does it test the content in the clip?
What I mean is if I have a triangle inside a one movie clip, and a circle in another does it only test to see if the Triangle touches the Circle or does it test to see if the 'outline/box' that holds the movie clips touch?
I've looked around for this answer and can't seem to find it anywhere?
If you'd like to see the game I'm working on you can see it in the games section of my half done site: http://members.aol.com/_ht_a/craigfriebolin/freqfestv2/
Thanks
- Frequent-C
HitTest() SUX
Pardon my french, but hitTest() really sux! Apart from using it for basic collision detection for a shoot out game, its useless when u really require a more precise point of impact.
hitTest() in flash sees every movie clip as a square. Now supposing your movie clip is a triangle. You movie clip only LOOKS like a triangle. It instance is actually a SQUARE!
Imagine! If your space ship is a triangle and a missile is not touching your triangle, but the SQUARE that it belongs to, you're history!
-------------------------
my $0.02 worth
Hittest
I want to use the hittest to detect collision.
When I press the left arrow I want to move my movie clip called "clip1" to left and when it hits "clip2" the movie should go to frame 100.
I know how to move the clip1, but how can I detect when it hits clip2?
Thx for any help
Hittest
anyone no how to impliment Hittest onto a MC?
i have a mc called "block12"
and mc called "playarea"
this is what iv got
onClipEvent(enterFrame){
if (playarea.hitTest("block12)){
trace ("this works");
}
}
dont work, what am i doin wrong?
HitTest
I have a nice hedgehog crossing the road and trying not to be hit by duplicate (" car" + n) random generated cars. I want the hedgehog to be squeshed if hit by a car.
This is the code I have so far but the '_root["car" + n]' bit isn't right
onClipEvent (load) {
if (this.hitTest(_root["car" + n])) {
setProperty ("/you", _yscale, "300");
}
}
anyone help?
Cheers.
HitTest
Hi,
I have two MCs in my movie. I have written code each of the MC in onClipEvent(mouseDown).I am using the hitTest function to test the click event on the MC.The problem is only the event in the second MC gets fired. If I take out the code of the second MC, then the first one gets fired.
The code is something like this
onClipEvent (mouseDown) {
_root.showdetails._visible = false;
if (hitTest(_root._xmouse, _root._ymouse,true)) {
_root.showdetails._visible = true;
_root.showdetails.countryname = "Greenland";
}
}
Please help me.
Thanks
-r-
HitTest ?
Code:
onClipEvent (enterFrame) {
if (Key.isDown(32)) {
_root.fire.gotoAndPlay(2);
if (_root.fire.hitTest(box1)) {
_root.box1.gotoAndStop(2);
}
}
}
I am trying to get box1 to gotoAndStop (2) but it will not go there. Help please.
"fire" and "box1" are instance names. All elements are on the _root.
Hittest? I Don't Think So...
I have 2 MCs name MC1 and MC2 and I want to test if MC1 hits MC2. I did it with the following code:
Code:
if (MC1.hitTest("MC2")) {
do this
}
But the thing is, if the bounding box is hit, hittest returns TRUE. Can't I check if the first MC actually hits the second MC? Like if I have 2 circles, can I have the 2 circles touching and not just their bounding box?
Any help would be greatly appreciated!=)
HitTest
hitTestI have several mc on the stage with varying names.
I want an action to happen, onClipEvent (mouseDown), that checks to see if it is over none of the mc on the stage.
onClipEvent (mouseDown) {
if (?) {
actions
}
}
I know you can insert every name in the if statement, is it possible to apply script that test all without specifying their name.
HitTest.....
Hi,
Im trying to make a simple slideover and slideback effect.
I want to have a movie clip slide over to the right when the mouse is moved over button, and then move back when the mouse is moved off the button. Here is what I have and it not working:
function slideover(clip){
if (_root[this].hitTest(_root._xmouse,_root._ymouse, true)){
_root[clip]._x+=5;
}
}
code on the movieclip button:
onClipEvent(enterFrame){
_root.slideover(ball)
}
ball is the instance name of the movieclip I want to slideover.
the problem is that both the button movieclip and the ball movie clip move to the right.
HitTest Help
Okay, I need a MC to perform a hitTest action with another movie clip inside, a movie clip. the original MC instance is named money. the other MC instance name is try. the MC instance name inside the MC instance try is called "mouth". so this is what I did to perform a hitTest, i used this code in the "money"'s action script.
if (this.hitTest(try.mouth.)) gotoAndPlay ("chew"),well that's basically what i put, it keeps telling me i need a field name or something. i'm pretty sure its the parameters that I'm screwing up on, try.mouth., but if anyone could help me, i'd be very appreciative! Thanks!-Kevin
P.S. if you need anymore details, feel free to email me at kevin@bsanimation.com
HitTest()
is there any way of setting up a hit test to be more specific than just testing the whole movie clip? for example a hit test on a darts board only detecting a hit between a dart Movie clip and its bullseye, all other areas of the dartBoard movie clip do not register hits, Ive tried putting a Movie clip inside a movie clip i.e. a bullsEye Movie clip inside the dartBoard Movie clip and coding something like :
if(hitTest(dartBoard.bullsEye))
{
some code here
}
but this still seems to register a hit for the whole dartBoard
any help on this would be really appreciated as its something that is really bugging me at the moment
Cheers ~Beedge~
Help With HitTest
Is there a way to detect a collision between movie clips without having to target them?
This is what I currently have:
if (this.hitTest( _level0.target)){
do this;
}
but I don't want to target anything specific.. basically just having the clip do something when it collides with anything.
so.. something like this (if it is possible):
if (this.hitTest()){
do this;
}
HitTest Help....=(
Hi guys,
Below is a script which I attached to each individual piece of puzzle for my simply drag n drop puzzle game. Utimately, I would like to snap the puzzle piece to its corresponding location if a player drags it close enough to the proper place and a "click" sound will play to signal the player that "he got it". However, I can't seem to get the hitTest running correctly. Is there something wrong with my x, y coordinates or my logic is totally incorrect? Any hints or help is greatly appreciate.
onClipEvent (mouseDown) {
this.startDrag(true);
if (this.hitTest(180, 140, true) || this.hitTest(165, 125, true)) {
snap.start();
this._x = 175.2;
this._y = 136.8;
}
}
onClipEvent (mouseUp) {
this.stopDrag();
}
HitTest
I've got a movie clip of a ball that is bouncing around the screen using the code below within the clip. I want to make a second instance of the ball and detect collision between the two instances, if a collision is detected then the instances should reverse direction of travel in other words if they collide they bounce of each other. I've racked my brain with this and still get confused/syntax errors! Anyone able to help me?
Code:
onClipEvent (load)
{
dx = 4;// set the initial momemtum of the ball
dy = 4;
}
onClipEvent (enterFrame)
{
_x += dx; //move the ball along dx and dy
_y += dy;
if (_x < 0)
{
_x = 0; //move it back on screen
dx *= -1; //reverse the horizontal momentum
}
else if (_x > 550)
{
_x = 550; //move it back on screen
dx *= -1 //reverse the horizontal momentum
}
if (_y < 0)
{
_y = 0;
dy *= -1;
}
else if (_y > 400)
{
_y = 400;
dy *= -1;
}
}
I tried adding an extra if statement to the end of the code
Code:
if (this.hitTest(ball2))
{
dy *= -1;
dx *= -1;
}
but it didn't work.. I know there should be some other stuf f in there too.. any help greatly appreciated.
HitTest Help
I've made a simple maze game that works fine.
Problem is, when I try to import the .swf into another .swf, my hitTest doesn't seem to work.
Take a look:
http://www.punchpuppet.com/maze/maze.html
works fine, but
http://www.punchpuppet.com/maze/load_maze.html
It's the same game. In load_maze.html, I've simply created an MC, and used loadMovie to import the .swf. I've also resized the game to 75%.
Here's my hitTest code:
if (Key.isDown(Key.LEFT)) {
kids._rotation = 0;
kids._xscale = -100;
kids._x -= 3;
if (this.maze.hitTest(this.kids._x, this.kids._y, true)) {
kids._x += 3;
}
} else if (Key.isDown(Key.RIGHT)) {
kids._rotation = 0;
kids._xscale = 100;
kids._x += 3;
if (this.maze.hitTest(this.kids._x, this.kids._y, true)) {
kids._x -= 3;
}
} else if (Key.isDown(Key.UP)) {
kids._rotation = -90;
kids._y -= 3;
if (this.maze.hitTest(this.kids._x, this.kids._y, true)) {
kids._y += 3;
}
} else if (Key.isDown(Key.DOWN)) {
kids._rotation = 90;
kids._y += 3;
if (this.maze.hitTest(this.kids._x, this.kids._y, true)) {
kids._y -= 3;
}
Any help would be appreciated.
Thanks.
HitTest Help Please
Hi Everyone,
I want to write an hitTest code for the following.
I have 2 Movie clips.
1.myBall1
2.myBall2
What i want it to do is when i drag myBall1 over myBall2 it will stay on top of myBall2 and stop dragging and vica verca.
Thanks In Advance!
Blue Dragon
VERY EZ HITTEST PLEASE HELP
i am trying to build very simple hittest but i am getting stuck. The main thing i am trying to do is give the hitTest every ez actions. what i did was built two Clips, and when the one clip that is attached to the mouse, then hits the other clip= i just gave it _root.clip.gotoAndPlay(1);. but it is not working right i have more then one clip i want to use this for i did in two but it only works in on clip. i am trying to get the same felling as http://www.directiondesign.nl/index.html.
if you want to look at what i have done please feel free http://www.lyfted.com/site/Lyfted_vo.1.swf
i hope this make sense
Thank you.
Ryan
HitTest
I was wondering how I could use HitTest to detect collisions, among the moving movieclip. And any other clips by giving the static clips a certain propertie or sumtin.
I hope I made myself clear... Thanx
Some More Hittest...
If you have a hittest thing like:
movie x.hittest(movie y)
when you have this, how do you get it to check if movie x is touching movie y and then do something, like go to frame 10???
eg. If true, gotoandplay frame 10
or wotever it would look like
|