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:

1
2
3
4
5
6
7
8
9
10
11
12
13
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

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? :) (They can be invisible without any issues - a good example of this is in the Simple Pool sample code.)

views:1416 update:2011/9/28 8:56:32
corona forums © 2003-2011