javascript - How to get member variables in collision detection functions? -


i working on side scrolling game , using cocos2djs framework that. trying build collision detection functions, hit bump.

i want update hud information regarding player's health, when collision occurs, however, not able access member variables inside these functions reason.

this collision handler (i use chipmunk physics)

this.space.addcollisionhandler(pape,                                obstacle,                                this.collisionobstaclebegin,                                null,                                null,                                null); 

i handle collision detection here addcollisionhandler:

addcollisionhandler: function() {     cc.log(this.healthstatus); } 

but console shows this.healthstatus undefined, though defined , has been used setting hud earlier in init function. can me out?

i found mistake, forgot bind collisionobstaclebegin...


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -