class: Schultz
[44:7] extends: object
Sergeant Schultz leans in at the edge of the AGR FXGL window while "NO-THING" fades up in the middle, then both back out again. Build one and call run(). He comes in at a random spot on a random edge, slides in until he is flush against it, waits, and leaves the way he came. The words fade up as he slides in and fade away as he slides out, so the two move together. The numbers at the top of the class are the dials. Change them to alter the timing, the sizes, or the words.
Members
- slideSeconds
- holdSeconds
- pictureScale
- words
- fontScale
- textColor
- picturePaths
- picture
- text
- restX
- restY
- awayX
- awayY
- turn
Methods
-
run ()
Brings Schultz in, holds him there, and sends him back out. The entities clear themselves out of the game world at the end. Only works inside AGR, which has the FXGL game already running.
- @r
double- how many seconds the whole appearance takes.
- @r
-
total ()
How long the whole appearance takes: in, wait, and back out.
- @r
double- the total time in seconds.
- @r
-
leave ()
Sends Schultz back out the way he came, taking the words with him. The timer calls this once the wait is over.
- @r
thisobject
- @r
-
clearUp ()
Takes both entities out of the game world once they are done.
- @r
thisobject
- @r
-
findPicture ()
Returns the first path in picturePaths that exists.
- @r
string- the path to the picture file.
- @r
-
placeOnEdge (
int Edge, double Width, double Height, double PictureWidth, double PictureHeight)Works out which way up the picture goes, where it rests once it is in, and where it hides before and after. The picture's feet always face the edge it comes in from, so arriving from above means arriving upside down. Turning is done about the middle of the picture, and a quarter turn swaps how much room it takes up, so the positions here are worked out from the middle outwards and converted at the end.
- @p
Edgeis the edge: 0 top, 1 right, 2 bottom, 3 left. - @p
Widthis the window width in pixels. - @p
Heightis the window height in pixels. - @p
PictureWidthis the picture width in pixels. - @p
PictureHeightis the picture height in pixels. - @r
thisobject
- @p
-
buildText (
double Width, double Height)Builds the words and centres them in the window, starting fully see-through so the fade has somewhere to come from. A Text node is measured from its own baseline rather than its top left, so the entity is placed using the node's own bounds instead of the middle of the window alone.
- @p
Widthis the window width in pixels. - @p
Heightis the window height in pixels. - @r
thisobject
- @p
-
slide (
double FromX, double FromY, double ToX, double ToY)Slides the picture from one spot to another over slideSeconds.
- @p
FromXis the starting horizontal position in pixels. - @p
FromYis the starting vertical position in pixels. - @p
ToXis the finishing horizontal position in pixels. - @p
ToYis the finishing vertical position in pixels. - @r
thisobject
- @p
-
fade (
double From, double To)Fades the words between two opacities over slideSeconds, so they keep pace with the picture.
- @p
Fromis the starting opacity, 0.0 to 1.0. - @p
Tois the finishing opacity, 0.0 to 1.0. - @r
thisobject
- @p