A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: if random=some number not working.

  1. #1
    Member
    Join Date
    Apr 2004
    Posts
    94

    if random=some number not working.

    Ok will I have a text box (Dynamic) called var move and I have this in the mc called cow:
    Code:
    onClipEvent (enterFrame) {
    
    
    if (move = 0) {
    cow._x = cow._x - 3
    }
    if(move=1) {
    cow._x = cow._x + 3
    }
    if(move=2) {
    cow._y = cow._y - 3
    }
    if(move=3) {
    cow._y = cow._y + 3
    }
    
    
    }
    Now the cow doesnt move or anything so I need help please. The cow was going to move which ever number it picked for random movement.

    thanks
    Smartfox server! The cheap way to make multiplayer games!

  2. #2
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    you need to use the "==" instead of just "="...so if (move==0) and if (move==1) etc

  3. #3
    Member
    Join Date
    Apr 2004
    Posts
    94
    Ah nope still not working.
    Code:
    onClipEvent (enterFrame) {
    
    
    if (move==0) {
    cow._x = cow._x - 3
    }
    if(move==1) {
    cow._x = cow._x + 3
    }
    if(move==2) {
    cow._y = cow._y - 3
    }
    if(move==3) {
    cow._y = cow._y + 3
    }
    
    
    }
    Smartfox server! The cheap way to make multiplayer games!

  4. #4
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    well the only other problem could be is your targeting...you need _root or something, maybe post your project?

  5. #5
    Member
    Join Date
    Apr 2004
    Posts
    94
    Ok project is below.
    Attached Files Attached Files
    Smartfox server! The cheap way to make multiplayer games!

  6. #6
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    ok, i fixed it...you had a couple things messed up, just look at the project, i made comments on the code...the rest should be self-explainatory, if you have any questions, feel free to IM me or email me
    Last edited by MyFriendIsATaco; 09-13-2007 at 02:20 AM.

  7. #7
    Member
    Join Date
    Apr 2004
    Posts
    94
    Originally posted by MyFriendIsATaco
    ok, i fixed it...you had a couple things messed up, just look at the project, i made comments on the code...the rest should be self-explainatory, if you have any questions, feel free to IM me or email me
    Ah thank you, works great.
    Smartfox server! The cheap way to make multiplayer games!

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