SlideShare a Scribd company logo
1 of 10
Python games
 Python is a computer programming language. We chose Python for
this tutorial because it’s a simple language to start out with, and is
fun and easy to learn.
 While you can run short bits of Python code at the Python prompt, if
you want to work on a bigger program (like a game), you probably
want to SAVE your code to a file so that you don’t have to type it in
over and over again.
 There are several ways to run a Python program as a file. One way is
to use a plain text editor like Notepad (Windows), or TextEdit (Mac).
Open a new text file, type in your Python code (like print 1+1).
 Then on Windows, double-click this file to run it. On Mac, open
Terminal and type python, then drag the file that you SAVED onto
the Terminal window and press Enter.
 The other way is to type in your code using the IDLE editor, which is
what you’re going to do in this tutorial. To run idle, simply type idle
from Terminal. Then choose FileNew Window from the IDLE menu
and you should have a text editor window where you can type in
Python code. You can SAVE your code changes via FileSave and
even run the code via RunRun Module (F5).
 You are almost ready to create your game. But what’s a game
without some great graphics and sound effects? I’ve put together
all the graphics and sound effects you’ll need for your game into a
ZIP archive. You can download it here.
 Once you’ve downloaded the file, create a folder for your game on
your hard disk and extract the resources folder into that folder so
that your game folder has a subfolder named resources, with the
various resources grouped in additional folders inside it
 The first if statement checks if the time is up. The second one checks
if the castle is destroyed. The third one calculates your accuracy
ratio. After that, a quick if statement checks if you won or lost and
displays the correct image.
 Mohammed waheed
 12 BB

More Related Content

What's hot

Font file formats: TrueType (TTF), PostScript y OpenType (OTF)
Font file formats: TrueType (TTF), PostScript y OpenType (OTF)Font file formats: TrueType (TTF), PostScript y OpenType (OTF)
Font file formats: TrueType (TTF), PostScript y OpenType (OTF)David Fimia Zapata
 
Microsoft Windows 10 Professional
Microsoft Windows 10 ProfessionalMicrosoft Windows 10 Professional
Microsoft Windows 10 Professionalcdkey deal
 
Google android operating system
Google android operating systemGoogle android operating system
Google android operating systemFaysal Yousuf
 
The best and most reliable valid and active windows 8 professional product key
The best and most reliable valid and active windows 8 professional product keyThe best and most reliable valid and active windows 8 professional product key
The best and most reliable valid and active windows 8 professional product keymorenews222
 
The Ring programming language version 1.8 book - Part 22 of 202
The Ring programming language version 1.8 book - Part 22 of 202The Ring programming language version 1.8 book - Part 22 of 202
The Ring programming language version 1.8 book - Part 22 of 202Mahmoud Samir Fayed
 
3.5 memory and io systems
3.5 memory and io systems3.5 memory and io systems
3.5 memory and io systemsSayed Ahmed
 

What's hot (9)

Font file formats: TrueType (TTF), PostScript y OpenType (OTF)
Font file formats: TrueType (TTF), PostScript y OpenType (OTF)Font file formats: TrueType (TTF), PostScript y OpenType (OTF)
Font file formats: TrueType (TTF), PostScript y OpenType (OTF)
 
Microsoft Windows 10 Professional
Microsoft Windows 10 ProfessionalMicrosoft Windows 10 Professional
Microsoft Windows 10 Professional
 
Cimbalino Toolkit and Multilingual App Toolkit
Cimbalino Toolkit and Multilingual App ToolkitCimbalino Toolkit and Multilingual App Toolkit
Cimbalino Toolkit and Multilingual App Toolkit
 
Google android operating system
Google android operating systemGoogle android operating system
Google android operating system
 
The best and most reliable valid and active windows 8 professional product key
The best and most reliable valid and active windows 8 professional product keyThe best and most reliable valid and active windows 8 professional product key
The best and most reliable valid and active windows 8 professional product key
 
The Ring programming language version 1.8 book - Part 22 of 202
The Ring programming language version 1.8 book - Part 22 of 202The Ring programming language version 1.8 book - Part 22 of 202
The Ring programming language version 1.8 book - Part 22 of 202
 
Win8
Win8Win8
Win8
 
3.5 memory and io systems
3.5 memory and io systems3.5 memory and io systems
3.5 memory and io systems
 
Office session2
Office session2Office session2
Office session2
 

Viewers also liked

RDS_Photoscan_Eval_Cloud
RDS_Photoscan_Eval_CloudRDS_Photoscan_Eval_Cloud
RDS_Photoscan_Eval_CloudRaminder Singh
 
Facebook Development for Beginners
Facebook Development for BeginnersFacebook Development for Beginners
Facebook Development for BeginnersJesse Stay
 
Introduction To Facebook: Opportunities and Challenges For The Institution
Introduction To Facebook: Opportunities and Challenges For The InstitutionIntroduction To Facebook: Opportunities and Challenges For The Institution
Introduction To Facebook: Opportunities and Challenges For The Institutionlisbk
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scriptingAmirul Shafeeq
 
Introduction to Facebook Python API
Introduction to Facebook Python APIIntroduction to Facebook Python API
Introduction to Facebook Python APIColin Su
 
Server and Client side comparision
Server and Client side comparisionServer and Client side comparision
Server and Client side comparisionStew Duncan
 
Workshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDKWorkshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDKDimitar Danailov
 
Introduction to Game programming with PyGame Part 1
Introduction to Game programming with PyGame Part 1Introduction to Game programming with PyGame Part 1
Introduction to Game programming with PyGame Part 1Abhishek Mishra
 
Introduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDKIntroduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDKColin Su
 
Facebook Python SDK - Introduction
Facebook Python SDK - IntroductionFacebook Python SDK - Introduction
Facebook Python SDK - IntroductionColin Su
 
Facebook essay ideas
Facebook essay ideasFacebook essay ideas
Facebook essay ideasLisa Shaw
 
Scripting languages
Scripting languagesScripting languages
Scripting languagesteach4uin
 
Introduction To Facebook
Introduction To FacebookIntroduction To Facebook
Introduction To Facebookguest9c21edf3
 
Professional Front End Development
Professional Front End DevelopmentProfessional Front End Development
Professional Front End Developmentnelsonmenezes
 
Web Server Hardware and Software
Web Server Hardware and SoftwareWeb Server Hardware and Software
Web Server Hardware and Softwarewebhostingguy
 
Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1Oleksii Prohonnyi
 

Viewers also liked (20)

RDS_Photoscan_Eval_Cloud
RDS_Photoscan_Eval_CloudRDS_Photoscan_Eval_Cloud
RDS_Photoscan_Eval_Cloud
 
Facebook Development for Beginners
Facebook Development for BeginnersFacebook Development for Beginners
Facebook Development for Beginners
 
Introduction To Facebook: Opportunities and Challenges For The Institution
Introduction To Facebook: Opportunities and Challenges For The InstitutionIntroduction To Facebook: Opportunities and Challenges For The Institution
Introduction To Facebook: Opportunities and Challenges For The Institution
 
introduction to server-side scripting
introduction to server-side scriptingintroduction to server-side scripting
introduction to server-side scripting
 
Introduction to Facebook Python API
Introduction to Facebook Python APIIntroduction to Facebook Python API
Introduction to Facebook Python API
 
Server and Client side comparision
Server and Client side comparisionServer and Client side comparision
Server and Client side comparision
 
Workshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDKWorkshop : Facebook JavaScript SDK
Workshop : Facebook JavaScript SDK
 
Introduction to Game programming with PyGame Part 1
Introduction to Game programming with PyGame Part 1Introduction to Game programming with PyGame Part 1
Introduction to Game programming with PyGame Part 1
 
Website vs web app
Website vs web appWebsite vs web app
Website vs web app
 
Introduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDKIntroduction to Facebook JavaScript & Python SDK
Introduction to Facebook JavaScript & Python SDK
 
Facebook Python SDK - Introduction
Facebook Python SDK - IntroductionFacebook Python SDK - Introduction
Facebook Python SDK - Introduction
 
Mobile app Vs Web App
Mobile app Vs Web AppMobile app Vs Web App
Mobile app Vs Web App
 
Client & server side scripting
Client & server side scriptingClient & server side scripting
Client & server side scripting
 
Facebook essay ideas
Facebook essay ideasFacebook essay ideas
Facebook essay ideas
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Introduction To Facebook
Introduction To FacebookIntroduction To Facebook
Introduction To Facebook
 
Professional Front End Development
Professional Front End DevelopmentProfessional Front End Development
Professional Front End Development
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Web Server Hardware and Software
Web Server Hardware and SoftwareWeb Server Hardware and Software
Web Server Hardware and Software
 
Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1Front-end development introduction (HTML, CSS). Part 1
Front-end development introduction (HTML, CSS). Part 1
 

Similar to Python games

Get Starte with MicroPython ESP32
Get Starte with MicroPython ESP32Get Starte with MicroPython ESP32
Get Starte with MicroPython ESP32fanghe22
 
Get Started with MicroPython ESP32
Get Started with MicroPython ESP32Get Started with MicroPython ESP32
Get Started with MicroPython ESP32fanghe22
 
Python games
Python gamesPython games
Python gamesmolw
 
Game programming workshop
Game programming workshopGame programming workshop
Game programming workshopnarigadu
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonmckennadglyn
 
Unity - Essentials of Programming in Unity
Unity - Essentials of Programming in UnityUnity - Essentials of Programming in Unity
Unity - Essentials of Programming in UnityNexusEdgesupport
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Niraj Bharambe
 
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON Nandakumar P
 
PYTHON FEATURES.pptx
PYTHON FEATURES.pptxPYTHON FEATURES.pptx
PYTHON FEATURES.pptxMaheShiva
 
Easy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkeyEasy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkeypprem
 
Intro to Programming Week 2_Python Installation.pptx
Intro to Programming Week 2_Python Installation.pptxIntro to Programming Week 2_Python Installation.pptx
Intro to Programming Week 2_Python Installation.pptxiksanbukhori
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptxHaythamBarakeh1
 

Similar to Python games (20)

Get Starte with MicroPython ESP32
Get Starte with MicroPython ESP32Get Starte with MicroPython ESP32
Get Starte with MicroPython ESP32
 
Get Started with MicroPython ESP32
Get Started with MicroPython ESP32Get Started with MicroPython ESP32
Get Started with MicroPython ESP32
 
Cs2 Ch1
Cs2 Ch1Cs2 Ch1
Cs2 Ch1
 
Python games
Python gamesPython games
Python games
 
Game programming workshop
Game programming workshopGame programming workshop
Game programming workshop
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python Programming
Python ProgrammingPython Programming
Python Programming
 
Unity - Essentials of Programming in Unity
Unity - Essentials of Programming in UnityUnity - Essentials of Programming in Unity
Unity - Essentials of Programming in Unity
 
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
Python Book/Notes For Python Book/Notes For S.Y.B.Sc. I.T.
 
kecs105.pdf
kecs105.pdfkecs105.pdf
kecs105.pdf
 
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
UNIT-1 : 20ACS04 – PROBLEM SOLVING AND PROGRAMMING USING PYTHON
 
Getting started windows phone unity
Getting started windows phone unityGetting started windows phone unity
Getting started windows phone unity
 
PYTHON FEATURES.pptx
PYTHON FEATURES.pptxPYTHON FEATURES.pptx
PYTHON FEATURES.pptx
 
Getting started windows store unity
Getting started windows store unityGetting started windows store unity
Getting started windows store unity
 
Getting Started with Python
Getting Started with PythonGetting Started with Python
Getting Started with Python
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Introduction to Computers
Introduction to ComputersIntroduction to Computers
Introduction to Computers
 
Easy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkeyEasy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkey
 
Intro to Programming Week 2_Python Installation.pptx
Intro to Programming Week 2_Python Installation.pptxIntro to Programming Week 2_Python Installation.pptx
Intro to Programming Week 2_Python Installation.pptx
 
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptxPython_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 

Recently uploaded (20)

Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 

Python games

  • 2.  Python is a computer programming language. We chose Python for this tutorial because it’s a simple language to start out with, and is fun and easy to learn.
  • 3.  While you can run short bits of Python code at the Python prompt, if you want to work on a bigger program (like a game), you probably want to SAVE your code to a file so that you don’t have to type it in over and over again.
  • 4.  There are several ways to run a Python program as a file. One way is to use a plain text editor like Notepad (Windows), or TextEdit (Mac). Open a new text file, type in your Python code (like print 1+1).
  • 5.  Then on Windows, double-click this file to run it. On Mac, open Terminal and type python, then drag the file that you SAVED onto the Terminal window and press Enter.
  • 6.  The other way is to type in your code using the IDLE editor, which is what you’re going to do in this tutorial. To run idle, simply type idle from Terminal. Then choose FileNew Window from the IDLE menu and you should have a text editor window where you can type in Python code. You can SAVE your code changes via FileSave and even run the code via RunRun Module (F5).
  • 7.  You are almost ready to create your game. But what’s a game without some great graphics and sound effects? I’ve put together all the graphics and sound effects you’ll need for your game into a ZIP archive. You can download it here.
  • 8.  Once you’ve downloaded the file, create a folder for your game on your hard disk and extract the resources folder into that folder so that your game folder has a subfolder named resources, with the various resources grouped in additional folders inside it
  • 9.  The first if statement checks if the time is up. The second one checks if the castle is destroyed. The third one calculates your accuracy ratio. After that, a quick if statement checks if you won or lost and displays the correct image.