A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: using function for coded mcs[help]

Threaded View

  1. #5
    Style Through Simplicity alillm's Avatar
    Join Date
    Mar 2004
    Location
    Wales
    Posts
    1,988
    Well you could give objects a go. I don't know how it will work out, but its worth a try.
    I have no idea how you create objects inside a .fla but im sure it can be done, you can use a class though.

    Just make a new action script file, and put somthing like this.

    Code:
    class bouncer {
    private var width:Number
    private var height:Number
    private var xspeed:Number
    private var yspeed:Number
    private var x:Number
    private var y:Number
    public function bouncer(w, h, xCoord, yCoord, sx, sy) {
    width = w
    height = h
    x = xCoord
    y = yCoord
    xspeed = sx
    yspeed = sy
    }
    }
    Then save that file as bouncer, and put it in the same directory as your .fla.

    That basicly just creates an object when called, which just stores all the info you need for each pretend mc.

    Then in your .fla, for each object you want, just do somthing like this.

    Code:
    bouncer1 = new bouncer(20, 20, 50, 100, 5, 3)
    then loop through all your objects and change the variables accordinly. Check for collision using the x and y positions along with the width and height.

    Hope that helps.

    Ali
    Last edited by alillm; 08-21-2005 at 05:26 PM.

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