I'm currently making a game and the visuals are on one layer in my 'back' movie clip, and my blocks for the collisions in the layer below.

Is there any way to hide the collisions layer, so it doesn't show up in the SWF but the player still collides with it? If I just put alpha = 0 or visible = false in the actions on the layer, it hides all of my background and my character is on nothing.

Any suggestions? Thanks in advance!

有帮助吗?

解决方案

Is there any way to hide the collisions layer, so it doesn't show up in the SWF but the player still colides with it?

To be honest, layers don't really matter a whole lot when it comes to code. It just helps you visually sort out content and organize matter. That having been said, let's say that your instance name for the collision blocks is "collision_blocks". All you have to do is type:

collision_blocks.visible=false;

instead of

visible=false;

I hope that is making sense. Instead of setting the whole layer invisible, you code the particular content you wish as invisible.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top