When Object1 is at 3 pixel from object2..Possible?
I know there is this option for window's edges, but I need it for active objects. Object 2 can appears everywhere so I need it.
Example:
When Object1 is at 3 pixel from object2 destroy object 2
How can I do it?
(I don't need collision, I need this to fix a little bug in my game)
Thanks
Re: When Object1 is at 3 pixel from object2..Possi
If your objects are more or less circular, it should be easy. Just calculate the distance between the two objects, and in case the distance is smaller than a specific value, remove the object.
Check this example for finding out the distance between two objects.
However, if the objects are not very circular, and you want to detect how close the actual pixels are... then I don't know how to do it X)
Re: When Object1 is at 3 pixel from object2..Possi
Or make a second object (invisible) that is 3 pixels larger and follows your first object.
Re: When Object1 is at 3 pixel from object2..Possi
Ah, detectors... :) That works too.
Re: When Object1 is at 3 pixel from object2..Possi
Pls explain me how detectors work...
I need it in my alley cat remake
the broom has to follow the cat but when the cat creates powder around the room, the broom has to reach it and destroy it (clean) everywhere it appears and then the broom has to follow the cat again...
HOW THE BROOM FOLLOWS THE CAT
°If BROOM "X" is greater or equal or it is lower or equal to CAT "X"------> BROOM LOOKS AT X0,Y0 FROM THE CAT
°If BROOM "Y" is greater or equal or it is lower or equal to CAT "Y"------> BROOM LOOKS AT X0,Y0 FROM THE CAT
HOW POWDER IS CREATED
°When CAT object collides with "endroomobject" create powder at 0,20 from the cat
HOW THE BROOM REACHES THE POWDER
°If BROOM "X" is greater or equal or it is lower or equal to POWDER "X"------> BROOM LOOKS AT X0,Y0 FROM THE POWDER
°If BROOM "Y" is greater or equal or it is lower or equal to POWDER "Y"------> BROOM LOOKS AT X0,Y0 FROM THE POWDER
HOW THE BROOM DESTROY THE POWDER
°When BROOM object collides with POWDER object destroy it
Ok with this code the broom follows the cat and it reaches the powder when it is created but often it doesn't destroy the powder and its position stop near it , maybe it can't collide with it perfectly, I don't know really.
So I'd like to know if it is possible to destroy powder object when broom object is near 3 pixel from it.
Let me know....
Thanks