Pyxel-7.py
· 293 B · Python
Ham
import pyxel
class App:
def __init__(self):
pyxel.init(160, 120)
self.x = 0
pyxel.run(self.update, self.draw)
def update(self):
self.x = (self.x + 1) % pyxel.width
def draw(self):
pyxel.cls(0)
pyxel.rect(self.x, 0, 8, 8, 9)
App()
1 | import pyxel |
2 | |
3 | class App: |
4 | def __init__(self): |
5 | pyxel.init(160, 120) |
6 | self.x = 0 |
7 | pyxel.run(self.update, self.draw) |
8 | |
9 | def update(self): |
10 | self.x = (self.x + 1) % pyxel.width |
11 | |
12 | def draw(self): |
13 | pyxel.cls(0) |
14 | pyxel.rect(self.x, 0, 8, 8, 9) |
15 | |
16 | App() |