Python Forum
Need help developing a game with Raspberry Pi 3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help developing a game with Raspberry Pi 3
#1
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
Reply
#2
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.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
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)
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Reply
#4
(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
Reply
#5
(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
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020