A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Shooter Game Help In Flash 8

  1. #1
    Junior Member
    Join Date
    Jul 2010
    Posts
    7

    Unhappy Shooter Game Help In Flash 8

    How do you make a movie clip follow your cursor and shoot bullets with the spacebar?

  2. #2
    Flashin'
    Join Date
    Aug 2010
    Location
    Somewhere
    Posts
    9
    Create a movieClip and give it the following actions:
    Actionscript Code:
    onClipEvent (load) {
        _x = 0;
        _y = 0;
    }
    onClipEvent (enterFrame) {
        endX = _root._xmouse;
        endY = _root._ymouse;
        _x += (endX-_x);
        _y += (endY-_y);
    }
    That should make your movieClip follow the cursor.

    for the bullets you'll have to make an "invisible" movieClip and add the following actions to it:
    Actionscript Code:
    onClipEvent (enterFrame) {
        if (Key.isDown(KEY.SPACE)) {
            //code for the bullet
        }
    }

    Good luck.

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