Ninjadoodle Posted September 14, 2014 Share Posted September 14, 2014 Hi guys Coming from Flash, I'm used to writing a function and then adding an Event Listener to a sprite. I understand how to make a sprite that responds to clicks/taps in Panda ... ninja.click = ninja.tap = function() {// do something}ninja.interactive = true; But, what if I have 20 ninjas and want them all to use the same function and don't want to rewrite it 20x? Is there a different way to attach a click/tap function to a sprite? Thank you in advance for any help Quote Link to comment Share on other sites More sharing options...
Sebi Posted September 14, 2014 Share Posted September 14, 2014 function doSomething() { // do something }; ninja.click = ninja.tap = doSomething; ninja.interactive = true; Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted September 14, 2014 Author Share Posted September 14, 2014 Hi @SebastianNette Awesome! Thank you for your help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.