dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Help with game

  1. #1
    Junior Member
    Join Date
    Aug 2005
    Posts
    4

    Help with game

    Hi. i am fairly new to 3dfa and javascript and i would like some help with a game i am creating. the game consists of targets that when are shot will blow up. what i would like to do is have an animated target that will clone and fly accross the screen every few seconds at a rondom y position. i have written this in the starting script which clones the target "Bird3" 15 times.

    myBird = element ("Bird3")
    Bird3_array = new Array (15)
    for (n=0; n<Bird3_array.length; n++){
    Bird3_array[n] = myBird.clone ()
    Bird3_array[n].y = random
    Bird3_array[n].show()
    }

    i have come accross a few probelms with this.
    1. i have written random becuase i do not know the correct script to make the element appear at a random y position. i have tried a few scripts i have found on this forum to make elements appear at random position however none of these work
    2. i would like to know how to make each of the clones appear at intervals and not all at the same time
    3. if possible i would also like to make it so that these cloned elements will appear at random intervals of either 1,2 or 3 seconds

    thanks in advance for your help
    Sterny

  2. #2
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    heres a code that shows how random numbers work

    beers[y].y=root.randomRange(10,50)
    beers[y].velocity.y=root.randomRange(40*level,100*level)
    }

    if you want it to wait a couple of seconds before the next one comes out go under "events" and select delay time and you can work with that. If you want a traget to come after the first target is destroyed therer are many options to do that. I;m kinda busy so I dont have time to explain. tell me if this helps at all.
    BC

  3. #3
    Junior Member
    Join Date
    Aug 2005
    Posts
    4
    thank you for your help. i have tried this however when i start the game it comes up with an error saying that randomRange has not been found. am i right in saying that beers[y] should be replaced by the name of my element?
    Last edited by Sterny101; 08-08-2005 at 04:53 AM.

  4. #4
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    oh sorry i was busy when i was writting this but here look at this game that I got that from, it should help. Youll need to replace some of the pictures first thogh. Like it will say that the beers are missing so just go into the 3dfa animator libray and find the beer icon, do as need thoughout the game. Just look at the main code and starting script for answers. I tried making so the beers would go left to right instead of up to down but i had problems, maby you can fix it.
    Attached Files Attached Files
    BC

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    LOL randomRange is one of my functions. You have to have the function to do random numbers that way.

  6. #6
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    oh haha, yeh i forgot that was your game
    BC

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