physics code (free to use) | ScratchStats