So far I am very impressed with Construct2. I would like to make a "SpriteButton" plugin (I know some are available, but this is for learning how to make plugins)
I currently have a project that does what I want, I'm just not sure about the best way to make it a reusable component.
My "manual method"
Create a Sprite, set up image to have 3 frames (normal, hover, pressed) and define those frames in the sprite animation window.
defined the following events:
mouse: Cursor is over (sprite) --> (sprite) set animation frame to 1
mouse: Cursor is not over (sprite) --> (sprite) set animation frame to 0
touch: isTouching (sprite) --> set animation frame to 2 (& my game-specific actions)
with touch enabling mouse input, this works for what I want. So, on to the detailed questions:
If I want to make this a reusable component, would it be better to make it a behavior that is attached to a sprite, or a new object type?
With the expectation that every "SpriteButton" would have the same frames defined in the same order in the source image, the goal is to have the plugin automatically set the right frame without any further action from the user other than selecting the source image. Then, it would define its own event(s), such as SpriteButton:IsPressed to do the game logic. Is this the right way to design this? I am happy to look at the existing behaviors/plugins to do the low-level coding (I am reasonably adept at JS) but would like to ensure that I'm starting out on the right foot.