A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: using function for coded mcs[help]

Hybrid View

  1. #1
    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.

  2. #2
    Say hello to Bob Kakihara's Avatar
    Join Date
    Jul 2004
    Location
    kent, England
    Posts
    1,067
    Ill give it a go, I dont think it will give me the fps im looking for though so ill try another couple of things first.

    Thanks anyway im sure it will come in handy for other projects.
    If our body is a clock ticking away and if while we experience all that this world has to offer time has still continued to pass, are we living or just experiencing a slow death?

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