|
-
XRave
Hittest Help Please {!}
Can anyone here suggest a code so that a Hittest is done on a finishing line and a car? P.S. The user drives the car around the track, Hitting several checkpoint(or Hittested-lines) then hit the finishing line... which stops a count-down clock.
So basically I got a car instance name "car" and 5 different lines named (L1, L2, L3... L5) and a finishing line instance: "Fini1"
Thanks for any imputs,
Merry Christmas guyz,
Tongxn
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Hey tongxn,
Here's the code for a basic hitTest. You would put the following code on your car itself:
code:
if (this.hitTest(_root.finishLine)){
trace("FINISH");
}
Now all you have to do is modify it so that it counts and makes sure all the checkpoints have been touched by using hitTests to see the car ran over them
-
XRave
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
uh oh.. I don't think it works, i put this action into the main timeline:
if(car.hitTest.c1)
//c1 is checkpoint 1
l1.gotoAndStop(5)
//l1 is the light,
is there something wrong? or should I use "_root.l1.goto....."
It's nearly finished guys I only need to get over this hurdle to complete this project!
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Hey,
A trace is just used to see if something works, it'll just display something in the output window during run time debugging. For example if you put: trace("hey"); it'll display the word 'hey' in the output window.
As for your code, if its in the main timeline it will have to look a little something like this:
code:
onEnterFrame = function (){
if (_root.car.hitTest(_root.c1)){
_root.l1.gotoAndStop(5);
}
}
Give that a try and happy new year !
-
XRave
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
No problem tongxn,
Good luck with your project
-
XRave
oh no i don't think it's properly working...
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
i can't get the function up
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
oh wait - YES! - i got it!
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|