Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. space.listeners.add(new BodyListener(CbEvent.WAKE, CbType.DEFAULT, function (b:Body) {...});
  2. space.listeners.add(new BodyListener(CbEvent.SLEEP, CbType.DEFAULT, function (b:Body) {...});
  3.  
  4. or if you only want to handle when a certain 'type' of body wakes/sleeps.
  5. var type = new CbType();
  6.  
  7. then assign that type to the bodies; and then:
  8.  
  9. space.listeners.add(new BodyListener(CbEvent.WAKE, type, function (b:Body) {...});
  10. space.listeners.add(new BodyListener(CbEvent.SLEEP, type, function (b:Body) {...});
  11.  
  12. so you only get an event when 'those' specific bodies are woken/sweffed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement