Certain Collision

Hi,

I have an object called “test” which doesn’t have a settle opacity it is constantly changing from 0 alpha to 1. In my collision i want to state that if the alpha of test is 0 not 1 then ball removes self. I’ve been adding “if”/“and” test.alpha = 0 “then” ball:removeSelf(), but no luck.

Thanks so much!

Collision:

[code]

ball.myName = “ball”
test.myName = “test”

ball:addEventListener(“collision”, ball)

function ball:collision (event)
– How can i state, only if alpha = 0 then collision works?
if event.other.myName == “test” then

– I want to add IF the alpha of test = 1 THEN ball remove self. But im not sure how to do that?

end
end
[import]uid: 66985 topic_id: 13224 reply_id: 313224[/import]

Hey there,

If it’s set to 0 it wont be visible so it wont be colliding with the ball - have you considered making it a sensor? :slight_smile: (They can be invisible without any issues - a good example of this is in the Simple Pool sample code.) [import]uid: 52491 topic_id: 13224 reply_id: 48567[/import]