behavior plugin at:
dropbox.com/s/x46uie9isi0cvn3/SpriteButton.c2addon
sample at:
dropbox.com/s/c8coqjrda2b784w/SpriteButtonTest.capx
Latest version: 1.3
To install, just drag the .c2addon into your construct2 window, then restart Construct2.
(I don't have the rep yet to post a direct link, sorry! Will fix when I am able.)
This is my attempt at a SpriteButton behavior plugin. Just add it to a Sprite and set up which animation frames you would like to use for its normal, hover and click images. Don't forget to set the animation speed to 0 or the animation will play when the layout is first loaded.
There is an OnClick event that is fired when the user releases a touch/mouse click on the button. There will eventually be more events added for when the mouse/touch first hits a button, when hovering, etc, but the event on touch/click release is the most important, so I did that one first.
There is also a "Status" expression that is used for debugging purposes. Don't rely on any information from this, as it will definitely change depending on my needs at the moment. :)
While I am a professional C#/C++ programmer, I'm relatively new to JavaScript and have only been using Construct2 for a little while, so I'm sure there are plenty of bugs and improvements to be made. A lot of the code was copied wholesale from the DragNDrop behavior, so there may be unintended side effects of that, though I think I have a reasonable grasp of what's going on. I welcome all feedback.