AdamRyanGameDev Posted March 27, 2018 Share Posted March 27, 2018 Probably more of an issue with my js knowledge but how can I pass a parameter, for example here one of the sprites? (edited version of the lab, https://labs.phaser.io/edit.html?src=src\time\timer event.js ) function update() { atlasFrame.rotation += 0.01; singleImage.rotation += 0.01; let timedEvent = this.time.delayedCall(3000, stopRotation, [], this); } function stopRotation(spriteName){ let spriteNamehere = spriteName; window[spriteNamehere].rotation=0; } Link to comment Share on other sites More sharing options...
rich Posted March 27, 2018 Share Posted March 27, 2018 That empty array you pass in after stopRotation? That's an array of arguments that are passed to the callback AdamRyanGameDev 1 Link to comment Share on other sites More sharing options...
AdamRyanGameDev Posted March 28, 2018 Author Share Posted March 28, 2018 Thx Rich! I tried that in the labs but it didnt work hmmm I will have another look! Prob did something stupid! Thx again! Link to comment Share on other sites More sharing options...
AdamRyanGameDev Posted March 28, 2018 Author Share Posted March 28, 2018 UPDATE: i tried just for double sure both the following lines let timedEvent = this.time.delayedCall(3000, stopRotation, ['atlasFrame'], this); let timedEvent = this.time.delayedCall(3000, stopRotation, [atlasFrame], this); As per code in OQ, but in both cases it stops ALL rotations, not just the nameString/object passed to it... [which should be passed?] Link to comment Share on other sites More sharing options...
Recommended Posts