I am trying to create a transparent sprite programmatically, so I can use it to create "hot spots" that users can click or tap. I could of course use a graphics program, but being able to create it through code would make my life a little bit easier.
It would also be great if I could use the boundingBox_ function to draw a border for it, so I can see where it actually ends up during debugging.
I tried to create an empty Sprite and a corresponding SceneObject like this:
this.instructionsClickSprite = new Sprite(null, this.layers.playfield);this.instructionsClickSprite.setSize(240, 26);this.instructionsClickSprite.setDrawFunction(wade.drawFunctions.boundingBox_(0,0,this.instructionsClickSprite.draw));this.instructionsClickObj = new SceneObject(this.instructionsClickSprite);wade.app.instructionsClickObj.onMouseDown = function (eventData) { if (eventData.position.y < 0) { wade.app.buildInstructionsDisplay(); return true; }};
This way I thought I could have a clickable object that I could superimpose over an existing entity - manybe another Sprite, or a TextSpite, or a piece of graphics, so that I could separate the clickable areas from the techniques used to build the GUI - a suggestion I have to thank Gio for, by thw way! - but what I get is a white, opaque rectangle.
Incidentally, I'm not really clear about the difference between the "axis-aligned bounding box" and the "oriented bounding box" in the documentation for the boundingBox_ function.