A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Object to follow the mouse in horizontal line.

  1. #1
    Junior Member
    Join Date
    Apr 2000
    Posts
    3

    Question

    I am trying to learn Action Script. Excuse my newbieness

    I am trying to get a ship for a game to move and shoot via the mouse. I have downloaded the fla file for drag and shoot from the movies section but it's sort of like trying to learn html from scratch by picking a page and looking at it's source code with no idea of whats going on.

    The drag and shoot is pretty close to what I am looking for but I want the ship to stay on the bottom and only move left and right following the mouse and shooting on click.

    Can someone please tell me what I need to do to do this. I am asuming of course open a movie. Make a ship and make it a symbol/button so that I can add actions. If it wouldn't be to much trouble could you please explain what the different parts of the actionscript does that you post (if you post). Any and all help would be greatly apreciated.

    Thanks
    Jeremy

  2. #2
    Junior Member
    Join Date
    Apr 2000
    Posts
    21

    Post


    i also dissected the drag and shoot movie a while ago, and it can be confusing, i know. if i get some time i'll post a cleaner .fla with some comments.

    anyway, first things first.

    make a ship, and make it a symbol (button). you don't have to make it a button, but if you want to click to shoot it's a good idea to.

    then place the button into a movie clip by clicking on the ship button and pressing F8. this creates a nested button inside a movie clip.

    double click on the new movie clip and name the instance name "ship".

    double click on the first frame of the movie (or whereever you want the dragging to start), and choose Drag Movie from the action menu. choose constrain to rectange and enter values for the top bottom left right, and choose lock mouse to center.

    it should look like this

    Start Drag ("/ship", L=50, T=400, R=500, B=400, lockcenter)

    if the top and bottom are the same, it will only drag left and right, and remember the y counts from the top down, so a higher number will be lower

    hope that gets you started

    ------------------
    kennethAustin
    kenneth.austin@knowledgenet.com

  3. #3
    Junior Member
    Join Date
    Apr 2000
    Posts
    3

    Unhappy

    Thanks Kenneth but I can't seem to get it to work

    I know I am forgeting something.

    Here is exactly what I am doing:
    I open a new movie aand it has one layer. I put a frame(regular) at frame 50. I name the layer ship and then draw a square on the layer. I select the square and hit F8. Then I double click on the first frame, select the drag movie and use the actions till I get Start Drag ("/ship", L=100, T=400, R=400, B=400, lockcenter)

    I then select preview movie in html but when I try to drap or have the square follow the mouse nothing happens. Am I missing something. These are the exact steps I am taking. Am I supposed to put a play action in the first frame too or something else?

    Thanks In Advance
    Jeremy

    ------------------

  4. #4
    Junior Member
    Join Date
    Apr 2000
    Posts
    21

    Post



    ok

    easier done than said

    i'll send a .fla to you personally


    ------------------
    kennethAustin
    kenneth.austin@knowledgenet.com

  5. #5
    Junior Member
    Join Date
    Apr 2000
    Posts
    3

    Smile

    Thanks I got your mail.
    I'll tear into it when I get home tonight

    [This message has been edited by JeremyL (edited 25 April 2000).]

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