PDA

View Full Version : Turret Help



kingofnukes
July 14th, 2005, 10:18 PM
I'm working on a turret for my game an I'm having a problem with it. When it's not firing it rotates when you roll over a certan button, but when firing, it stays in it's spot. how can I change my code so it will work correctly?

http://geocities.com/kingofnukes/turret.fla

There's the .fla

P.S. I'm still on a tight due date so if anyone can help, I need it asap.

kingofnukes
July 15th, 2005, 09:45 PM
If anyone can help me, I will give them credit in my game once completed.

nathan99
July 15th, 2005, 10:46 PM
i dnt get wat u want

kingofnukes
July 15th, 2005, 10:59 PM
when you shoot, the turrent wont turn. I want it to turn even if shoting.

nathan99
July 15th, 2005, 11:24 PM
Buttons are evil:P lol

Use Movie Clips instead of buttons, and replace the code with


onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
_root.gun.gotoAndStop(6);
}
}

kingofnukes
July 15th, 2005, 11:42 PM
Thanx. Is there anyway to make the turret continue shooting when you turn the it?

Blackspirit
July 16th, 2005, 01:21 AM
Helloooo.

All those movieclips on the stage, hmm. I changed that by working out mathematically which frame the turret should goto according to where the mouse is on the screen.
7 movieclips compressed to one line of code :D

ok, also its best to keep most of your code in the same place, so I fiddled and managed to stick it all in the main gun movieclip.

To make the muzzle flash work correct, i put a place holder blank movieclip to determine where the muzzle flash has to go, and then put the muzzle flash in the gun movieclip.

The problem you had before was because as you switch the turret frames, the muzzle flash would also reset....

Should all be fixed now :D

I uploaded the zip with the fla in it....
http://users.tpg.com.au/bspirit/turret.zip

Oh, also your getting to the stage of development probably where theres a huge amount of moveclips in your library. So try to group them into folders, it helps alot when your trying to find stuff. Cuts your development time down :)

kingofnukes
July 16th, 2005, 01:18 PM
Thanx, your a flash master! :thumb2: :pope: