A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: bouncing ball script problem

  1. #1
    Member
    Join Date
    Jul 2000
    Posts
    87
    Hi!
    trying to write simple bouncing ball script here...
    can't get it work..

    1st frame

    Set Variable: "minloch" = 0
    Set Variable: "maxloch" = 300
    Set Variable: "minlocv" = 0
    Set Variable: "maxlocv" = 70
    Set Variable: "mypointh" = random(5)+1
    Set Variable: "mypointv" = random(5)+1

    2nd frame

    Set Property ("/mytarget", X Position) = "GetProperty (/mytarget, _x )+mypointh"
    // same for vloc
    Go to Next Frame
    Play

    4th frame

    If (GetProperty (mytarget, _x ) >= maxloch or GetProperty ( mytarget, _x ) <= minloch)
    Set Variable: "mypointh" = -mypointh
    Set Variable: "mypointv" = -mypointv
    End If
    Go to and Play (2)


    what i am doing wrong..??
    Thank you
    Ilia

  2. #2
    Senior Member
    Join Date
    Jun 2000
    Posts
    911
    Well the first thing I see is that you have quotations around the value of your Set Property X Position...it should be an expression.

    If you could give me some enlightenment as to what some of those variables do I might be able to help you out more.

  3. #3
    Senior Member
    Join Date
    Jun 2000
    Posts
    120
    As ahab pointed out, your set property should be equated to a expression. Also you could do away with the 4th frame that checks for direction changes by putting it in a looping movie clip which constantly checks for the maxloch and minloch. I've used it in my simple pendulum experient on my page. Also why are you using randon increments?

  4. #4
    Member
    Join Date
    Jul 2000
    Posts
    87
    Originally posted by Nav
    As ahab pointed out, your set property should be equated to a expression. Also you could do away with the 4th frame that checks for direction changes by putting it in a looping movie clip which constantly checks for the maxloch and minloch. I've used it in my simple pendulum experient on my page. Also why are you using randon increments?
    Hey! Thanks guys., i just wrote it down very fast , just to show what logic is. I mean it should be very simple, just like a bouncing ball- if ball hits the ege of the stage it bounce!
    Why use random increment you ask..??-- to make it move random.. i guess.
    As to your question Ahab.
    maxloch--maximum it can go horisontal
    maxlocv--maximum it can go vertical
    minloch--minimum..................
    minlocv--................

    mypointh-- by how many points H location will be changed

    mypointv-- by how many points V location will be changed

    Thank You again
    Ilia

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