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

Keyboard Controls #5

Open
marsian83 opened this issue Aug 12, 2024 · 16 comments
Open

Keyboard Controls #5

marsian83 opened this issue Aug 12, 2024 · 16 comments

Comments

@marsian83
Copy link
Collaborator

No description provided.

@marsian83
Copy link
Collaborator Author

I have made it so that farmer faces moving direction and also keyboard inputs also I have added
Can you check @chimosky

@chimosky
Copy link
Member

Tested, left a comment in one of the commits.

The farmer turns, but the boat doesn't. The turn should be both.

@marsian83
Copy link
Collaborator Author

I have changed the Flipping and keyboard inputs

@chimosky
Copy link
Member

Tested, the boat flips and the farmer flips but the farmer is still in the same position as before which isn't how it should work.

The game starts out with him on the left, when the boat flips, he should be on the right as he flips, and the arrow buttons work but we still have to click to drop-off anything in the boat, this could be achieved with the spacebar.

Why are the events being stored instead of processed as they occur?

@marsian83
Copy link
Collaborator Author

added spacebar action and made the held entity and farmer switch positions

Why are the events being stored instead of processed as they occur?

The reason I have to do that is if I process pygame.events using pygame.events.get once, I can't call them on the same frame once again as that gives an empty array
I already have to call it in main.py in order to check for QUIT event, so I store it at the same time so any screen can use the same events by calling game.events at most this might only introduce a 1 frame delay but is neccessary

@chimosky
Copy link
Member

added spacebar action and made the held entity and farmer switch positions

Tested, if spacebar is pressed before any key then the game freezes and no other key event is handled.

The logs show this;

Traceback (most recent call last):
  File "/home/ibiam/Activities/river-crossing-activity/main.py", line 103, in run
    self.update_function()
  File "/home/ibiam/Activities/river-crossing-activity/views/game.py", line 289, in update
    boat_click_action()
  File "/home/ibiam/Activities/river-crossing-activity/views/game.py", line 85, in boat_click_action
    define_objects(left=left)
  File "/home/ibiam/Activities/river-crossing-activity/views/game.py", line 116, in define_objects
    obj = Obj(gap * (i + 1) + land_object_width * i,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not callable

The reason I have to do that is if I process pygame.events using pygame.events.get once, I can't call them on the same frame once again as that gives an empty array
I already have to call it in main.py in order to check for QUIT event, so I store it at the same time so any screen can use the same events by calling game.events at most this might only introduce a 1 frame delay but is neccessary

Have you looked at pygame.event.poll()? It does this.

@marsian83
Copy link
Collaborator Author

marsian83 commented Sep 1, 2024

event.poll is behaving weird, fails to catches events sometimes, especially key presses
I don't know if I'm using it incorrectly
I think it behaves same as event.get where if consumed the event is getting exhauseted

@marsian83
Copy link
Collaborator Author

I have fixed the boat clicck bug

@chimosky
Copy link
Member

chimosky commented Sep 4, 2024

event.poll is behaving weird, fails to catches events sometimes, especially key presses I don't know if I'm using it incorrectly I think it behaves same as event.get where if consumed the event is getting exhauseted

It basically gets an event from the queue, if it doesn't behave as intended then you can leave it.

@chimosky
Copy link
Member

chimosky commented Sep 4, 2024

Tested 452134f, works as expected.

When the sheep is on the boat, clicking on the leg seems to be the only way to drop it, this is besides the spacebar.
Clicking on other parts of the goat seems to have no effect.

@marsian83
Copy link
Collaborator Author

Oh, I noticed that
I tried fixing this but it appears to be an issue rooted in something I was unable to find, can you help me with this? or if it is not too noticeable maybe we can ignore it

@chimosky
Copy link
Member

chimosky commented Sep 9, 2024

I can take a look later.

@marsian83
Copy link
Collaborator Author

I have updated the icon for this activity as well so that it adapts to Sugar colors. After you take a look at the sheep leg issue, We can also make a release for this activity.

@chimosky
Copy link
Member

I haven't been able to take a look into this, not sure I can at the moment.

@marsian83
Copy link
Collaborator Author

so can we package and release the activity? honestly, I do not reckon this issue would be noticeable to players

@chimosky
Copy link
Member

chimosky commented Sep 18, 2024

Yes we can package and release it, see our maintainer check list.
Make a list of the activities and their repos, we'll also need to transfer them to the Sugar Labs org.

I can handle uploading them to aslov4 after you make the releases.

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

No branches or pull requests

2 participants