View Full Version : Help
FLASH-MX
11-23-2004, 10:59 PM
Well as you guys know or may not know, I am making a FPS game and so far its pretty damn good in the visuals but i got a problem in the script.
1. Its a machine gun and i cant find any kind of mouse code that when you hold the button, the mc keeps playing and when released it you know stops.
2. The crosshair goes next to the gun's actual reach and it makes it look like a third rate job, however i think i can fix it by making the screen scroll.
Any help will be included in creds. Thanx Yall!
arkhan
11-24-2004, 08:39 AM
to have the shooting efect, you can try putting a big invisible butom that you can press from anywhere on the screen..so on press it will shoot..
FLASH-MX
11-24-2004, 09:04 AM
i tried that but when i put in enemies, when you shot them the shooting part played but not theyr death
eatmorchikin6464
11-24-2004, 09:36 AM
Well, that's because the enemy button is below the invisible button. Change the layers around to correct it. Then on the enemy button, make the same thing happen on the invisible button, so that when you click on the enemy, the gun will shoot and the enemy will die.
arkhan
11-24-2004, 12:37 PM
the enemyes dont have to be butoms..just check if the shot is in the enemyes area..it can be a MC
eatmorchikin6464
11-24-2004, 12:59 PM
It's alot easier if they are buttons however.
Nexus
11-24-2004, 02:23 PM
A simple way of implementing this feature is creating event handlers for the mouseDown and mouseUp events of _root (an event handler is basically a function). In the mouseDown event handler you would set some made up variable like mouseIsDown to true, and in your gun movieclip you could have an if statement that makes the gun "fire" if mouseIsDown is equal to true. On the mouseUp event handler just change the variable back to false.
Example: (Try it. Hold down the mouse for a second, and then release it)
_root.onMouseDown = function() {
_root.mouseIsDown = true;
trace("Mouse Down");
};
_root.onMouseUp = function() {
_root.mouseIsDown = false;
trace("Mouse Up");
};
vBulletin® v3.7.3, Copyright ©2000-2010, Jelsoft Enterprises Ltd.