Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor event handling #27

Closed
chimosky opened this issue Apr 6, 2023 · 5 comments · Fixed by #33
Closed

Poor event handling #27

chimosky opened this issue Apr 6, 2023 · 5 comments · Fixed by #33

Comments

@chimosky
Copy link
Member

chimosky commented Apr 6, 2023

The game help shows that arrow keys are to be used but using them have no effect and this is seen in the logs.

Traceback (most recent call last):
  File "/home/ibiam/Activities/make-them-fall-activity/sugargame/event.py", line 140, in _keyup_cb
    return self._keyevent(widget, event, pygame.KEYUP)
  File "/home/ibiam/Activities/make-them-fall-activity/sugargame/event.py", line 172, in _keyevent
    mod = self._keymods()
  File "/home/ibiam/Activities/make-them-fall-activity/sugargame/event.py", line 145, in _keymods
    mod |= self.__keystate[key_val] and mod_val
IndexError: list index out of range
Traceback (most recent call last):
  File "/home/ibiam/Activities/make-them-fall-activity/sugargame/event.py", line 128, in _keydown_cb
    return self._keyevent(widget, event, pygame.KEYDOWN)
  File "/home/ibiam/Activities/make-them-fall-activity/sugargame/event.py", line 169, in _keyevent
    mod = self._keymods()
  File "/home/ibiam/Activities/make-them-fall-activity/sugargame/event.py", line 145, in _keymods
    mod |= self.__keystate[key_val] and mod_val
IndexError: list index out of range

Took a look and the activity doesn't handle events its expected to handle.

@jriyyya you might be interested in this.

@jriyyya
Copy link
Contributor

jriyyya commented Apr 7, 2023

Yes thanks 🙌, Will look into this after 3days, currently a bit busy.

@jriyyya
Copy link
Contributor

jriyyya commented Apr 12, 2023

I was not able to reproduce this issue, and also arrow keys are working fine with me

@chimosky
Copy link
Member Author

I was not able to reproduce this issue, and also arrow keys are working fine with me

Strange, @quozl can you test?

@quozl
Copy link
Contributor

quozl commented May 6, 2023

Looking at the code, where did the number 323 come from, and has it changed since Sugargame was written? Should a Pygame constant or length be used instead? Actually, why does the initialisation of __keystate use a list of 323 zeroes, instead of the list of keys in mod_map? Perhaps transfer this to Sugargame repository too.

@chimosky
Copy link
Member Author

Looking at the code, where did the number 323 come from, and has it changed since Sugargame was written? Should a Pygame constant or length be used instead? Actually, why does the initialisation of __keystate use a list of 323 zeroes, instead of the list of keys in mod_map? Perhaps transfer this to Sugargame repository too.

The sugargame in the activity needs to be updated, __init__ says its 1.3 but it's deviated from sugargame.
@jriyyya something worth noting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants