A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: need help with a shooting

  1. #1

    need help with a shooting

    i have my crosshair and my bullets working with this script

    var counter:Number = 0;
    var timer:Number = 0;
    onMouseDown = function () {
    timer++;
    if (timer == 1) {
    counter++;
    _root.attachMovie("bullethole","bullethole"+counte r,_root.getNextHighestDepth());
    eval("bullethole"+counter)._y = _ymouse;
    eval("bullethole"+counter)._x = _xmouse;
    timer = 0;
    }
    };


    the code works fine but now i was wondering how do i get it to change from bullethole to shotgunhole

    eg i have a image of a handgun and shotgun you click the handgund you get to shoot it now click the shotgun and the bullets will shange when you click to shotgun holes and same for other weapons


    also how do i get it to rapid fire from holding mouse
    The one that smiles when things go wrong, Has thought of someone to blame it on

  2. #2
    Member
    Join Date
    Jun 2007
    Location
    Cleveland, Ohio
    Posts
    56
    Quote Originally Posted by hopies

    var counter:Number = 0;
    var timer:Number = 0;
    onMouseDown = function () {
    timer++;
    if (timer == 1) {
    counter++;
    _root.attachMovie("bullethole","bullethole"+counte r,_root.getNextHighestDepth());
    eval("bullethole"+counter)._y = _ymouse;
    eval("bullethole"+counter)._x = _xmouse;
    timer = 0;
    }
    };
    make a shotgunhole movie, and just add this code to your shotgun where you had it on your regular gun.

  3. #3
    i have the code on a first dot first frame on timeline and goes all the way to frame 17 i want that code to now change when i click the image of a shotgun but how to i get it to change

    for example

    if i click the image of handgun i shoot hand gun now same with shot gun

    if i use the code twice i get both shot gun and hand gun bullets at the same time
    The one that smiles when things go wrong, Has thought of someone to blame it on

  4. #4
    i fxed what i wanna do thannks for ya help now could you help me make it riped fire?
    The one that smiles when things go wrong, Has thought of someone to blame it on

  5. #5
    M.D. mr_malee's Avatar
    Join Date
    Dec 2002
    Location
    Shelter
    Posts
    4,139
    use an enterFrame with mouseDown
    Code:
    var counter = 0;
    var pressed = false;
    
    onEnterFrame = function(){
    
    if(pressed) shoot()
    
    }
    
    onMouseDown = function(){
    
    pressed = true
    }
    
    onMouseUp = function(){
    
    pressed = false
    }
    
    function shoot(){
    
    counter++
    
    if(counter % 3 == 0){
    
    var bullet = _root.attachMovie("bullethole","bullethole"+counte r,_root.getNextHighestDepth());
    bullet._y = _ymouse;
    bullet._x = _xmouse;
    }
    }
    lather yourself up with soap - soap arcade

  6. #6
    tanks for ya help mr malee its working now it rapid fires yeah!!

    thanks very much

    will remember for credit

    respect

    be at peace
    The one that smiles when things go wrong, Has thought of someone to blame it on

  7. #7

    now the hittest dont work

    how do i get the hit code to now work with the above code?

    i tryed allsorts and it still dosent work

    please help

    thanks
    The one that smiles when things go wrong, Has thought of someone to blame it on

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center