Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3696876
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:47:30+00:00 2026-05-19T04:47:30+00:00

I’ve picked up some action scripting lately and I decided to make myself a

  • 0

I’ve picked up some action scripting lately and I decided to make myself a simple bow and arrow game. So far I’ve made the arrow fly in an arced way. So up next is making my bow and being able to actually pull the string.

So far I figured I would draw the bow as an MC and use a graphic to draw the string.
I’m at the point where I should actually pull the string and I’ve got no clue how to advance from here. Any advice would be very appreciated.

If possible just give me a pointer i would like to code the thing myself, I’m not asking for a finished result.

Code:

package  {

    import flash.display.MovieClip;
    import flash.display.Shape;
    import flash.display.Stage;
    import flash.events.MouseEvent;


    public class bow extends MovieClip {
        var myStage:Stage;
        var bowString:Shape;
        var bowStringMc:MovieClip;

        public function bow(stageRef) {
            this.myStage = stageRef;

            myStage.addChild(this);
            this.x = myStage.stageWidth / 2;
            this.y = myStage.stageHeight / 2;

            this.drawBowstring();
        }

        public function drawBowstring() {
            bowString   = new Shape();
            bowStringMc = new MovieClip();

            bowStringMc.addChild(bowString);
            myStage.addChild(bowStringMc);

            bowString.graphics.lineStyle(2, 0x000000);
            bowString.graphics.curveTo(-50,this.height/2,0,(this.height-10));

            bowStringMc.x = this.x-1;
            bowStringMc.y = this.y - this.height / 2 + 5;

            bowStringMc.addEventListener(MouseEvent.MOUSE_DOWN, pullBowstring);
        }

        public function pullBowstring(e:MouseEvent) {
            // Have to start redrawing the graphic i gess but how?
        }
    }

}

Update

Thx vvMINOvv & Slomojo, both answers helped me!
I currently have 2 lines which are graphics i redraw when the bow is pulled back.

If anyone else want to see how i did it, heres a rough snipped:

    public function drawBowstring() {
        bowStringTop    = new Shape();
        bowStringBottom = new Shape();
        bowStringMc     = new MovieClip();

        bowStringMc.addChild(bowStringTop);
        bowStringMc.addChild(bowStringBottom);

        myStage.addChild(bowStringMc);

        bowStringTop.graphics.lineStyle(2, 0x000000);
        bowStringTop.graphics.moveTo(0, 0);
        bowStringTop.graphics.lineTo(0, this.height / 2);

        bowStringBottom.graphics.lineStyle(2, 0x000000);
        bowStringBottom.graphics.moveTo(0, this.height-10);
        bowStringBottom.graphics.lineTo(0, this.height / 2);

        bowStringMc.x = this.x-1;
        bowStringMc.y = this.y - this.height / 2 + 5;

        this.hand.addEventListener(MouseEvent.MOUSE_DOWN, pullBowstring);
    }

    public function pullBowstring(e:MouseEvent) {
        myStage.addEventListener(MouseEvent.MOUSE_MOVE, reDrawBowstring);
        myStage.addEventListener(MouseEvent.MOUSE_UP, releaseBowstring);
    }

    public function releaseBowstring(e:MouseEvent) {
        myStage.removeEventListener(MouseEvent.MOUSE_MOVE, reDrawBowstring);
        myStage.removeEventListener(MouseEvent.MOUSE_UP, releaseBowstring);
    }

    public function reDrawBowstring(e:MouseEvent) {
        if (this.hand.x < -18 || this.hand.x > 0) {
            this.releaseBowstring(e);
        }
        this.hand.x = mouseX;
        this.arrow.x = mouseX;

        bowStringTop.graphics.clear();
        bowStringBottom.graphics.clear();

        bowStringTop.graphics.lineStyle(2, 0x000000);
        bowStringTop.graphics.moveTo(0, 0);
        bowStringTop.graphics.lineTo(this.hand.x, (this.height / 2)-5);

        bowStringBottom.graphics.lineStyle(2, 0x000000);
        bowStringBottom.graphics.moveTo(0, this.height-10);
        bowStringBottom.graphics.lineTo(this.hand.x, (this.height / 2)-5);
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T04:47:31+00:00Added an answer on May 19, 2026 at 4:47 am

    You can use the draw class in flash. So a quick example would maybe look like this.

    myString.graphics.clear();
    myString.graphics.lineStyle(1);
    myString.graphics.moveTo(bowTopX,bowTopY);
    myString.graphics.curveTo(mouseX,mouseY,bowBottomX,bowBottomY);
    

    This would draw a line from the top of the bow, to the bottom, and curve it in the direction of where your mouse is at. You could have that code run in a function which would be called every time flash refreshes the display or something, or on mouse move. What the clear() allows you to do is clear that specific shape and redraw it, which if done at a fast enough interval will look like its being animated

    Hopefully this gives you a bit of perspective on what is possible

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I have some data like this: 1 2 3 4 5 9 2 6
I have a bunch of posts stored in text files formatted in yaml/textile (from
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.