Question about transparency

local attackHitbox = display.newRect( display.contentCenterX, display.contentCenterY, 100, 90 attackHitbox.alpha = 0
physics.addBody(attackHitbox,“static”)

Why that doesn’t work? Object Is still not transparent (I tried 1 and 0 variables)

Hi @ConveyedRex7592,

Try object.isVisible=false

Have a nice day:)
ldurniat

Does it really not work? main.lua (237 Bytes)

No, I tried that too, but rect is not transparent…

Will it collide with other objects?

Maybe you have one rect on top other one.

Maybe, I will check it now

Looks like no…
I used print and it printed “a” only one time (when I created rect)
Because I create and then delete rect after some time…

Nah, nevermind SUPER_TOKI’s code worked, I just put it in the wrong place

but I have one more question is it possible to check is object is still colliding?

Yes, of course.
If you are having problems with your main project, or need testing,
Separately, make a test by simply creating “main.lua”. main.lua (367 Bytes)

But there isn’t shown how to check if objects is still colliding…
And What does this line?
physics.setDrawMode(“hybrid”)

I interpreted your question like this: “Are transparent objects also affected by physics?”

However, since you are talking about a basic collision check, you should read and study the documentation.

You didn’t understand me correctly. I mean I want to do something like this:
When colliding:
do something
After short time
check if objects are still colliding
If yes do something,
if not do nothing

https://docs.coronalabs.com/guide/physics/collisionDetection/index.html

If you could create a small, sample project and upload it here, we could take a look and propose a fix to your problem.

  1. Don’t forget. The API reference is here: https://docs.coronalabs.com/api/
    It will answer many of your questions about what functions, etc do.

  2. Also, just in case, be aware the old site is still up so you can get to the tutorials, guides, etc. too. The guides will answer many of your questions.

Links to guides, tutorials, etc are at the top of the API page (link above).

  1. Regarding whether a collision is still ongoing, there are three collision events you can use in different ways:

In all likelihood, you probably need to combine the use of a collision listener and a timer or enterFrame listener to check repeatedly if the collision is done. I really don’t know since I’m not clear on your usage scenario.