SitePoint Sponsor

User Tag List

Results 1 to 16 of 16
  1. #1
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,741
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to get something to on intervals

    I have a enemy clip and a fire clip. Now I want to make the enemy fire every once in 5 seconds, how is this achieved?

  2. #2
    Im watching you... Solitary R@F's Avatar
    Join Date
    Mar 2003
    Location
    Right around the corner..
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, a simple way to do this is by converting the fire clip to a Movie clip symbol. If your frame rate is 12 Fps, then extend that Movie clip till farme 60 (60 / 12= 5secs)
    SolitaryGrafix
    PM | EMAIL

    "Fail to Plan... Plan to Fail"--- A self-help guru

  3. #3
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,741
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought about that but I don't think it will work. I have 6 enemy spaceships flying around and I want them to fire every five seconds. I'd have to set up some kind of thing in the actionscript loop of the enemy clip.

  4. #4
    Im watching you... Solitary R@F's Avatar
    Join Date
    Mar 2003
    Location
    Right around the corner..
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wait, let me get this staright. U want all the enemy ships to fire at once every 5 secs?
    SolitaryGrafix
    PM | EMAIL

    "Fail to Plan... Plan to Fail"--- A self-help guru

  5. #5
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,741
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I can't only get one of the clips to fire.

  6. #6
    Im watching you... Solitary R@F's Avatar
    Join Date
    Mar 2003
    Location
    Right around the corner..
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, Y don U try this....
    Draw one enemy ship & animate that in a symbol... then drag that symbol on 6 different Layers on the main timeline... It'll look like 6 ships firing on 5 sec intervals..... (i think )
    SolitaryGrafix
    PM | EMAIL

    "Fail to Plan... Plan to Fail"--- A self-help guru

  7. #7
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You need to put setInterval(), just like JavaScript. This will call a function after a specific time. In that function, you can specify for all enemy ships to fire or fire in random order.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  8. #8
    Im watching you... Solitary R@F's Avatar
    Join Date
    Mar 2003
    Location
    Right around the corner..
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, asp_funda's script will work well in U'r situation
    SolitaryGrafix
    PM | EMAIL

    "Fail to Plan... Plan to Fail"--- A self-help guru

  9. #9
    Resident Boozehound simontheak's Avatar
    Join Date
    Jun 2003
    Location
    _root.europe.uk.london
    Posts
    965
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by asp_funda
    You need to put setInterval(), just like JavaScript.
    Yeah - use setInterval() with possibly some kind of a loop for you to cycle through all your ships and make them fire

  10. #10
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Solitary R@F
    Yeah, asp_funda's script will work well in U'r situation
    Solitary, I ask you not to use Chat Room Slang here at SPF, please. It doesn't look civilised.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  11. #11
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,741
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know how to make the duplicate ships fire, I've tried everything, I'll post an fla file example in a few days so you guys know what I'm working with.

  12. #12
    Im watching you... Solitary R@F's Avatar
    Join Date
    Mar 2003
    Location
    Right around the corner..
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Off Topic:


    Solitary, I ask you not to use Chat Room Slang here at SPF, please. It doesn't look civilised.
    Got that... ... just lazy to type...

    SolitaryGrafix
    PM | EMAIL

    "Fail to Plan... Plan to Fail"--- A self-help guru

  13. #13
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Solitary R@F
    Got that... ... just lazy to type...
    Then don't type. Does anyone care for your posts?


    Just joking.
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  14. #14
    SitePoint Enthusiast
    Join Date
    Feb 2004
    Location
    Canada
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Make 1 movie clip of your ship spanning 5 seconds (if it's 12 fps than make it 60 frames. Animate them firing once in that clip. When you bring it to the stage they should fire once every 5 seconds.

  15. #15
    Im watching you... Solitary R@F's Avatar
    Join Date
    Mar 2003
    Location
    Right around the corner..
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    asp_, stop typing? Nope, can't do... too addicted to SPF
    SolitaryGrafix
    PM | EMAIL

    "Fail to Plan... Plan to Fail"--- A self-help guru

  16. #16
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,741
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by slipstream
    Make 1 movie clip of your ship spanning 5 seconds (if it's 12 fps than make it 60 frames. Animate them firing once in that clip. When you bring it to the stage they should fire once every 5 seconds.
    The ship and the fire need to be two different clips, otherwise the hitTest won't work.


Bookmarks

Posting Permissions

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