Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default [Flash] Quick question +rep

    What is wrong with my code?
    PHP Code:
    onClipEvent (load) {
        var 
    weaponz 0;
        var 
    taken 0;
    }
    onClipEvent (enterFrame) {

        
    // make the weapon
        
    if (taken == 0) {
            
    _root.weapon.duplicateMovieClip("weapon"+weaponz,weaponz);
            eval(
    "_root.weapon"+weaponz)._x 161;
            eval(
    "_root.weapon"+weaponz)._y 280;
            
    taken == 1;
        }

        
    // a basic hittest   
        
    if (this.hitTest(_root.ball)) {
            
    this.removeMovieClip();
        }

    It kind of works, it will draws the item i need drawn but then nothing else happens?

    I need it so it only draws ONE box, not an infinite ammount..

    I thought if i change the "taken == 1" to "taken = 1" it would work, but it always shows "0 0 1 0 1 0" in the output (a space represents a new line)..


    + rep to whoever helps

  2. #2
    Join Date
    Jul 2005
    Location
    Belgium
    Posts
    2,492
    Tokens
    147

    Latest Awards:

    Default

    Try the following.

    Also:
    When you stated: taken == 1; it will ofcourse not work.
    a double == means it will check if something is equal to something else.
    a single = means you give a new content to ex. a variable.
    and += means you add something to whats already in the content. (ex counting up)
    and -= will do the same but withdraw something (counting down)



    PHP Code:
    onClipEvent (load) {
        var 
    weaponz 0;
        var 
    taken true;
    }
    onClipEvent (enterFrame) {

        
    // make the weapon
        
    if (taken == true) {
            
    _root.weapon.duplicateMovieClip("weapon"+weaponz,weaponz);
            eval(
    "_root.weapon"+weaponz)._x 161;
            eval(
    "_root.weapon"+weaponz)._y 280;
            
    taken false;
        }

        
    // a basic hittest   
        
    if (this.hitTest(_root.ball)) {
            
    this.removeMovieClip();
        }


  3. #3
    Join Date
    Oct 2005
    Location
    Melbourne, Australia
    Posts
    7,554
    Tokens
    0

    Latest Awards:

    Default

    That didn't work.. it does not get "picked up"

Posting Permissions

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