
-----------------------------------
Strawberry
Wed Jan 06, 2010 7:44 pm

Stopping an Animation with User Input
-----------------------------------
Well for my screensavers ISP, I need some help :)

% Flowers
procedure flowers
    cls
    loop
        pinkFlower := Pic.Scale (pinkFlower, 1130, 800)
        Pic.DrawSpecial (pinkFlower, 0, 0, picCopy, picGrowTopToBottomNoBar, transition)
        delay (transition)
        yellowFlower := Pic.Scale (yellowFlower, 1130, 800)
        Pic.DrawSpecial (yellowFlower, 0, 0, picCopy, picFadeIn, transition)
        delay (transition)
        mixedFlower := Pic.Scale (mixedFlower, 1130, 800)
        Pic.DrawSpecial (mixedFlower, 0, 0, picCopy, picSlideRightToLeft, transition)
        delay (transition)
        purpleFlower := Pic.Scale (purpleFlower, 1130, 800)
        Pic.DrawSpecial (purpleFlower, 0, 0, picCopy, picGrowLowerLeftToUpperRightNoBar, transition)
        delay (transition)
        lonelyFlower := Pic.Scale (lonelyFlower, 1130, 800)
        Pic.DrawSpecial (lonelyFlower, 0, 0, picCopy, picGrowCenterToEdgeNoBar, transition)
        delay (transition)
        redFlower := Pic.Scale (redFlower, 1130, 800)
        Pic.DrawSpecial (redFlower, 0, 0, picCopy, picSlideLeftToRight, transition)
        delay (transition)
    end loop
end flowers

^ This is a part of my code.
The problem is that I need to password protect my screensaver. I just need help with knowing how to stop the animation at any time when the user clicks a mouse button. Even if i wanted to display  button inside my animation, is there a way of making it show throughout the whole animation. 

Thank you.

-----------------------------------
imbored
Wed Jan 06, 2010 10:06 pm

RE:Stopping an Animation with User Input
-----------------------------------
errr use hasch
hasch checks if a button is pressed or not
loop
exit when hasch
end loop

go to help and search Hasch in index if you need more help

-----------------------------------
StuartG
Thu Jan 07, 2010 5:55 pm

RE:Stopping an Animation with User Input
-----------------------------------
Hasch works if the input is from the keyboard, not the mouse.

If you want it to exit whenever a mouse button is clicked then just throw in Mouse.Where (x,y,button) inside your loop and exit it whenever button > 0.

As for if you want a button to appear than just draw a button inside your loop and do the same above except make sure that you set up specific boundaries for the location of the mouse to make sure its actually inside the box. eg.

If you got a box thats set at (100,100,400,200) then whenever the x value of the button is > 100 but 100 but 