The button constants for ABXY are simply #A, #B, #X and #Y.
To change a sprite you can just use SPSET again with a different definition number. Animations are a bit hard to make, but if you're willing you can look up SPANIM and the "Anim." tool in the SmileTool.
Simple enough.
IF BUTTON() AND #X THEN SPSET 0,<Def 1>
IF BUTTON() AND #Y THEN SPSET 0,<Def 2>
Where Def 1 and 2 are the definition numbers of the sprites you want to change to.