dcsimg
A Flash Developer Resource Site

Results 1 to 15 of 15

Thread: How do you hide a cloned movie element?

  1. #1
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    How do you hide a cloned movie element?

    ok one of the users on this board helped me with cloning a movie element.

    ok the movie element i cloned was an asteroid.

    I have 5 astroids in my game.

    I have a ship that shots a bullet upwards.

    This is the code i have used for all my other games concerning hiding an object after collision:

    astroid=element("astroid")
    bullet=element("paint 207")

    if(astroid.collideRect(bullet))
    if(astroid.hide())
    if(astroid.position.x=-999)
    if(astroid.position.y=-999)
    }

    ok well its not working with this one because well im not sure but the bullet goes through the asteroids. Maybe it cant hide it because its a clone or a movie element.

    Could someone help me figure out a way to hide the cloned movie element ("astroid")

    If you need me to make an attachment of my game in progress i can, but otherwise, please send a message of help as soon as possable.

    thanks

  2. #2
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    astroid = element("astroid").clone()
    astroid.hide();
    visit my homepage -> ejected.de

  3. #3
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    so my code cant be this:

    astroid = element("astroid").clone()
    bullet=element("paint 207")

    if(bullet.collideRect(astroid))
    if(astroid.hide())


    what shold it be, because with this code, when i view my game from my site, everything slows down for some reason and this one astroid looks all funny.


    Do you have a different code?

  4. #4
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    this should work...

    PHP Code:
    astroid element("astroid").clone();
    bullet element("paint 207");

    if (
    bullet.collideRect(astroid)) {
        
    astroid.hide();
        
    bullet.hide();
        
    playSound ("Boom");

    visit my homepage -> ejected.de

  5. #5
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    somethings wrong

    somethings wrong, well i gatta go, but everythings acting weird lol

  6. #6
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    well

    well... one min ill try to get stuff to work
    Last edited by sonic04; 02-15-2005 at 06:32 PM.

  7. #7
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    file

    can u help me make it so that when my bullet hits the cloned astroids they hide? i cant seem to get it to work, i think its because im used to dealing with paint elements, not movie elements.

    ahh jeeze, i cant upload the file i need to convert it to a zip format.

  8. #8
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299

    Re: file

    Originally posted by sonic04

    ahh jeeze, i cant upload the file i need to convert it to a zip format.
    just use winzip or winrar to compress the file as a .ZIP. then you be able to upload it.
    visit my homepage -> ejected.de

  9. #9
    A Senior Newbie - How Odd ForumNewbie's Avatar
    Join Date
    Mar 2003
    Posts
    590
    It may just be a typo in the post, but remember:

    In an 'if' statement, you must remember that it's == and not = .eg.

    if (bob=sue)
    {
    terry=june
    }

    Will set bob to be equal to sue, which you don't want, whereas :

    if (bob==sue)
    {
    terry=june
    }

    Will set terry equal to june, if bob equals sue, which is what I think you want.

    Hope this helps,

    Morgan.

    Note: Edited because I accidentally hit tab then enter when typing the script, therefore it posted before I'd finished the example. Jeez Lopez you're quick
    Last edited by ForumNewbie; 02-15-2005 at 07:03 PM.
    Please note that my domain has changed to http://www.morganmultinational.com

  10. #10
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    Originally posted by ForumNewbie
    Remember:

    if (bob=sue)


    no it's:

    PHP Code:
    if (hell==earth) {
        
    girlfriend=zombie;

    visit my homepage -> ejected.de

  11. #11
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    lol lol


    thanks

  12. #12
    Senior Member
    Join Date
    Feb 2005
    Posts
    177

    o jeeze

    o jeeze, well lopez, you know how u made my the sample of the clone movie? I know its a lot to ask for in all, but do you think you could use that movie and make a basic ship and basic bullet that when the bullet hits the astroid clone it hides the astroid?

    im not saying you have to do it now, but if u ever had spare time it really help me. Im afraid im getting off on the wrong track and if you give me a good example of just some cloned astroids and a ship and a bullet, that would help me get back on the right track if i can look at what you did.

    i just dont understand, ive made other games using my collide code before and the objects hide when collision happened, but i was dealing with all paint elements and no clones. I guess using movie clips and clones is a little different.

    Well id really appreciate it if you could make this little mini game for me, but if you cant ill understand.

    thanks
    Last edited by sonic04; 02-15-2005 at 10:16 PM.

  13. #13
    Senior Member lopez1_de's Avatar
    Join Date
    Oct 2001
    Location
    Germany
    Posts
    299
    here is a full example which clones astroids and bullets/projectiles and have a collsion between them

    this is a little mini game. can you destroy all astroids.

    (every next question will cost an ammount of 10$)
    Attached Files Attached Files
    visit my homepage -> ejected.de

  14. #14
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Originally posted by lopez1_de

    (every next question will cost an ammount of 10$)
    Don't I wish!

  15. #15
    Senior Member
    Join Date
    Feb 2005
    Posts
    177
    lol

    its ok i know all i need to know...

    for now lol

    but thanks seriously.

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