Python Forum

Full Version: Need help developing a game with Raspberry Pi 3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So me and my buddy want to create a game using python games as a final project we have in our class. We basically need to create a game and then use the parts we have with the raspberry pi and get a grade on it. At the moment all we need is a background, and a punching bag that will rotate diagonal left or right like it was punched. After we will have that we will program it and connect our sensors to a punching bag IRL that will move upon a punch. But right now all we need is what i've written above. Could someone help us out? We tried for like a week during class but there was no success for us whatsoever. Thanks
You need to show us what you've tried so far. We would be happy to guide you along, make suggestions, etc, but will not not write the program for you. Make sure you read the Help / Rules doc (particularly the section on BBCode) in order to post your code, output and errors correctly.
Why not just create a GUI?
• Have a picture of a punching bag at rest.
• Have event handlers that calls a function when you press a certain key. This could be replace later on.
• Replace picture of a bag being hit.
• Place a for loop and have the punching bag animate (Optional)
• After a certain period have a picture of a punching bag at rest.

Ref:
https://projects.raspberrypi.org/en/proj...-with-guis, see picture widgets. (uses guizero)
http://effbot.org/tkinterbook/tkinter-ev...ndings.htm (uses tkinter)
(Dec-27-2017, 01:55 PM)Terafy Wrote: [ -> ]Why not just create a GUI?
• Have a picture of a punching bag at rest.
• Have event handlers that calls a function when you press a certain key. This could be replace later on.
• Replace picture of a bag being hit.
• Place a for loop and have the punching bag animate (Optional)
• After a certain period have a picture of a punching bag at rest.

Ref:
https://projects.raspberrypi.org/en/proj...-with-guis, see picture widgets. (uses guizero)
http://effbot.org/tkinterbook/tkinter-ev...ndings.htm (uses tkinter)

I don't understand how that's different from what OP asked for. pygame literally is just a gui. If anything, using tkinter would be harder, as you're moving widgets around.

To OP:
Sounds like a cool idea. You can (and should) "simulate" raspberrypi events using the keyboard, so the program does everything it needs to do when "something" happens. Then, as you suggested, you'd just need to replace that "something" with sensor output from the pi.

As to where to start, the pygame docs (http://pygame.org/docs/) have an intro page that can help you get started. If you have some code, and need some help with it, we'll help, but we won't do your project for you :p
(Dec-27-2017, 04:36 PM)nilamo Wrote: [ -> ]
(Dec-27-2017, 01:55 PM)Terafy Wrote: [ -> ]Why not just create a GUI?
• Have a picture of a punching bag at rest.
• Have event handlers that calls a function when you press a certain key. This could be replace later on.
• Replace picture of a bag being hit.
• Place a for loop and have the punching bag animate (Optional)
• After a certain period have a picture of a punching bag at rest.

Ref:
https://projects.raspberrypi.org/en/proj...-with-guis, see picture widgets. (uses guizero)
http://effbot.org/tkinterbook/tkinter-ev...ndings.htm (uses tkinter)

I don't understand how that's different from what OP asked for.  pygame literally is just a gui.  If anything, using tkinter would be harder, as you're moving widgets around.

To OP:
Sounds like a cool idea.  You can (and should) "simulate" raspberrypi events using the keyboard, so the program does everything it needs to do when "something" happens.  Then, as you suggested, you'd just need to replace that "something" with sensor output from the pi.

As to where to start, the pygame docs (http://pygame.org/docs/) have an intro page that can help you get started.  If you have some code, and need some help with it, we'll help, but we won't do your project for you :p

Sorry, still newish to python (Still got a lot to learn). Was only trying to help Big Grin