Simulate movement of screen.
(event)
| 64 | frame = 1.0 |
| 65 | |
| 66 | def move(event): |
| 67 | 'Simulate movement of screen.' |
| 68 | global x, y |
| 69 | if not lock: |
| 70 | diff = physics.Vector(x - event.x, y - event.y) |
| 71 | screen.move('animate', diff.x, diff.y) |
| 72 | floor_height = SCREEN_HEIGHT - FLOOR_SPACE - BALL_RADIUS |
| 73 | for ball in balls: |
| 74 | ball.pos += diff |
| 75 | if ball.pos.y >= floor_height: |
| 76 | ball.vel.y += diff.y * FPS |
| 77 | floor(ball) |
| 78 | x, y = event.x, event.y |
| 79 | |
| 80 | def update(): |
| 81 | 'Run physics and update screen.' |