SlideShare une entreprise Scribd logo
1  sur  6
Télécharger pour lire hors ligne
Enter Username-Pygame
I show you how enter text (username) in Pygame(Python 3) through two
sample games: Snake and Tetris and keep TOP TEN Players saved (txt file)
I use both jsonpickle module and my custom serializer to save in a text file
Main Python Files are below
 /Tetris/ folder:
tetromino-production-jsonpickle-top-10.py, hightscores.json,
tetromino-production-custom-top-10.py, hightscores.txt
 /Snake/ folder:
snake-production-jsonpickle-top-10.py, hightscores.json,
snake-production-custom-top-10.py, hightscores.txt
 Other files, support the games like images or image sprites.
 All Files are in the two folders and these are in a ZIP file archive
Other functionality
 Games ask for User name and also include:
 Pause by pressing “P” or “p”, Start by inserting User name and pressing Enter or
Space-bar. Control games with Arrow keys.
 TOP TEN Players in .txt (custom version) or .json (jsonpickle module version) files.
If you insert an already existed User name and scored more than before the score
is edited and you can Not have double user names
 Added collision sounds (Snake), If you want run game as other Player restart it.
 TOP Player appear in the Splash screen at startup or at the end
 Txt and json files if Not exist are automatically created, json file stores Python
json pickled object, text file store entries in text “user,points”
 The code lines responsible for TOP TEN Players and Enter Username indicated in
the next slide (lines in the python files) and saved in .txt or .json files
Snake game – code lines for Username
Enter and keep TOP TEN Players
 snake-production-jsonpickle-top-10.py
 Username Enter
 Lines 53 – 100, 534, 547 - 548
 TOP TEN Players
 Lines 10-11, 138 – 251, 328, 525
 snake-production-custom-top-10.py
 Username Enter
 Lines 56 – 99, 504, 517 - 518
 TOP TEN Players
 Lines 105 – 132, 135 – 217, 298, 495,
Tetris game – code lines for Username
enter and keep TOP TEN players
 tetromino-production-jsonpickle-top-10.py
 Username Enter
 Lines 162 – 215, 561 - 563
 TOP TEN Players
 Lines 9 – 10, 250 – 363, 389 - 390, 405, 542, 557
 tetromino-production-custom-top-10.py
 Username Enter
 Lines 162 – 215, 565 – 567,
 TOP TEN Players
 Lines 217 – 367, 393 - 394, 409, 546, 561,
Support via E-mail, or Envato Forum
Support
 Lsepolis123@gmail.com // My Email for Support
 https://thonny.org
 https://www.geany.org/download/releases/
 Recommended Python Free Editors/IDE – cross platform
 https://codecanyon.net/user/lse123/ (Envato – my Account)

Contenu connexe

Tendances (7)

Python & FUSE
Python & FUSEPython & FUSE
Python & FUSE
 
Linux midterm quiz
Linux midterm quizLinux midterm quiz
Linux midterm quiz
 
Lighting plans
Lighting plansLighting plans
Lighting plans
 
Good Code
Good CodeGood Code
Good Code
 
Img 0036
Img 0036Img 0036
Img 0036
 
Lecture 0 python basic (ewurc)
Lecture 0 python basic (ewurc)Lecture 0 python basic (ewurc)
Lecture 0 python basic (ewurc)
 
Montessori World, Vadodara, Montessori Products
Montessori World, Vadodara, Montessori ProductsMontessori World, Vadodara, Montessori Products
Montessori World, Vadodara, Montessori Products
 

Similaire à pygame-enter-username-keep-top-ten-players

C++ ProgrammingYou are to develop a program to read Baseball playe.pdf
C++ ProgrammingYou are to develop a program to read Baseball playe.pdfC++ ProgrammingYou are to develop a program to read Baseball playe.pdf
C++ ProgrammingYou are to develop a program to read Baseball playe.pdf
fazanmobiles
 
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
Yashpatel821746
 

Similaire à pygame-enter-username-keep-top-ten-players (6)

Artificial intelligence - python
Artificial intelligence - pythonArtificial intelligence - python
Artificial intelligence - python
 
C++ ProgrammingYou are to develop a program to read Baseball playe.pdf
C++ ProgrammingYou are to develop a program to read Baseball playe.pdfC++ ProgrammingYou are to develop a program to read Baseball playe.pdf
C++ ProgrammingYou are to develop a program to read Baseball playe.pdf
 
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
 
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
 
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
 
What's new in Python 3.11
What's new in Python 3.11What's new in Python 3.11
What's new in Python 3.11
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

pygame-enter-username-keep-top-ten-players

  • 1. Enter Username-Pygame I show you how enter text (username) in Pygame(Python 3) through two sample games: Snake and Tetris and keep TOP TEN Players saved (txt file) I use both jsonpickle module and my custom serializer to save in a text file
  • 2. Main Python Files are below  /Tetris/ folder: tetromino-production-jsonpickle-top-10.py, hightscores.json, tetromino-production-custom-top-10.py, hightscores.txt  /Snake/ folder: snake-production-jsonpickle-top-10.py, hightscores.json, snake-production-custom-top-10.py, hightscores.txt  Other files, support the games like images or image sprites.  All Files are in the two folders and these are in a ZIP file archive
  • 3. Other functionality  Games ask for User name and also include:  Pause by pressing “P” or “p”, Start by inserting User name and pressing Enter or Space-bar. Control games with Arrow keys.  TOP TEN Players in .txt (custom version) or .json (jsonpickle module version) files. If you insert an already existed User name and scored more than before the score is edited and you can Not have double user names  Added collision sounds (Snake), If you want run game as other Player restart it.  TOP Player appear in the Splash screen at startup or at the end  Txt and json files if Not exist are automatically created, json file stores Python json pickled object, text file store entries in text “user,points”  The code lines responsible for TOP TEN Players and Enter Username indicated in the next slide (lines in the python files) and saved in .txt or .json files
  • 4. Snake game – code lines for Username Enter and keep TOP TEN Players  snake-production-jsonpickle-top-10.py  Username Enter  Lines 53 – 100, 534, 547 - 548  TOP TEN Players  Lines 10-11, 138 – 251, 328, 525  snake-production-custom-top-10.py  Username Enter  Lines 56 – 99, 504, 517 - 518  TOP TEN Players  Lines 105 – 132, 135 – 217, 298, 495,
  • 5. Tetris game – code lines for Username enter and keep TOP TEN players  tetromino-production-jsonpickle-top-10.py  Username Enter  Lines 162 – 215, 561 - 563  TOP TEN Players  Lines 9 – 10, 250 – 363, 389 - 390, 405, 542, 557  tetromino-production-custom-top-10.py  Username Enter  Lines 162 – 215, 565 – 567,  TOP TEN Players  Lines 217 – 367, 393 - 394, 409, 546, 561,
  • 6. Support via E-mail, or Envato Forum Support  Lsepolis123@gmail.com // My Email for Support  https://thonny.org  https://www.geany.org/download/releases/  Recommended Python Free Editors/IDE – cross platform  https://codecanyon.net/user/lse123/ (Envato – my Account)