but i dont want it that fancy though. i have a battlehsip that launches torpedoes. i want the gun of the battleship to aim (not perfectly but not way off so the gn can have 8 directions instead of every direction. [ignore this if u dont know what i mean]) the gun aims near the shark and launches a torpedo.
so basically, i need the battlehsip turret to aim at the shark and duplicate torpedos and have the torpedos launched near the shark. and i need it to move toward the shark. i can take care of the hittest and all the other junk. thanks for your help, sorry it was so long to read…
how does that link help me? thats just another one of those ship games im not trying to make… i just want an mc that duplicates to another mc, and moves toward the shark.
I think you can you some _rotation and if tests to accomplish this. For example, if the shark is at 9oclock position you can check the cannon’s _rotation and its relative position from the shark. Its hard to explain in words but just do _rotation manipulations.
could u give me an example, i dont follow u that well. i COULD, could, make like 5 spaces and i could do a hittest.
if rootshark is at 1zone,
play pos of turret 1
here’s a really simple way of doing it. the turret doesn’t won’t go on the N, S, E, W lines or NE, SE… etc… because of the method i used. however, it still works well.
thast exactly what i needed! thanks i raise my hand in gratitude :hugegrin:
althgouh, it is very good and all. i am really looking for the turret to aim at a MC such as MC, “shark” . how would i change for the turret to aim at MC instead of the mouse? i might be able to fool around and figure it out but your help is always lovely
ok, i think i understand what you are saying. if what you are saying is that you have put the code:
onClipEvent (enterFrame) {
if (_root.shark, hitTest(_root.lazer_main)) {
_root.shark.play();
}
}
in the shark mc and you are wondering what to use instead of the _root.lazer_main movie clip name, then what you have to do is this:
Instead of having the shark do the hitTesting, put the hitTesting on the lazer movie clips. on the main lazer movie clip (lazer_main) add this code in the onClipEvent(enterFrame) section:
if (this != _root.lazer) {
if (this.hitTest(_root.shark)) {
_root.shark.play();
}
}
in using this method, we do not have to worry about what the lazers are called. happy coding
thank you! ill try that, thanks a lot for you help… (i renamed lazer_main to torpedo)
it wokrs, but… there is one probelm, the torpedo is supposed to explode when it reaches the shark, so when i have this code for the torpedo, it plays the torpedo on the side of the screen instead of the duplicated one…
onClipEvent (enterFrame) {
if (this != _root.lazer) {
if (this.hitTest(_root.shark) && _root.torpedo.torpedo2.eex==1) { //if it hits the shark and it is rdy to explode
_root.torpedo.torpedo2.play(); //plays explosion of the original torpedo, not the duplicated one.
}
}
}
so mainly, how would i play the explosion of the duplicated torpedo?
onClipEvent (enterFrame) {
if (this != _root.torpedo) {
if (this.hitTest(_root.shark) && this.eex==1) { //if it hits the shark and it is rdy to explode
this.play(); //plays explosion of the original torpedo, not the duplicated one.
}
}
}
I’m not sure, by looking at the code if you fully understand what i meant before, this code should go onto the main torpedo, and when the main torpedo is duplicated, it will also attack the code on the main torpedo to the duplication, therefore when you use ‘this’ it refers to the current torpedo. the first test is important, we can’t have the main torpedo explode and that is why we need to have it test to see whether it is the main or not, and if not it can hitTest().
also, duplications are placed onto the _root level, not inside the main torpedo.
I don’t full understand what you’re trying to do hear. post the fla and i’ll have a look, that is, if this doesn’t help.
is there a way where i can make it so that the mc, “t3” which is inside of torpedo2, and torpedo, be the hittest. since the torpedo with the bubbles and the explosion makes the torpedo an easy target to hit, i want to make the mc t3 inside of torpedo, and torpedo2. take a look at the .fla, if the shark touches the bubble or is like 10 pixels away from it, it still will explode. which makes it kind of a hard to avoid if your a big shark…