Skip to content

Commit

Permalink
Update 18.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Gurigraphics authored May 3, 2018
1 parent 0fcb0fc commit a006a4f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tutorials/18.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Game.touch = cc.EventListener.create({
console.log( "touch ");

Game.removeItemById( "tag_1" );

//Game.removeItemsByType( "box" );

Game.removeItemByTouch( touch, event, "box" );
}
Expand All @@ -42,6 +44,22 @@ Game.removeItemById = function( id ){
}
}
```

**Remove items by type**
```Javascript
Game.removeItemsByType = function( type ){

for( var i = coliders.length - 1; i >= 0; i-- ){
if( coliders[i].name == type ){
layer.removeChild( coliders[i].image );
world.removeBody( coliders[i].getBody() )
world.removeShape( coliders[i] )
coliders.splice( i, 1 );
}
}
}
```

**Remove item by touch**
```Javascript
Game.removeItemByTouch = function( touch, event, type ){
Expand Down

0 comments on commit a006a4f

Please sign in to comment.