Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If I understand your question correctly, I guess you try to do something like "pause screen" to pop up and disable all other layers.</p> <p>Well, you said in your comment that you won't like to enable touch event in other <strong>areas</strong> but not your pop-up's area. Basically, I would think we should think in term of layer for easier understanding, and easier to implement.</p> <p>Let's see if we have "main layer" which holds other game objects to show as its childs (assume that they also are running animation). Now you touch a button and want to pop up "pause layer". You have to do the following in order to disable all touch event from others layer + objects.</p> <ul> <li>Pause layers' schedule and actions [via <em>pauseSchedulerAndActions()</em>]</li> <li>Pause all of its game objects inside the layer (ie. enemies) [via <em>pauseSchedulerAndActions()</em>]</li> <li>Disable CCMenu object (if any), this will ignore touch event on CCMenu related object ie.CCMenuItemImage [via <em>setEnabled(false)</em>]</li> <li>Disable touch event for layer itself [via <em>setTouchEnabled(false)</em>]</li> </ul> <p>The first 2 points are about stop running any schedule method, and animation. The latter 2 points are about stop accepting touch event. You can see that CCMenu* related class maintains its own touch event separately from CCLayer, thus we need to do additional effort by set to both CCMenu* object and the layer itself.</p> <p>I tried this and it works well for me. Also it's better as we don't have to involve setting dispatcher directly in my opinion.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload