A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: Random Shots

Hybrid View

  1. #1
    Senior Member UnknownGuy's Avatar
    Join Date
    Jul 2003
    Location
    Canada
    Posts
    1,361
    This might help, if its what you want...
    code:

    //Do this when the game loads
    createEmptyMovieClip("airplanes");
    createEmptyMovieClip("bombs");
    maxtime=30

    //Do this when your creating the movies
    airplanes.attachMovie("aircraft", "aircraft" + p, p);
    airplanes["aircraft" + p].current=0
    airplanes["aircraft" + p].interval=random(maxtime)
    p++
    //Do this everyframe

    for(plane in airplanes){
    airplanes[plane]._x+=xspeed
    airplanes[plane].current++
    if(airplanes[plane].current==airplanes[plane].interval){
    bombs.attachMovie("bomb", "bomb" + p, p);
    bombs["bomb"+p]._x=airplanes[plane]._x
    bombs["bomb"+p]._y=airplanes[plane]._y
    airplanes[plane].interval=random(maxtime) }
    }

    for(bomb in bombs){
    bombs[bomb]._y+=bombyspeed
    //Do whatever actions bombs do
    }



    I think that should all work, if you need any clarfication just ask!

    Hope that Helps!

    Edit:Code Change
    Last edited by UnknownGuy; 02-23-2005 at 08:43 AM.

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