Click to See Complete Forum and Search --> : Working Box For All to Use
ConnELITE
08-06-2005, 07:08 PM
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.
blanius
08-07-2005, 12:12 AM
You might want to consider making that a function so you can call it with more than on object
ConnELITE
08-07-2005, 12:30 PM
what do you mean? How would I do this?
blanius
08-07-2005, 03:29 PM
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
blanius
08-07-2005, 03:30 PM
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.
ConnELITE
08-08-2005, 02:00 AM
yeh i get what your saying and the cloning thing is way easier I think, thanks.
flashkit.com
Copyright WebMediaBrands Inc., All Rights Reserved.