Skip to content

Commit

Permalink
Add valid buttons and button press example
Browse files Browse the repository at this point in the history
  • Loading branch information
msosav committed Jun 23, 2024
1 parent 22e9571 commit c9739a7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from pyboy import PyBoy
from pyboy.utils import WindowEvent

valid_buttons = ["a", "b", "start", "select", "left", "right", "up", "down"]


def load_state(path: str, pyboy: PyBoy) -> None:
with open(path, "rb") as state:
Expand All @@ -13,6 +15,8 @@ def load_state(path: str, pyboy: PyBoy) -> None:
load_state("roms/ZeldaLinksAwakening.gb.state", pyboy)

while pyboy.tick():
pyboy.button(valid_buttons[0]) # a
pyboy.tick()
pass

pyboy.stop()

0 comments on commit c9739a7

Please sign in to comment.