So I’ve embarked on a mission to create a HUD class and I was hoping to start a discussion about some of the ways possible with FlashPunk.
I will try to detail the requirements as best I can.
- Camera Independent
- Button implementation
- Scrollable content pane (think inventory)
- Masking / clipping of scrolled content
- Selecting / dragging content from the pane
- Dropping / inserting of content into the pane
- Mouse Event bubbling (possibly related, something to think about too maybe)
My theory would use Graphiclists
to display everything and as of now would comprise the following classes:
HUD
→Entity
ScrollPane
→Entity
HUDbutton
→Spritemap
ScrollPaneItem
→HUDbutton
The HUD
class would be the main class and would instantiate the ScrollPane
class.
The ScrollPane
class would use a Graphiclist
to display the ScrollPaneItems
which will be clipped from view when scrolled outside of the defined mask
area via the drawMask
property.
The HUDbutton
class extends Spritemap
to make use of the different button states, UP, OVER, DOWN, DISABLED
and are added to the HUD
's Graphiclist
.
The ScrollPaneItem
extends HUDbutton
to make use of its mouse interactivity and adds functionality for dragging / dropping etc.
And an easy way to make sure that the game area doesn’t receive mouse events would be to pause the game and just update the needed entities, but this may not be desirable in all cases.
Thoughts? Feelings? Mixed emotions? Setting myself up for failure?