Made attribute block update when switching sprite

If the sprite you switch to doesn’t have an attribute or variable, it
will set the attribute to the default one for sprites or the stage.
Shortened the code a little