Jump to content

Define a collision surface


PrizrakPro
 Share

Recommended Posts

OK. My answer himself.

77a9227cb488.png

surface = []surface[1] = player.body.addCircle(1,x1,y1);surface[1].sensor=true;surface[2] = player.body.addCircle(1,x2,y2);surface[2].sensor=true;surface[3] = player.body.addCircle(1,x3,y3);surface[3].sensor=true;surface[4] = player.body.addCircle(1,x4,y4);surface[4].sensor=true;surface[5] = player.body.addCircle(1,x5,y5);surface[5].sensor=true;surface[6] = player.body.addCircle(1,x6,y6);surface[6].sensor=true;player.body.onBeginContact.add(ContSurf, this);function ContSurf (body, bodyB, shapeA, shapeB, equation) {   var i = find(surface, shapeA)    if(i!=-1)	            console.log('Contact surface '+i)           }}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...