QLNEO Posted December 7, 2017 Share Posted December 7, 2017 Please take a look at the two following pieces of code: // Form 1 paddle.events.onDragStart.addOnce(ball.setMovement, ball); // Form 2 paddle.events.onDragStart.addOnce(function() { this.setMovement(); }, ball); Technically these two should be the same. But, for some reason, the first variant isn't quite working according to the plan. In fact, ball is being sent as an argument to .setMovement() instead of being the context, as the docs make me think it should be. The second form works as expected, ball being treated as this. Is this a bug, an example of badly explained documentation or I'm missing something obvious? Link to comment Share on other sites More sharing options...
samme Posted December 7, 2017 Share Posted December 7, 2017 The context (this === ball) should be the same in both forms. The difference is that the second form omits the signal's own arguments, including sprite === ball. Link to comment Share on other sites More sharing options...
Recommended Posts