The Enchanted Cave 2
Delve into a strange cave with a seemingly endless supply of treasure, strategically choos
4.36 / 5.00 33,851 ViewsGhostbusters B.I.P.
COMPLETE edition of the interactive "choose next panel" comic
4.09 / 5.00 12,195 Views...
At 5/2/09 07:17 PM, Blue-Devil23 wrote: You need to be more speific
Shape Flash hitTesting - maybe it's that
At 5/2/09 07:17 PM, Blue-Devil23 wrote: You need to be more speific
I get the gist of what he's saying :/
The syntax for a shapeFlag hitTest is just:
AS2:
hitTest(x:Number, y:Number, shapeFlag:Boolean);
AS3:
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean);
In each case, the x and y values represent a point (annoyingly in the main stage co-ordinate system, so either translation or a method like localToGlobal are needed if you're using co-ordinates in the reference frame of another object).
shapeFlag should be set to true if you want the collision detection to be against the actual shape. Setting it to false does the detection against the clip's bounding box (rectangle) instead, providing a performance increase where accuracy isn't required (although I believe an object-to-object detection may outperform it).
In each case, the x and y values represent a point (annoyingly in the main stage co-ordinate system, so either translation or a method like localToGlobal are needed if you're using co-ordinates in the reference frame of another object).
shapeFlag should be set to true if you want the collision detection to be against the actual shape. Setting it to false does the detection against the clip's bounding box (rectangle) instead, providing a performance increase where accuracy isn't required (although I believe an object-to-object detection may outperform it).
can you explain a little further? what does booleen mean? do i just type in numbers for x and y or is there something else? can i have an example?
...
well the x is any x point. it can even be a variable. the most common for both x and y is some type of object's x and y
EG
obj1.hitTest(obj2._x, obj2._y, shapeflag:Boolean)
you can even do maths in there
EG
obj1.hitTest(obj2._x-50, obj2._y+10, shapeflag:Boolean)
this is usually used for if the char's feet arent at the cross hair.
The Boolean
a boolean is a variable that is either true or false
in this case, if its true it tests on obj1's shape, if its false, it cheaks on obj1's bounding box.
It allows you to test a single point against a shape. It's useful for shapes that aren't squares, like circles or other oddies. The format is this (assume the object to be tested is a circle, and we're testing it against the x and y position of a bullet.)
if(circle.hitTest(bullet._x, bullet._y, true)){
}
That's for AS2.
I WANT TO CHECK IF THE CHARS FEET ARE TOUCHING THE GROUND MC sry cpas
heres wat you ave me (changed the names)
if(char.hitTest(ground._x, bullet._y, true)){
}
do i have to change the x or y?
...
At 5/3/09 12:09 PM, micky315 wrote: heres wat you ave me (changed the names)
if(char.hitTest(ground._x, bullet._y, true)){
}
No. First off, u used char, ground And bullet? second off, this is saying (assuming u ment ground when u said bullet) that your testing your char mc to one point on the ground.
and lastly, remember, the cross hair is 0,0 on the coordinate system
At 5/3/09 12:09 PM, micky315 wrote: I WANT TO CHECK IF THE CHARS FEET ARE TOUCHING THE GROUND MC sry cpas
heres wat you ave me (changed the names)
if(char.hitTest(ground._x, bullet._y, true)){
}
Umm... You don't seem to have any idea what you're supposed to be doing there. Try re-reading... well, everything.
heres wat you ave me (changed the names)
if(ground.hitTest(char._x=0, char._y=0, true)){
}
ok how bout this then
...
no need for the =0. Just read what i said in my explaination. My examples are working perfectly!
At 5/3/09 12:09 PM, micky315 wrote: I WANT TO CHECK IF THE CHARS FEET ARE TOUCHING THE GROUND MC sry cpas
Why on earth would you post this? Does your backspace not work? Refresh button on the fritz? Only able to type a given sentance once without revision lest a collar around your neck explode Battle Royale style?
...
If you don't know what you are collision testing, you don't know what you are doing. Not knowing what you are doing can't lead to good results.
Each time someone abuses hittest, God kills a kitten. Please, learn real collision testing.