dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Working Box For All to Use

  1. #1
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473

    Working Box For All to Use

    yeh so I wanted to make an object that your character couldnt touch and I asked the forum for an easier way in a thread "Moving Question, Stop ME". Well I got a reply that was good but unfourtunatly the script had many errors that I created from his answer. It was easier just to make this scrip (check downloads at bottom). Well, its pretty simple but it's a real pain to make so I thought that someone might enjoy using it in rpgs as like a rock or something.
    Attached Files Attached Files
    BC

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    You might want to consider making that a function so you can call it with more than on object

  3. #3
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    what do you mean? How would I do this?
    BC

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Well you have to look at what you've done and see if you can pass the variables to it. Other wise you have to enter all that code again for each object you want to check.

    Simplified Example:
    //Get a couple of elements to work with

    box=element("box1");
    rectangle=element("box2");

    Dude=element("dude")

    function checkcollide(el,el2){//When you call the funtion you pass 2 elements
    if el.element.collide(el2){
    return true;
    }else{
    return false'
    }
    }//end funtion

    then you can call it like
    test=checkcollide(dude,rectangle)
    test||checkcollide(dude,box)

    then if dude is colliding with either one test will equal true

  5. #5
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    by the way another way to go is to put this code in the object box itself and replace all references to box to "this" and then clone the box and they all will inherite the code for themselves.

  6. #6
    Game Master ConnELITE's Avatar
    Join Date
    Apr 2005
    Location
    United States, DC
    Posts
    473
    yeh i get what your saying and the cloning thing is way easier I think, thanks.
    BC

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