dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: velocity and comands problem

  1. #1
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272

    velocity and comands problem

    ok , ill keep that one short , i have a ball element which is start to rotate and move from on side of the screen , i want to make a script which will check its X position and if it will get to 200 make it stop ... i was trying for a several hours.. havent got to anything but a headec

    this is the scrip i was trying

    ball = element("ball")

    switch (ball.x){
    case 200 :
    ball.velocity.x = 0
    ball.acceleration.x = 0
    break;

    default :
    ball = element("ball")
    break;
    }
    Last edited by cyber reaper; 01-05-2005 at 02:46 PM.
    ok....what ?

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Case is better suited when you have many options.

    Better an If
    code:

    if (ball.x>=200){
    ball.velocity.x=0
    ball.acceleration.x=0
    }



    you need

    ball=element("ball")

    in your starting script

  3. #3
    Senior Member cyber reaper's Avatar
    Join Date
    Apr 2004
    Location
    israel
    Posts
    272
    oh thank you bret , you saved me once again , thank god my partner is a scripter , however he's new at 3DFA so it will take him some time to get the concept and changes , but at list he got some clue about whats going on in those things
    ok....what ?

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