Fred Endsley

Misc. Scripting Issues and Possibilities:

1) Invisible Shapes, Reg Points, Bitmapping, Inks:

The white-on-white, filled "invisible" shapes made with the tool palette, that can be exchanged for other cast members, are called "quickdraw shapes". They use very little memory in the cast or onstage, but they do have a drawback: their registration points are in the top-left corner rather than in the center like bitmap castmembers.

Thus, when you puppet and exchange them for bitmapped castmembers (eg. "set the memberNum of sprite 3 to 9") the centered regPoint of the bitmapped member aligns with the top-left regPoint of the invisible quickdraw sprite. Usually inconvenient, but fixable by resetting the regPoint of the quickdraw sprite ("set the regPoint of member "inviso rect" = point(200, 320)" ) so that it will be centered.

A simple workaround is to make your invisible member/shapes in the paint window so that they will be bitmaps with automatically centered regPoints. The catch is that the paint window won't allow you to make a filled white-on-white shape.

So make a black filled shape (you can resize it onstage). Transform it's bitmap to 1-bit to save memory, place it onstage where you need it, and select it in the score. Use the tool palette to change it's forecolor to white, and set it's inking to "Not Transparent" or "Not Reverse", and you're good-to-go, no lingo necessary to this point. Remember to duplicate it from the score cell if you need more occurrences or movement through the score.

2) The "Visible of Sprite" Property:

The advantage of using invisible shape sprites is that, when puppetted, you can exchange them for a variety or random selection of castmembers. However, if you only need a single castmember to appear, let's say a "lightening bolt" there is an easier solution.

Skip the invisible shape, and simply place the cast member "lightening bolt" onstage where you need it. Then, without necessarily puppetting it, write an enterFrame script for it's first frame in the score using: "set the visible of sprite 5 to FALSE". It will now be invisible until you enact another frame, rollOver, or button script using: "set the visible of sprite 5 to TRUE". There it is! Lightening Bolt! You can change it's visible property whenever you want.

If you need it to invisibly follow the mouse, puppetise it. "Set the movableSprite of sprite 5 to TRUE", and attach it to the mouse position with the "set the locH of sprite 5 to the mouseH", "set the locV of sprite 5 to the mouseV", "updateStage" routine.

If you attach several such sprites to the mouse, make sure they are layered right in the score so they appear correctly when visible. They could be offset individually by resetting their regPoints or by adding or subtracting pixels from the mouse H & V.

In connection with setting the visible of our "lightening bolt" to TRUE, we could also make the mouse disappear with "Cursor 200". Both can be reversed in the next frame.

3) "RollOver vs. MouseCast":

One problem with using rollOvers is that they occur as soon as the cursor enters the sprite's bounding box. With an irregularly shaped sprite that has some transparent area around it, the cursor might still be a distance away from the visible "body" of the sprite when it triggers the rollOver action. This can feel and look inaccurate.

Instead, try this: Set the sprite inking to matte so that the white pixels around the sprite body are transparent, but no white pixels within the sprite body are transparent. Rather than using the "if rollOver (3) then..." routine, use:

"if the mouseCast = 3 then ..."

This returns only the nontransparent pixels of the sprite under the cursor, and feels much more accurate without needing to make a sprite mask. Otherwise its just like a rollOver. But It only works this way with a bitmap cast member - not a quickdraw shape.


ButBack.jpeg (1047bytes) ButHome.jpeg (3977bytes)