MCPcopy Create free account
hub / github.com/ActiveState/code / move

Function move

recipes/Python/502255_Explosive_Embers/recipe-502255.py:66–78  ·  view source on GitHub ↗

Simulate movement of screen.

(event)

Source from the content-addressed store, hash-verified

64 frame = 1.0
65
66def 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
80def update():
81 'Run physics and update screen.'

Callers

nothing calls this directly

Calls 2

floorFunction · 0.70
moveMethod · 0.45

Tested by

no test coverage detected