Variable updating by function, sprite resources passed in, bug fixed