- Grumble, grumble. - Look, here, this should work:
Also note -- obviously it's not being executed in a DO, LOOP because if it was, then you would have gotten an error message about loading the images, stating that it has already been loaded in. In other words, you should load all images and crap at the start of your program if you ask me. >/
LOAD IMAGE "mediaexaminehand_specimen.png", 1
LOAD IMAGE "mediaexaminethin_section.png", 2
GLOBAL clicked AS INTEGER : GLOBAL clickable AS INTEGER
SYNC ON : SYNC RATE 0
SPRITE 1, 0, 0, 1
SPRITE 2, 0, 0, 2
SPRITE 1, SCREEN WIDTH()/2-SPRITE WIDTH(1)/2, SCREEN HEIGHT()/2-SPRITE HEIGHT(1)/2, 1
SPRITE 2, SCREEN WIDTH()/2-SPRITE WIDTH(2)/2, SCREEN HEIGHT()/2-SPRITE HEIGHT(2)/2, 2
HIDE SPRITE 2
DO
set_notebook_mode()
IF MOUSECLICK()=0
clickable=1
ENDIF
SYNC
LOOP
FUNCTION set_notebook_mode
IF MOUSEX() > SPRITE X(1) AND MOUSEX() < SPRITE X(1)+SPRITE WIDTH(1) AND MOUSEY() > SPRITE Y(1) AND MOUSEY() < SPRITE Y(1)+SPRITE HEIGHT(1) AND MOUSECLICK()=1 AND clicked=0 AND clickable=1
HIDE SPRITE 1
SHOW SPRITE 2
clicked=1
clickable=0
ELSE : IF MOUSEX() > SPRITE X(1) AND MOUSEX() < SPRITE X(1)+SPRITE WIDTH(1) AND MOUSEY() > SPRITE Y(1) AND MOUSEY() < SPRITE Y(1)+SPRITE HEIGHT(1) AND MOUSECLICK()=1 AND clicked=1 AND clickable=1
HIDE SPRITE 2
SHOW SPRITE 1
clicked=0
clickable=0
ENDIF : ENDIF
ENDFUNCTION
There. This code should place both sprites in the middle of the screen, with one hidden and the other showing. Simply click it to have the image change, then click it again to have it change back. If you want it to simply change back after you stop holding the mouse, then just modify it accordingly. I trust you know how to do so, by now.
Hope this helps,
Tom