From 09cb5b71c4947c1c4ff5bccedbc0aaf4a0e5f539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Wed, 18 Jan 2023 14:32:57 +0100 Subject: [PATCH] Pygame --- README.md | 3 ++- index.html | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index db18367..af12b12 100644 --- a/README.md +++ b/README.md @@ -2973,7 +2973,8 @@ rect = pg.Rect(240, 240, 20, 20) while not pg.event.get(pg.QUIT): deltas = {pg.K_UP: (0, -20), pg.K_RIGHT: (20, 0), pg.K_DOWN: (0, 20), pg.K_LEFT: (-20, 0)} for event in pg.event.get(pg.KEYDOWN): - rect.move_ip(deltas.get(event.key, (0, 0))) + dx, dy = deltas.get(event.key, (0, 0)) + rect.move_ip((dx, dy)) screen.fill((0, 0, 0)) pg.draw.rect(screen, (255, 255, 255), rect) pg.display.flip() diff --git a/index.html b/index.html index 35f64a6..77bb44f 100644 --- a/index.html +++ b/index.html @@ -2428,7 +2428,8 @@ rect = pg.Rect(240, 2 while not pg.event.get(pg.QUIT): deltas = {pg.K_UP: (0, -20), pg.K_RIGHT: (20, 0), pg.K_DOWN: (0, 20), pg.K_LEFT: (-20, 0)} for event in pg.event.get(pg.KEYDOWN): - rect.move_ip(deltas.get(event.key, (0, 0))) + dx, dy = deltas.get(event.key, (0, 0)) + rect.move_ip((dx, dy)) screen.fill((0, 0, 0)) pg.draw.rect(screen, (255, 255, 255), rect) pg.display.flip()