Remove dependency on math module.
Use pygame events.