sugarlabs / make-them-fall-activity

A multilevel arcade game for Sugar
GNU General Public License v3.0
0 stars 11 forks source link

Poor event handling #27

Closed chimosky closed 1 year ago

chimosky commented 1 year ago

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 commented 1 year ago

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

jriyyya commented 1 year ago

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

chimosky commented 1 year ago

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

Strange, @quozl can you test?

quozl commented 1 year ago

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 commented 1 year ago

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.