What am i doing wrong?
Hi,
I have a Variable g, which contains two combined Gravity Constants and want to find out, if the bits for gravity.CENTER_HORIZONTAL are set.
The Value of the Variable g was assigned with:
g = Bit.OR(gravity.TOP, gravity.CENTER_HORIZONTAL)
My idea was to test the Variable g for CENTER_HORIZONTAL with the following code:
If Bit.AND(g, gravity.CENTER_HORIZONTAL) = gravity.CENTER_HORIZONTAL then
...(do something)
End If
this seems to be a bad idea, my code doesn't work:
Log (Gravity.CENTER_HORIZONTAL) -> 1
Log (Gravity.LEFT) -> 3
Log (Gravity.RIGHT) -> 5
Log (Gravity.TOP) -> 48
g=Bit.Or(Gravity.TOP,Gravity.CENTER_HORIZONTAL)-> 49
Log (g) -> 49
Log (Bit.AND(g,Gravity.TOP)) -> 48
Log (Bit.AND(g,Gravity.CENTER_HORIZONTAL)) -> 1
Log (Bit.AND(g,Gravity.LEFT)) -> 1
Log (Bit.AND(g,Gravity.RIGHT)) -> 1
With Bit.And i get the same result (1) for LEFT, RIGHT And CENTER_HORIZONTAL
What am i doing wrong? How can i check variables for gravity.CENTER_HORIZONTAL?
Regards,
Joerg